Sha256: c3b8dda1ce7024f24b5572b4c15cdc8112d53e60c07e2c6a1704304869ec5a07
Contents?: true
Size: 976 Bytes
Versions: 3
Compression:
Stored size: 976 Bytes
Contents
require "test_helper" class Identity::EmailsControllerTest < ActionDispatch::IntegrationTest setup do @<%= singular_table_name %>, @token = sign_in_as(<%= table_name %>(:lazaro_nixon)) end test "should update email" do patch identity_email_url, params: { email: "new_email@hey.com" }, headers: { "Authorization" => "Bearer #{@token}" } assert_response :success end test "should not update email without sudo" do @<%= singular_table_name %>.sessions.last.update! sudo_at: 1.day.ago patch identity_email_url, params: { email: "new_email@hey.com" }, headers: { "Authorization" => "Bearer #{@token}" } assert_response :forbidden assert_equal "Enter your password to continue", response.parsed_body["error"] end def sign_in_as(<%= singular_table_name %>) post(sign_in_url, params: { email: <%= singular_table_name %>.email, password: "Secret1*3*5*" }); [<%= singular_table_name %>, response.headers["X-Session-Token"]] end end
Version data entries
3 entries across 3 versions & 1 rubygems