mirror of
https://github.com/we-promise/sure.git
synced 2026-04-24 14:34:08 +00:00
Subscription tests and domain (#2209)
* Save work * Subscriptions and trials domain * Store family ID on customer * Remove indirection of stripe calls * Test simplifications * Update brakeman * Fix stripe tests in CI * Update billing page to show subscription details * Remove legacy columns * Complete billing settings page * Fix hardcoded plan name * Handle subscriptions for self hosting mode * Lint fixes
This commit is contained in:
@@ -3,6 +3,7 @@ require "test_helper"
|
||||
class OnboardableTest < ActionDispatch::IntegrationTest
|
||||
setup do
|
||||
sign_in @user = users(:empty)
|
||||
@user.family.subscription.destroy
|
||||
end
|
||||
|
||||
test "must complete onboarding before any other action" do
|
||||
@@ -10,32 +11,18 @@ class OnboardableTest < ActionDispatch::IntegrationTest
|
||||
|
||||
get root_path
|
||||
assert_redirected_to onboarding_path
|
||||
|
||||
@user.family.update!(trial_started_at: 1.day.ago, stripe_subscription_status: "active")
|
||||
|
||||
get root_path
|
||||
assert_redirected_to onboarding_path
|
||||
end
|
||||
|
||||
test "must subscribe if onboarding complete and no trial or subscription is active" do
|
||||
test "must have subscription to visit dashboard" do
|
||||
@user.update!(onboarded_at: 1.day.ago)
|
||||
@user.family.update!(trial_started_at: nil, stripe_subscription_status: "incomplete")
|
||||
|
||||
get root_path
|
||||
assert_redirected_to upgrade_subscription_path
|
||||
end
|
||||
|
||||
test "onboarded trial user can visit dashboard" do
|
||||
@user.update!(onboarded_at: 1.day.ago)
|
||||
@user.family.update!(trial_started_at: 1.day.ago, stripe_subscription_status: "incomplete")
|
||||
|
||||
get root_path
|
||||
assert_response :success
|
||||
assert_redirected_to trial_onboarding_path
|
||||
end
|
||||
|
||||
test "onboarded subscribed user can visit dashboard" do
|
||||
@user.update!(onboarded_at: 1.day.ago)
|
||||
@user.family.update!(stripe_subscription_status: "active")
|
||||
@user.family.start_trial_subscription!
|
||||
|
||||
get root_path
|
||||
assert_response :success
|
||||
|
||||
Reference in New Issue
Block a user