Sha256: 5d8f4c2f223f2a6d70e5fec4fcdbf5f423c2e115ef541a1ce068a6b49fc6ef24

Contents?: true

Size: 678 Bytes

Versions: 1

Compression:

Stored size: 678 Bytes

Contents

# frozen_string_literal: true

module Archangel
  module TestingSupport
    ##
    # Authorization helpers for testing
    #
    module AuthorizationHelpers
      ##
      # Authorization helpers for feature and request testing
      #
      module Feature
        include Warden::Test::Helpers

        Warden.test_mode!

        def stub_authorization!(user = nil)
          user ||= create(:user)

          login_as user, scope: :user

          user
        end
      end
    end
  end
end

RSpec.configure do |config|
  %i[feature request].each do |type|
    config.include Archangel::TestingSupport::AuthorizationHelpers::Feature,
                   type: type
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
archangel-0.4.0 lib/archangel/testing_support/helpers/authorization_helpers.rb