Sha256: f32b74dcf4fa8040319f6851639f94bdf2e6d8fb1fee30ce8490e45809a5df7a

Contents?: true

Size: 805 Bytes

Versions: 9

Compression:

Stored size: 805 Bytes

Contents

require 'test_helper'

class PasswordUpdateTest < ActionDispatch::IntegrationTest
  test 'password can be updated' do
    user = FactoryBot.create(:user)

    acting_as(user).put password_update_path, params: {
      current_password: 'password',
      password: 'new-password',
      password_confirmation: 'new-password'
    }

    assert_redirected_to profile_edit_path
    assert BCrypt::Password.new(user.reload.password_digest).is_password?('new-password')
  end

  test 'correct password must be provided to update password' do
    user = FactoryBot.create(:user)

    acting_as(user).put password_update_path, params: {
      current_password: 'wrong-password',
      password: 'new-password',
      password_confirmation: 'new-password'
    }

    assert_response :unprocessable_entity
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
kaze-0.17.0 stubs/default/test/integration/password_update_test.rb
kaze-0.16.0 stubs/default/test/integration/password_update_test.rb
kaze-0.15.0 stubs/default/test/integration/password_update_test.rb
kaze-0.14.0 stubs/default/test/integration/password_update_test.rb
kaze-0.13.0 stubs/default/test/integration/password_update_test.rb
kaze-0.12.0 stubs/default/test/integration/password_update_test.rb
kaze-0.11.0 stubs/default/test/integration/password_update_test.rb
kaze-0.10.0 stubs/default/test/integration/password_update_test.rb
kaze-0.9.0 stubs/default/test/integration/password_update_test.rb