The personal finance app for everyone
Pull out in_hosted_app helper
Jose Farias78c84c502805
diff --git a/test/controllers/registrations_controller_test.rb b/test/controllers/registrations_controller_test.rbindex 8d441b83..cbf3b6c4 100644--- a/test/controllers/registrations_controller_test.rb+++ b/test/controllers/registrations_controller_test.rb@@ -16,31 +16,38 @@ class RegistrationsControllerTest < ActionDispatch::IntegrationTestendtest "create when hosted requires an invite code" do- ENV["HOSTED"] = "true"+ in_hosted_app do+ assert_no_difference "User.count" do+ post registration_url, params: { user: {+ email: "[email protected]",+ password: "password",+ password_confirmation: "password" } }+ assert_redirected_to new_registration_url- assert_no_difference "User.count" do- post registration_url, params: { user: {- email: "[email protected]",- password: "password",- password_confirmation: "password" } }- assert_redirected_to new_registration_url-- post registration_url, params: { user: {- email: "[email protected]",- password: "password",- password_confirmation: "password",- invite_code: "foo" } }- assert_redirected_to new_registration_url- end+ post registration_url, params: { user: {+ email: "[email protected]",+ password: "password",+ password_confirmation: "password",+ invite_code: "foo" } }+ assert_redirected_to new_registration_url+ end- assert_difference "User.count", +1 do- post registration_url, params: { user: {- email: "[email protected]",- password: "password",- password_confirmation: "password",- invite_code: InviteCode.generate! } }- assert_redirected_to root_url+ assert_difference "User.count", +1 do+ post registration_url, params: { user: {+ email: "[email protected]",+ password: "password",+ password_confirmation: "password",+ invite_code: InviteCode.generate! } }+ assert_redirected_to root_url+ endend+ end++ private++ def in_hosted_app+ ENV["HOSTED"] = "true"+ yieldensureENV["HOSTED"] = nilend