mirror of
https://github.com/heartcombo/devise.git
synced 2022-11-09 12:18:31 -05:00
Merge pull request #4445 from gogovan/fix-strategy-class-tests
Fix Omniauth config tests
This commit is contained in:
commit
a47928090a
2 changed files with 12 additions and 10 deletions
|
@ -164,8 +164,8 @@ class ControllerAuthenticatableTest < Devise::ControllerTestCase
|
|||
@controller.instance_variable_set(:@current_user, user)
|
||||
@controller.instance_variable_set(:@current_admin, user)
|
||||
@controller.sign_out
|
||||
assert_equal nil, @controller.instance_variable_get(:@current_user)
|
||||
assert_equal nil, @controller.instance_variable_get(:@current_admin)
|
||||
assert_nil @controller.instance_variable_get(:@current_user)
|
||||
assert_nil @controller.instance_variable_get(:@current_admin)
|
||||
end
|
||||
|
||||
test 'sign out logs out and clears up any signed in user by scope' do
|
||||
|
@ -175,7 +175,7 @@ class ControllerAuthenticatableTest < Devise::ControllerTestCase
|
|||
@mock_warden.expects(:clear_strategies_cache!).with(scope: :user).returns(true)
|
||||
@controller.instance_variable_set(:@current_user, user)
|
||||
@controller.sign_out(:user)
|
||||
assert_equal nil, @controller.instance_variable_get(:@current_user)
|
||||
assert_nil @controller.instance_variable_get(:@current_user)
|
||||
end
|
||||
|
||||
test 'sign out accepts a resource as argument' do
|
||||
|
|
|
@ -25,19 +25,21 @@ class OmniAuthConfigTest < ActiveSupport::TestCase
|
|||
assert_equal OmniAuth::Strategies::Facebook, config.strategy_class
|
||||
end
|
||||
|
||||
test "finds the strategy in OmniAuth's list by name" do
|
||||
NamedTestStrategy = Class.new
|
||||
NamedTestStrategy.send :include, OmniAuth::Strategy
|
||||
NamedTestStrategy.option :name, :the_one
|
||||
class NamedTestStrategy
|
||||
include OmniAuth::Strategy
|
||||
option :name, :the_one
|
||||
end
|
||||
|
||||
test "finds the strategy in OmniAuth's list by name" do
|
||||
config = Devise::OmniAuth::Config.new :the_one, [{}]
|
||||
assert_equal NamedTestStrategy, config.strategy_class
|
||||
end
|
||||
|
||||
test "finds the strategy in OmniAuth's list by class name" do
|
||||
UnNamedTestStrategy = Class.new
|
||||
UnNamedTestStrategy.send :include, OmniAuth::Strategy
|
||||
class UnNamedTestStrategy
|
||||
include OmniAuth::Strategy
|
||||
end
|
||||
|
||||
test "finds the strategy in OmniAuth's list by class name" do
|
||||
config = Devise::OmniAuth::Config.new :un_named_test_strategy, [{}]
|
||||
assert_equal UnNamedTestStrategy, config.strategy_class
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue