Sha256: 057bc947d6fb18d539651a9adb96b85841634f2f3d0fd99dded512369484ff96
Contents?: true
Size: 1.16 KB
Versions: 3
Compression:
Stored size: 1.16 KB
Contents
require "test_helper" class SessionsControllerTest < ActionDispatch::IntegrationTest setup do @<%= singular_table_name %>, @token = sign_in_as(<%= table_name %>(:lazaro_nixon)) end def default_headers { "Authorization" => "Bearer #{@token}" } end test "should get index" do get sessions_url, headers: default_headers assert_response :success end test "should show session" do get session_url(@<%= singular_table_name %>.sessions.last), headers: default_headers assert_response :success end test "should sign in" do post sign_in_url, params: { email: @<%= singular_table_name %>.email, password: "Secret1*3*5*" } assert_enqueued_email_with SessionMailer, :signed_in_notification, args: { session: @<%= singular_table_name %>.sessions.last } assert_response :created end test "should not sign in with wrong credentials" do post sign_in_url, params: { email: @<%= singular_table_name %>.email, password: "SecretWrong1*3" } assert_response :unauthorized end test "should sign out" do delete session_url(@<%= singular_table_name %>.sessions.last), headers: default_headers assert_response :no_content end end
Version data entries
3 entries across 3 versions & 1 rubygems