Sha256: ebbc76f4f9b2db77765fb42438f9bc1ab05ddbc83a9e1e8c44657d2c5f3c1216

Contents?: true

Size: 828 Bytes

Versions: 8

Compression:

Stored size: 828 Bytes

Contents

require "test_helper"

class PasswordsControllerTest < ActionDispatch::IntegrationTest
  setup do
    @user, @token = sign_in_as(users(:lazaro_nixon))
  end

  def default_headers
    { "Authorization" => "Bearer #{@token}" }
  end

  test "should update password" do
    patch password_url, params: { password_challenge: "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 password challenge" do
    patch password_url, params: { password_challenge: "SecretWrong1*3", password: "Secret6*4*2*", password_confirmation: "Secret6*4*2*" }, headers: default_headers

    assert_response :unprocessable_entity
    assert_equal ["is invalid"], response.parsed_body["password_challenge"]
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
authentication-zero-4.0.3 lib/generators/authentication/templates/test_unit/controllers/api/passwords_controller_test.rb.tt
authentication-zero-4.0.2 lib/generators/authentication/templates/test_unit/controllers/api/passwords_controller_test.rb.tt
authentication-zero-4.0.1 lib/generators/authentication/templates/test_unit/controllers/api/passwords_controller_test.rb.tt
authentication-zero-4.0.0 lib/generators/authentication/templates/test_unit/controllers/api/passwords_controller_test.rb.tt
authentication-zero-3.0.2 lib/generators/authentication/templates/test_unit/controllers/api/passwords_controller_test.rb.tt
authentication-zero-3.0.1 lib/generators/authentication/templates/test_unit/controllers/api/passwords_controller_test.rb.tt
authentication-zero-3.0.0 lib/generators/authentication/templates/test_unit/controllers/api/passwords_controller_test.rb.tt
authentication-zero-3.0.0.alpha1 lib/generators/authentication/templates/test_unit/controllers/api/passwords_controller_test.rb.tt