Sha256: 2f8967bfc6a308247f592552cec4f8a7c47dfd39db251482f6c4eaf58b3125f8

Contents?: true

Size: 816 Bytes

Versions: 47

Compression:

Stored size: 816 Bytes

Contents

# frozen_string_literal: true

module Alchemy
  module TestSupport
    # Allows you to stub the Alchemy configuration in your specs
    #
    # Require and include this file in your RSpec config.
    #
    #     RSpec.configure do |config|
    #       config.include Alchemy::TestSupport::ConfigStubbing
    #     end
    #
    module ConfigStubbing
      # Stub a key from the Alchemy config
      #
      # @param key [Symbol] The configuration key you want to stub
      # @param value [Object] The value you want to return instead of the original one
      #
      def stub_alchemy_config(key, value)
        allow(Alchemy::Config).to receive(:get) do |arg|
          if arg == key
            value
          else
            Alchemy::Config.show[arg.to_s]
          end
        end
      end
    end
  end
end

Version data entries

47 entries across 47 versions & 1 rubygems

Version Path
alchemy_cms-7.3.4 lib/alchemy/test_support/config_stubbing.rb
alchemy_cms-7.3.3 lib/alchemy/test_support/config_stubbing.rb
alchemy_cms-7.3.2 lib/alchemy/test_support/config_stubbing.rb
alchemy_cms-7.2.7 lib/alchemy/test_support/config_stubbing.rb
alchemy_cms-7.3.1 lib/alchemy/test_support/config_stubbing.rb
alchemy_cms-7.3.0 lib/alchemy/test_support/config_stubbing.rb
alchemy_cms-7.2.6 lib/alchemy/test_support/config_stubbing.rb
alchemy_cms-7.2.5 lib/alchemy/test_support/config_stubbing.rb
alchemy_cms-7.1.12 lib/alchemy/test_support/config_stubbing.rb
alchemy_cms-7.0.15 lib/alchemy/test_support/config_stubbing.rb
alchemy_cms-7.2.4 lib/alchemy/test_support/config_stubbing.rb
alchemy_cms-7.1.11 lib/alchemy/test_support/config_stubbing.rb
alchemy_cms-7.2.3 lib/alchemy/test_support/config_stubbing.rb
alchemy_cms-7.1.10 lib/alchemy/test_support/config_stubbing.rb
alchemy_cms-7.2.2 lib/alchemy/test_support/config_stubbing.rb
alchemy_cms-7.1.9 lib/alchemy/test_support/config_stubbing.rb
alchemy_cms-7.0.14 lib/alchemy/test_support/config_stubbing.rb
alchemy_cms-7.2.1 lib/alchemy/test_support/config_stubbing.rb
alchemy_cms-7.0.13 lib/alchemy/test_support/config_stubbing.rb
alchemy_cms-7.1.8 lib/alchemy/test_support/config_stubbing.rb