Sha256: 67857b6e4e65b90bd0b1b6abeede6ec97169e32379b62254e788fc4d5ee30412

Contents?: true

Size: 1.14 KB

Versions: 15

Compression:

Stored size: 1.14 KB

Contents

require 'test_helper'

class DatabaseAuthenticationTest < ActionController::IntegrationTest
  test 'sign in should not authenticate if not using proper authentication keys' do
    swap Devise, :authentication_keys => [:username] do
      sign_in_as_user
      assert_not warden.authenticated?(:user)
    end
  end

  test 'sign in with invalid email should return to sign in form with error message' do
    sign_in_as_admin do
      fill_in 'email', :with => 'wrongemail@test.com'
    end

    assert_contain 'Invalid email or password'
    assert_not warden.authenticated?(:admin)
  end

  test 'sign in with invalid pasword should return to sign in form with error message' do
    sign_in_as_admin do
      fill_in 'password', :with => 'abcdef'
    end

    assert_contain 'Invalid email or password'
    assert_not warden.authenticated?(:admin)
  end

  test 'error message is configurable by resource name' do
    store_translations :en, :devise => { :failure => { :admin => { :invalid => "Invalid credentials" } } } do
      sign_in_as_admin do
        fill_in 'password', :with => 'abcdef'
      end

      assert_contain 'Invalid credentials'
    end
  end
end

Version data entries

15 entries across 15 versions & 5 rubygems

Version Path
devise-1.1.9 test/integration/database_authenticatable_test.rb
devise-1.1.8 test/integration/database_authenticatable_test.rb
devise-1.1.7 test/integration/database_authenticatable_test.rb
devise-1.1.6 test/integration/database_authenticatable_test.rb
devise-1.1.5 test/integration/database_authenticatable_test.rb
devise-1.1.4 test/integration/database_authenticatable_test.rb
aihs_devise-1.2.rc test/integration/database_authenticatable_test.rb
gonow-devise-1.2.rc test/integration/database_authenticatable_test.rb
devise-edge-1.2.rc test/integration/database_authenticatable_test.rb
devise-1.1.3 test/integration/database_authenticatable_test.rb
devise-1.1.2 test/integration/database_authenticatable_test.rb
devise-1.1.1 test/integration/database_authenticatable_test.rb
devise-1.1.0 test/integration/database_authenticatable_test.rb
namxam-devise-1.1.0.win test/integration/database_authenticatable_test.rb
devise-1.1.rc2 test/integration/database_authenticatable_test.rb