Sha256: 7751b9c2637e56dfccf26412eba75fd2331d1aa284b9c2bf020405a95bdc259d

Contents?: true

Size: 619 Bytes

Versions: 2

Compression:

Stored size: 619 Bytes

Contents

module Janus
  module TestHelper
    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)
    end

    def sign_out(user_or_scope)
      @janus.logout(Janus.scope_for(user_or_scope))
    end

    def assert_authenticated(scope)
      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."
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
janus-0.6.0 lib/janus/test_helper.rb
janus-0.5.0 lib/janus/test_helper.rb