test/lib/authn/model_test.rb in authn-2.6.0 vs test/lib/authn/model_test.rb in authn-3.1.0
- old
+ new
@@ -1,67 +1,65 @@
require 'minitest/autorun'
require_relative '../../helper'
class TestAuthNModel < MiniTest::Unit::TestCase
def setup
-
+ @account = Account.new
end
- # def has_authentication(o = {})
- # options = AuthN::Config::DEFAULTS.dup
- # options.merge! AuthN.config if AuthN.config.to_hash
- # options.merge! o unless o.empty?
- # config options
+ # def has_authentication(options = {})
+ # merge_config_with options
# end
- def test_
- actual =
- expected =
- assert_equal expected, actual
+ def test_model_gets_has_authentication_method
+ assert Account.public_methods.include? :has_authentication
end
- def test_
+ def test_has_authentication_config_combinds_with_default_config
actual =
expected =
assert_equal expected, actual
end
- def test_
+ def test_has_autehntication_config_merges_in_model_config
actual =
expected =
assert_equal expected, actual
end
- def test_
+ # def config=(options)
+ # @@config = options
+ # end
+ #
+ # def config
+ # @@config ||= AuthN::Config.new
+ # end
+ def test_model_has_class_wide_config_settings
actual =
expected =
assert_equal expected, actual
end
# def authenticate(identifiers = {})
- # password = identifiers.delete :password
- # criteria = where identifiers
+ # password = identifiers.delete AuthN.config.login_password_key
+ # criteria = send AuthN.config.model_critera_method, identifiers
# instance = criteria.first
# if instance && password
- # if instance.authenticate password
- # instance
- # else
- # false
- # end
+ # instance.authenticate(password) ? instance : false
# end
# end
- def test_
+ def test_authenticate_returns_instance_if_given_good_credentials
actual =
expected =
assert_equal expected, actual
end
- def test_
+ def test_authenticate_returns_false_if_bad_password
actual =
expected =
assert_equal expected, actual
end
- def test_
+ def test_authenticate_return_nil_if_no_record_found
actual =
expected =
assert_equal expected, actual
end
end