Sha256: 54554a3ae31de76ff722c190203f373bf209958d3a88947d2c6790967054fa68
Contents?: true
Size: 1.08 KB
Versions: 5
Compression:
Stored size: 1.08 KB
Contents
require "test_helper" class PasswordsControllerTest < ActionDispatch::IntegrationTest setup do @<%= singular_table_name %>, @token = sign_in_as(<%= table_name %>(:lazaro_nixon)) end test "should update password" do patch password_url, params: { current_password: "Secret123456", password: "Secret654321", password_confirmation: "Secret654321" }, headers: { "Authorization" => "Bearer #{@token}" } assert_response :success end test "should not update password with wrong current password" do patch password_url, params: { current_password: "SecretWrong123", password: "Secret654321", password_confirmation: "Secret654321" }, headers: { "Authorization" => "Bearer #{@token}" } assert_response :bad_request assert_equal "The current password you entered is incorrect", response.parsed_body["error"] end def sign_in_as(<%= singular_table_name %>) post(sign_in_url, params: { email: <%= singular_table_name %>.email, password: "Secret123456" }, headers: { "User-Agent" => "App iOS" }); [<%= singular_table_name %>, response.headers["X-Session-Token"]] end end
Version data entries
5 entries across 5 versions & 1 rubygems