Make active_subscription a private method

This commit is contained in:
Jorge Manrubia
2025-12-16 10:22:52 +01:00
parent e47657759f
commit b39a9ecab4
2 changed files with 12 additions and 12 deletions
+4 -4
View File
@@ -1,19 +1,19 @@
require "test_helper"
class Account::BillingTest < ActiveSupport::TestCase
test "active subscription" do
test "plan reflects active subscription" do
account = accounts(:initech)
# No subscription
assert_nil account.active_subscription
assert_equal Plan.free, account.plan
# Subscription but it is not active
account.create_subscription!(plan_key: "monthly_v1", status: "canceled", stripe_customer_id: "cus_test")
assert_nil account.active_subscription
assert_equal Plan.free, account.plan
# Active subscription exists
account.subscription.update!(status: "active")
assert_equal account.subscription, account.active_subscription
assert_equal Plan.paid, account.plan
end
test "comped account" do