Sha256: 38f5bf8b392311fe4dc2379ff45070a7c10c1d33859457c2189a37acdd0711ad

Contents?: true

Size: 867 Bytes

Versions: 3

Compression:

Stored size: 867 Bytes

Contents

require "test_helper"

class PasswordsControllerTest < 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 update password" do
    patch password_url, params: { current_password: "Secret1*3*5*", password: "Secret6*4*2*", password_confirmation: "Secret6*4*2*" }, headers: default_headers
    assert_response :success
  end

  test "should not update password with wrong current password" do
    patch password_url, params: { current_password: "SecretWrong1*3", password: "Secret6*4*2*", password_confirmation: "Secret6*4*2*" }, headers: default_headers

    assert_response :bad_request
    assert_equal "The current password you entered is incorrect", response.parsed_body["error"]
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
authentication-zero-2.11.2 lib/generators/authentication/templates/test_unit/controllers/api/passwords_controller_test.rb.tt
authentication-zero-2.11.1 lib/generators/authentication/templates/test_unit/controllers/api/passwords_controller_test.rb.tt
authentication-zero-2.11.0 lib/generators/authentication/templates/test_unit/controllers/api/passwords_controller_test.rb.tt