Sha256: e8541e0bde430603f43a32ec918bace91580dbdee1251945b63381ecd3b9b07a

Contents?: true

Size: 677 Bytes

Versions: 59

Compression:

Stored size: 677 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)
        case user_or_role
        when Symbol, String
          user = build(:alchemy_dummy_user, user_or_role)
        else
          user = user_or_role
        end
        allow_any_instance_of(ApplicationController).to receive(:current_user).and_return(user)
      end
    end
  end
end

Version data entries

59 entries across 59 versions & 1 rubygems

Version Path
alchemy_cms-6.1.10 lib/alchemy/test_support/integration_helpers.rb
alchemy_cms-6.1.9 lib/alchemy/test_support/integration_helpers.rb
alchemy_cms-6.1.8 lib/alchemy/test_support/integration_helpers.rb
alchemy_cms-6.1.7 lib/alchemy/test_support/integration_helpers.rb
alchemy_cms-6.1.6 lib/alchemy/test_support/integration_helpers.rb
alchemy_cms-6.1.5 lib/alchemy/test_support/integration_helpers.rb
alchemy_cms-6.0.14 lib/alchemy/test_support/integration_helpers.rb
alchemy_cms-6.1.4 lib/alchemy/test_support/integration_helpers.rb
alchemy_cms-7.0.0.pre.a lib/alchemy/test_support/integration_helpers.rb
alchemy_cms-6.0.13 lib/alchemy/test_support/integration_helpers.rb
alchemy_cms-6.1.3 lib/alchemy/test_support/integration_helpers.rb
alchemy_cms-6.1.2 lib/alchemy/test_support/integration_helpers.rb
alchemy_cms-6.1.1 lib/alchemy/test_support/integration_helpers.rb
alchemy_cms-6.1.0 lib/alchemy/test_support/integration_helpers.rb
alchemy_cms-6.0.12 lib/alchemy/test_support/integration_helpers.rb
alchemy_cms-6.0.11 lib/alchemy/test_support/integration_helpers.rb
alchemy_cms-6.0.10 lib/alchemy/test_support/integration_helpers.rb
alchemy_cms-5.3.8 lib/alchemy/test_support/integration_helpers.rb
alchemy_cms-6.0.9 lib/alchemy/test_support/integration_helpers.rb
alchemy_cms-5.3.7 lib/alchemy/test_support/integration_helpers.rb