Sha256: d997b18d81cd361d380422c95288e2d73f6609622ded3cd0ddf51170a87968fc

Contents?: true

Size: 1.05 KB

Versions: 6

Compression:

Stored size: 1.05 KB

Contents

# frozen_string_literal: true

require 'test_helper'

class Devise::PasswordExpiredControllerTest < ActionController::TestCase
  include Devise::Test::ControllerHelpers

  setup do
    @request.env["devise.mapping"] = Devise.mappings[:user]
    @user = User.create!(
      username: 'hello',
      email: 'hello@path.travel',
      password: 'Password4',
      password_changed_at: 4.months.ago,
      confirmed_at: 5.months.ago
    )
    assert @user.valid?
    sign_in(@user)
  end

  test 'should render show' do
    get :show
    assert_includes @response.body, 'Renew your password'
  end

  test 'should update password' do
    if Rails.version < "5"
      put :update, {
        user: {
          current_password: 'Password4',
          password: 'Password5',
          password_confirmation: 'Password5'
        }
      }
    else
      put :update, params: {
        user: {
          current_password: 'Password4',
          password: 'Password5',
          password_confirmation: 'Password5'
        }
      }
    end
    assert_redirected_to root_path
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
devise-security-0.14.3 test/controllers/test_password_expired_controller.rb
devise-security-0.14.2 test/controllers/test_password_expired_controller.rb
devise-security-0.14.1 test/test_password_expired_controller.rb
devise-security-0.14.0 test/test_password_expired_controller.rb
devise-security-0.14.0.rc1 test/test_password_expired_controller.rb
devise-security-0.13.0 test/test_password_expired_controller.rb