diff --git a/saas/test/controllers/.keep b/saas/test/controllers/.keep deleted file mode 100644 index e69de29bb..000000000 diff --git a/saas/test/controllers/sessions_controller_test.rb b/saas/test/controllers/sessions_controller_test.rb new file mode 100644 index 000000000..14892d34e --- /dev/null +++ b/saas/test/controllers/sessions_controller_test.rb @@ -0,0 +1,21 @@ +require "test_helper" + +class SessionsControllerTest < ActionDispatch::IntegrationTest + test "create for a new user" do + assert_difference -> { Identity.count }, +1 do + assert_difference -> { MagicLink.count }, +1 do + post session_path, + params: { email_address: "nonexistent-#{SecureRandom.hex(6)}@example.com" }, + headers: http_basic_auth_headers("testname", "testpassword") + end + end + + assert_redirected_to session_magic_link_path + end + + private + def http_basic_auth_headers(user, password) + { "Authorization" => ActionController::HttpAuthentication::Basic.encode_credentials(user, password) } + end +end +