DEV: Fix mocha deprecations (#140)

It now supports strict keyword argument matching by default.
This commit is contained in:
Jarek Radosz 2022-11-02 10:47:35 +01:00 committed by GitHub
parent 1f9907d9e7
commit d59a283fd2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 7 deletions

View File

@ -23,7 +23,7 @@ module DiscourseSubscriptions
describe "#index" do
it "returns a list of promo codes" do
::Stripe::PromotionCode.expects(:list).with(limit: 100).returns({
::Stripe::PromotionCode.expects(:list).with({ limit: 100 }).returns({
data: [{
id: 'promo_123',
coupon: {
@ -38,7 +38,7 @@ module DiscourseSubscriptions
end
it "only returns valid promo codes" do
::Stripe::PromotionCode.expects(:list).with(limit: 100).returns({
::Stripe::PromotionCode.expects(:list).with({ limit: 100 }).returns({
data: [{
id: 'promo_123',
coupon: {

View File

@ -66,7 +66,7 @@ module DiscourseSubscriptions
end
it "lists the plans for the product" do
::Stripe::Price.expects(:list).with(product: 'prod_id123')
::Stripe::Price.expects(:list).with({ product: 'prod_id123' })
get "/s/admin/plans.json", params: { product_id: 'prod_id123' }
end
end

View File

@ -134,7 +134,7 @@ module DiscourseSubscriptions
)
::Stripe::Subscription.expects(:retrieve).with('sub_12345').returns(latest_invoice: 'in_123')
::Stripe::Invoice.expects(:retrieve).with('in_123').returns(payment_intent: 'pi_123')
::Stripe::Refund.expects(:create).with(payment_intent: 'pi_123')
::Stripe::Refund.expects(:create).with({ payment_intent: 'pi_123' })
delete "/s/admin/subscriptions/sub_12345.json", params: { refund: true }
end

View File

@ -42,7 +42,7 @@ module DiscourseSubscriptions
describe "#index" do
it "gets products" do
::Stripe::Product.expects(:list).with(ids: product_ids, active: true).returns(data: [product])
::Stripe::Product.expects(:list).with({ ids: product_ids, active: true }).returns(data: [product])
get "/s.json"
@ -57,7 +57,7 @@ module DiscourseSubscriptions
it "is subscribed" do
Fabricate(:customer, product_id: product[:id], user_id: user.id, customer_id: 'x')
::Stripe::Product.expects(:list).with(ids: product_ids, active: true).returns(data: [product])
::Stripe::Product.expects(:list).with({ ids: product_ids, active: true }).returns(data: [product])
get "/s.json"
data = response.parsed_body
@ -66,7 +66,7 @@ module DiscourseSubscriptions
it "is not subscribed" do
::DiscourseSubscriptions::Customer.delete_all
::Stripe::Product.expects(:list).with(ids: product_ids, active: true).returns(data: [product])
::Stripe::Product.expects(:list).with({ ids: product_ids, active: true }).returns(data: [product])
get "/s.json"
data = response.parsed_body