Sha256: 5ae9b2654fcdbd35c2aee186c7de2c32841a1b88b8f72f890bba033397b21248

Contents?: true

Size: 671 Bytes

Versions: 56

Compression:

Stored size: 671 Bytes

Contents

# frozen_string_literal: true

module Alchemy
  module TestSupport
    # Helpers for integration specs
    #
    # This file is included in spec_helper.rb
    #
    module IntegrationHelpers
      # Used to stub the current_user in integration specs
      #
      # Pass either a user object or a symbol in the format of ':as_admin'.
      #
      def authorize_user(user_or_role = nil)
        user = case user_or_role
        when Symbol, String
          build(:alchemy_dummy_user, user_or_role)
        else
          user_or_role
        end
        allow_any_instance_of(ApplicationController).to receive(:current_user).and_return(user)
      end
    end
  end
end

Version data entries

56 entries across 56 versions & 1 rubygems

Version Path
alchemy_cms-7.4.2 lib/alchemy/test_support/integration_helpers.rb
alchemy_cms-7.3.6 lib/alchemy/test_support/integration_helpers.rb
alchemy_cms-7.2.9 lib/alchemy/test_support/integration_helpers.rb
alchemy_cms-7.4.1 lib/alchemy/test_support/integration_helpers.rb
alchemy_cms-7.4.0 lib/alchemy/test_support/integration_helpers.rb
alchemy_cms-7.3.5 lib/alchemy/test_support/integration_helpers.rb
alchemy_cms-7.2.8 lib/alchemy/test_support/integration_helpers.rb
alchemy_cms-7.1.13 lib/alchemy/test_support/integration_helpers.rb
alchemy_cms-7.0.16 lib/alchemy/test_support/integration_helpers.rb
alchemy_cms-7.3.4 lib/alchemy/test_support/integration_helpers.rb
alchemy_cms-7.3.3 lib/alchemy/test_support/integration_helpers.rb
alchemy_cms-7.3.2 lib/alchemy/test_support/integration_helpers.rb
alchemy_cms-7.2.7 lib/alchemy/test_support/integration_helpers.rb
alchemy_cms-7.3.1 lib/alchemy/test_support/integration_helpers.rb
alchemy_cms-7.3.0 lib/alchemy/test_support/integration_helpers.rb
alchemy_cms-7.2.6 lib/alchemy/test_support/integration_helpers.rb
alchemy_cms-7.2.5 lib/alchemy/test_support/integration_helpers.rb
alchemy_cms-7.1.12 lib/alchemy/test_support/integration_helpers.rb
alchemy_cms-7.0.15 lib/alchemy/test_support/integration_helpers.rb
alchemy_cms-7.2.4 lib/alchemy/test_support/integration_helpers.rb