Module: Test::Spec::Rails::Macros::InstanceMethods

Defined in:
lib/test/spec/rails/macros.rb

Instance Method Summary collapse

Instance Method Details

#immediate_values(params) ⇒ Object

Interpret the non-immediate values in params and replace them



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/test/spec/rails/macros.rb', line 51

def immediate_values(params)
  result = {}
  params.each do |key, value|
    result[key] = case value
    when Hash
      immediate_values(value)
    when Test::Spec::Rails::Macros::LazyValue
      eval(value.value).to_param
    when Proc
      value.call
    else
      value
    end
  end
  result
end