Sha256: f77b7701407a80bfd3106122935e5d9b594e6fa1d0287fc4dfa81fe5194d86ff

Contents?: true

Size: 1.04 KB

Versions: 27

Compression:

Stored size: 1.04 KB

Contents

require 'test_helper'

class AuthenticatableTest < ActiveSupport::TestCase
  test 'required_fields should be an empty array' do
    assert_equal Devise::Models::Validatable.required_fields(User), []
  end

  test 'find_first_by_auth_conditions allows custom filtering parameters' do
    user = User.create!(email: "example@example.com", password: "1234567")
    assert_equal User.find_first_by_auth_conditions({ email: "example@example.com" }), user
    assert_nil User.find_first_by_auth_conditions({ email: "example@example.com" }, id: user.id.to_s.next)
  end

  if defined?(ActionController::Parameters)
    test 'does not passes an ActionController::Parameters to find_first_by_auth_conditions through find_or_initialize_with_errors' do
      user = create_user(email: 'example@example.com')
      attributes = ActionController::Parameters.new(email: 'example@example.com')

      User.expects(:find_first_by_auth_conditions).with('email' => 'example@example.com').returns(user)
      User.find_or_initialize_with_errors([:email], attributes)
    end
  end
end

Version data entries

27 entries across 27 versions & 5 rubygems

Version Path
devise-4.3.0 test/models/authenticatable_test.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/devise-4.2.1/test/models/authenticatable_test.rb
devise-4.2.1 test/models/authenticatable_test.rb
devise-4.2.0 test/models/authenticatable_test.rb
devise-3.5.10 test/models/authenticatable_test.rb
devise-4.0.3 test/models/authenticatable_test.rb
devise-4.1.1 test/models/authenticatable_test.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/devise-4.1.0/test/models/authenticatable_test.rb
devise-4.1.0 test/models/authenticatable_test.rb
devise-3.5.9 test/models/authenticatable_test.rb
devise-4.0.2 test/models/authenticatable_test.rb
devise-4.0.1 test/models/authenticatable_test.rb
devise-3.5.8 test/models/authenticatable_test.rb
devise-3.5.7 test/models/authenticatable_test.rb
devise-4.0.0 test/models/authenticatable_test.rb
devise-4.0.0.rc2 test/models/authenticatable_test.rb
devise-4.0.0.rc1 test/models/authenticatable_test.rb
devise-3.5.6 test/models/authenticatable_test.rb
devise-3.5.5 test/models/authenticatable_test.rb
devise-3.5.4 test/models/authenticatable_test.rb