Sha256: 07c2cbedb2c90d9e092dfb672af975f4e4f3a8fee11f0f405c1940d694e7f9ad

Contents?: true

Size: 739 Bytes

Versions: 4

Compression:

Stored size: 739 Bytes

Contents

module SpecInfra
  module Configuration
    class << self
      VALID_OPTIONS_KEYS = [:path, :pre_command, :stdout, :stderr, :sudo_path, :disable_sudo, :pass_prompt].freeze

      def defaults
        VALID_OPTIONS_KEYS.inject({}) { |o, k| o.merge!(k => send(k)) }
      end

      def method_missing(meth, val=nil)
        key = meth.to_s
        key.gsub!(/=$/, '')
        if val
          instance_variable_set("@#{key}", val)
          RSpec.configuration.send(:"#{key}=", val) if defined?(RSpec)
        end

        ret = instance_variable_get("@#{key}")
        if ret.nil? && defined?(RSpec) && RSpec.configuration.respond_to?(key)
          ret = RSpec.configuration.send(key)
        end
        ret
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
specinfra-0.2.0 lib/specinfra/configuration.rb
specinfra-0.1.1 lib/specinfra/configuration.rb
specinfra-0.1.0 lib/specinfra/configuration.rb
specinfra-0.0.17 lib/specinfra/configuration.rb