Module: SpecInfra::Configuration

Defined in:
lib/specinfra/configuration.rb

Constant Summary collapse

VALID_OPTIONS_KEYS =
[:path, :pre_command, :stdout, :stderr, :sudo_path, :sudo_disable, :pass_prompt].freeze

Class Method Summary collapse

Class Method Details

.defaultsObject



6
7
8
# File 'lib/specinfra/configuration.rb', line 6

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

.method_missing(meth, val = nil) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/specinfra/configuration.rb', line 10

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