mirror of
https://github.com/we-promise/sure.git
synced 2026-05-30 07:49:01 +00:00
feat(goals): gate Goals v2 behind beta features toggle
Add require_beta_features! to GoalsController and GoalPledgesController, hide the Goals nav item for non-beta users, and tag index/show headers with the Beta pill marker. Update controller tests to enable the preference in setup and assert the redirect for users without access.
This commit is contained in:
@@ -2,13 +2,24 @@ require "test_helper"
|
||||
|
||||
class GoalPledgesControllerTest < ActionDispatch::IntegrationTest
|
||||
setup do
|
||||
sign_in users(:family_admin)
|
||||
@user = users(:family_admin)
|
||||
@user.update!(preferences: (@user.preferences || {}).merge("beta_features_enabled" => true))
|
||||
sign_in @user
|
||||
@goal = goals(:vacation_italy)
|
||||
@account = accounts(:depository)
|
||||
@pledge = goal_pledges(:open_transfer)
|
||||
ensure_tailwind_build
|
||||
end
|
||||
|
||||
test "redirects users without beta access" do
|
||||
@user.update!(preferences: (@user.preferences || {}).merge("beta_features_enabled" => false))
|
||||
|
||||
get new_goal_pledge_url(@goal), headers: { "Turbo-Frame" => "modal" }
|
||||
|
||||
assert_redirected_to root_path
|
||||
assert_match(/beta/i, flash[:alert])
|
||||
end
|
||||
|
||||
test "new renders the pledge form inside a turbo frame" do
|
||||
get new_goal_pledge_url(@goal), headers: { "Turbo-Frame" => "modal" }
|
||||
assert_response :success
|
||||
|
||||
@@ -2,13 +2,24 @@ require "test_helper"
|
||||
|
||||
class GoalsControllerTest < ActionDispatch::IntegrationTest
|
||||
setup do
|
||||
sign_in users(:family_admin)
|
||||
@user = users(:family_admin)
|
||||
@user.update!(preferences: (@user.preferences || {}).merge("beta_features_enabled" => true))
|
||||
sign_in @user
|
||||
@goal = goals(:vacation_italy)
|
||||
@depository = accounts(:depository)
|
||||
@connected = accounts(:connected)
|
||||
ensure_tailwind_build
|
||||
end
|
||||
|
||||
test "redirects users without beta access" do
|
||||
@user.update!(preferences: (@user.preferences || {}).merge("beta_features_enabled" => false))
|
||||
|
||||
get goals_url
|
||||
|
||||
assert_redirected_to root_path
|
||||
assert_match(/beta/i, flash[:alert])
|
||||
end
|
||||
|
||||
test "index renders with active filter by default" do
|
||||
get goals_url
|
||||
assert_response :success
|
||||
|
||||
Reference in New Issue
Block a user