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

View File

@ -66,7 +66,7 @@ module DiscourseSubscriptions
end end
it "lists the plans for the product" do 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' } get "/s/admin/plans.json", params: { product_id: 'prod_id123' }
end end
end end

View File

@ -134,7 +134,7 @@ module DiscourseSubscriptions
) )
::Stripe::Subscription.expects(:retrieve).with('sub_12345').returns(latest_invoice: 'in_123') ::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::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 } delete "/s/admin/subscriptions/sub_12345.json", params: { refund: true }
end end

View File

@ -42,7 +42,7 @@ module DiscourseSubscriptions
describe "#index" do describe "#index" do
it "gets products" 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" get "/s.json"
@ -57,7 +57,7 @@ module DiscourseSubscriptions
it "is subscribed" do it "is subscribed" do
Fabricate(:customer, product_id: product[:id], user_id: user.id, customer_id: 'x') 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" get "/s.json"
data = response.parsed_body data = response.parsed_body
@ -66,7 +66,7 @@ module DiscourseSubscriptions
it "is not subscribed" do it "is not subscribed" do
::DiscourseSubscriptions::Customer.delete_all ::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" get "/s.json"
data = response.parsed_body data = response.parsed_body