mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-24 07:39:39 +02:00
Onboarding redirect tests and trial status bar (#2197)
* Onboarding redirect tests and trial status bar * use helper method * Fix time tolerance failure * Update post-onboarding message to be generic * Disable turbo frames on Trial start button * Update flash notice in test
This commit is contained in:
parent
bc7e32deab
commit
441f436187
9 changed files with 110 additions and 18 deletions
43
test/controllers/concerns/onboardable_test.rb
Normal file
43
test/controllers/concerns/onboardable_test.rb
Normal file
|
@ -0,0 +1,43 @@
|
|||
require "test_helper"
|
||||
|
||||
class OnboardableTest < ActionDispatch::IntegrationTest
|
||||
setup do
|
||||
sign_in @user = users(:empty)
|
||||
end
|
||||
|
||||
test "must complete onboarding before any other action" do
|
||||
@user.update!(onboarded_at: nil)
|
||||
|
||||
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
|
||||
@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
|
||||
end
|
||||
|
||||
test "onboarded subscribed user can visit dashboard" do
|
||||
@user.update!(onboarded_at: 1.day.ago)
|
||||
@user.family.update!(stripe_subscription_status: "active")
|
||||
|
||||
get root_path
|
||||
assert_response :success
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue