Sha256: 92b55c921e928518ef82b5b6e573c35d02fc8c6b63a9709f60a23767262b8d50

Contents?: true

Size: 803 Bytes

Versions: 3

Compression:

Stored size: 803 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

3 entries across 3 versions & 1 rubygems

Version Path
kaze-0.8.0 stubs/default/test/integration/password_update_test.rb
kaze-0.7.0 stubs/default/test/integration/password_update_test.rb
kaze-0.6.0 stubs/default/test/integration/password_update_test.rb