Sha256: 67313d034a1259f7ad3eb0dfa8ff21a63e8f915deee0e507f6ac87a43e1f8d90

Contents?: true

Size: 713 Bytes

Versions: 16

Compression:

Stored size: 713 Bytes

Contents

require 'spec_helper'
include Warden::Test::Helpers

module Gaku::Testing::AuthHelpers

  module Controller
    def as(user)
      @request.env['devise.mapping'] = ::Devise.mappings[:admin] if user == 'admin'
      sign_in create("#{user.to_sym}_user")
    end
  end

  module Feature
    def as(user)
      if user.is_a?(Symbol)
        login_as create("#{user.to_sym}_user"), scope: :user
      else
        login_as user, scope: :user
      end
    end
  end

end

RSpec.configure do |config|
  config.include Gaku::Testing::AuthHelpers::Controller, type: :controller
  config.include Gaku::Testing::AuthHelpers::Feature, type: :request
  config.include Gaku::Testing::AuthHelpers::Feature, type: :feature
end

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
gaku_core-0.3.0 lib/gaku/testing/auth_helpers.rb
gaku_core-0.3.0.pre.4 lib/gaku/testing/auth_helpers.rb
gaku_core-0.3.0.pre.3 lib/gaku/testing/auth_helpers.rb
gaku_core-0.3.0.pre.2 lib/gaku/testing/auth_helpers.rb
gaku_core-0.3.0.pre.1 lib/gaku/testing/auth_helpers.rb
gaku_core-0.3.0.pre.0 lib/gaku/testing/auth_helpers.rb
gaku-0.2.4 core/lib/gaku/testing/auth_helpers.rb
gaku_core-0.2.4 lib/gaku/testing/auth_helpers.rb
gaku-0.2.3 core/lib/gaku/testing/auth_helpers.rb
gaku_core-0.2.3 lib/gaku/testing/auth_helpers.rb
gaku-0.2.2 core/lib/gaku/testing/auth_helpers.rb
gaku_core-0.2.2 lib/gaku/testing/auth_helpers.rb
gaku-0.2.1 core/lib/gaku/testing/auth_helpers.rb
gaku_core-0.2.1 lib/gaku/testing/auth_helpers.rb
gaku-0.2.0 core/lib/gaku/testing/auth_helpers.rb
gaku_core-0.2.0 lib/gaku/testing/auth_helpers.rb