lib/janus/test_helper.rb in janus-0.9.1 vs lib/janus/test_helper.rb in janus-0.10.0
- old
+ new
@@ -1,29 +1,33 @@
module Janus
module TestHelper
+ attr_reader :janus
+
def self.included(klass)
klass.class_eval do
setup { @janus = Janus::Manager.new(request, cookies) }
end
end
def sign_in(user, options = {})
- @janus.login(user, options)
+ janus.login(user, options)
end
def sign_out(user_or_scope = nil)
if user_or_scope
- @janus.logout(Janus.scope_for(user_or_scope))
+ janus.logout(Janus.scope_for(user_or_scope))
else
- @janus.logout
+ janus.logout
end
end
def assert_authenticated(scope)
- assert @janus.authenticated?(scope), "Expected #{scope} to be authenticated."
+ assert janus.authenticated?(scope), "Expected #{scope} to be authenticated."
end
- def assert_not_authenticated(scope)
- assert !@janus.authenticated?(scope), "Expected #{scope} to not be authenticated."
+ def refute_authenticated(scope)
+ refute janus.authenticated?(scope), "Expected #{scope} to not be authenticated."
end
+
+ alias_method :assert_not_authenticated, :refute_authenticated
end
end