Sha256: 543c4e2df3ca47cddd7b40018903b05f1ea7c152b5a75a12ccfb1d552ebeb0ba

Contents?: true

Size: 785 Bytes

Versions: 48

Compression:

Stored size: 785 Bytes

Contents

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

48 entries across 48 versions & 1 rubygems

Version Path
alchemy_cms-4.6.7 lib/alchemy/test_support/config_stubbing.rb
alchemy_cms-4.6.6 lib/alchemy/test_support/config_stubbing.rb
alchemy_cms-4.6.5 lib/alchemy/test_support/config_stubbing.rb
alchemy_cms-4.5.1 lib/alchemy/test_support/config_stubbing.rb
alchemy_cms-4.4.5 lib/alchemy/test_support/config_stubbing.rb
alchemy_cms-4.6.4 lib/alchemy/test_support/config_stubbing.rb
alchemy_cms-4.0.6 lib/alchemy/test_support/config_stubbing.rb
alchemy_cms-4.6.3 lib/alchemy/test_support/config_stubbing.rb
alchemy_cms-3.6.7 lib/alchemy/test_support/config_stubbing.rb
alchemy_cms-3.6.6 lib/alchemy/test_support/config_stubbing.rb
alchemy_cms-4.6.2 lib/alchemy/test_support/config_stubbing.rb
alchemy_cms-4.6.1 lib/alchemy/test_support/config_stubbing.rb
alchemy_cms-4.6.0 lib/alchemy/test_support/config_stubbing.rb
alchemy_cms-4.5.0 lib/alchemy/test_support/config_stubbing.rb
alchemy_cms-4.4.4 lib/alchemy/test_support/config_stubbing.rb
alchemy_cms-4.4.3 lib/alchemy/test_support/config_stubbing.rb
alchemy_cms-4.4.2 lib/alchemy/test_support/config_stubbing.rb
alchemy_cms-4.4.1 lib/alchemy/test_support/config_stubbing.rb
alchemy_cms-4.4.0 lib/alchemy/test_support/config_stubbing.rb
alchemy_cms-4.3.2 lib/alchemy/test_support/config_stubbing.rb