test/controllers/internal_helpers_test.rb in devise-1.5.4 vs test/controllers/internal_helpers_test.rb in devise-2.0.0.rc
- old
+ new
@@ -43,13 +43,15 @@
@mock_warden.expects(:user).with(:user).returns(User.new)
@controller.expects(:redirect_to).with(root_path)
@controller.send :require_no_authentication
end
- test 'require no authentication skips if no inputs are available' do
+ test 'require no authentication only checks if already authenticated if no inputs strategies are available' do
Devise.mappings[:user].expects(:no_input_strategies).returns([])
@mock_warden.expects(:authenticate?).never
- @controller.expects(:redirect_to).never
+ @mock_warden.expects(:authenticated?).with(:user).once.returns(true)
+ @mock_warden.expects(:user).with(:user).returns(User.new)
+ @controller.expects(:redirect_to).with(root_path)
@controller.send :require_no_authentication
end
test 'require no authentication sets a flash message' do
@mock_warden.expects(:authenticate?).with(:rememberable, :token_authenticatable, :scope => :user).returns(true)