Sha256: e9e616a4ec3391536ac95de541160a3edd985d7b350b43f9b215cb83e08b992d

Contents?: true

Size: 739 Bytes

Versions: 5

Compression:

Stored size: 739 Bytes

Contents

module SpecInfra
  module Configuration
    class << self
      VALID_OPTIONS_KEYS = [:path, :pre_command, :stdout, :stderr, :sudo_path, :sudo_disable, :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

5 entries across 5 versions & 1 rubygems

Version Path
specinfra-0.0.16 lib/specinfra/configuration.rb
specinfra-0.0.15 lib/specinfra/configuration.rb
specinfra-0.0.14 lib/specinfra/configuration.rb
specinfra-0.0.13 lib/specinfra/configuration.rb
specinfra-0.0.12 lib/specinfra/configuration.rb