This commit is contained in:
Jorge Manrubia
2025-12-18 09:21:19 +01:00
parent 8bb59f507b
commit 0f9d1df31b
2 changed files with 4 additions and 14 deletions
@@ -4,16 +4,11 @@ require "ostruct"
class Account::Subscriptions::DowngradesControllerTest < ActionDispatch::IntegrationTest
setup do
sign_in_as :kevin
accounts(:"37s").subscription.update!(
stripe_subscription_id: "sub_123",
plan: Plan.paid_with_extra_storage
)
accounts(:"37s").subscription.update!(stripe_subscription_id: "sub_123", plan: Plan.paid_with_extra_storage)
end
test "downgrade redirects to stripe billing portal" do
stripe_subscription = OpenStruct.new(
items: OpenStruct.new(data: [ OpenStruct.new(id: "si_123") ])
)
stripe_subscription = OpenStruct.new(items: OpenStruct.new(data: [ OpenStruct.new(id: "si_123") ]))
portal_session = OpenStruct.new(url: "https://billing.stripe.com/session/abc123")
Stripe::Subscription.stubs(:retrieve).with("sub_123").returns(stripe_subscription)
@@ -4,16 +4,11 @@ require "ostruct"
class Account::Subscriptions::UpgradesControllerTest < ActionDispatch::IntegrationTest
setup do
sign_in_as :kevin
accounts(:"37s").subscription.update!(
stripe_subscription_id: "sub_123",
plan: Plan.paid
)
accounts(:"37s").subscription.update!(stripe_subscription_id: "sub_123", plan: Plan.paid)
end
test "upgrade redirects to stripe billing portal" do
stripe_subscription = OpenStruct.new(
items: OpenStruct.new(data: [ OpenStruct.new(id: "si_123") ])
)
stripe_subscription = OpenStruct.new(items: OpenStruct.new(data: [ OpenStruct.new(id: "si_123") ]))
portal_session = OpenStruct.new(url: "https://billing.stripe.com/session/abc123")
Stripe::Subscription.stubs(:retrieve).with("sub_123").returns(stripe_subscription)