Class: Fixturama::Changes::Env
- Defined in:
- lib/fixturama/changes/env.rb
Overview
Stub an environment variable
Instance Attribute Summary
Attributes inherited from Base
#key The key identifier of the change
Instance Method Summary collapse
- #call(example) ⇒ Object
-
#key ⇒ Object
All changes has the same
keyThey will be merged before stubbing (seecall). -
#merge(other) ⇒ Object
When we merge 2 env-s, we just merge their options.
Instance Method Details
#call(example) ⇒ Object
19 20 21 22 23 |
# File 'lib/fixturama/changes/env.rb', line 19 def call(example) original = Hash ENV example.send(:stub_const, "ENV", original.merge()) self end |
#key ⇒ Object
All changes has the same key They will be merged before stubbing (see call)
9 10 11 |
# File 'lib/fixturama/changes/env.rb', line 9 def key "ENV" end |
#merge(other) ⇒ Object
When we merge 2 env-s, we just merge their options
14 15 16 17 |
# File 'lib/fixturama/changes/env.rb', line 14 def merge(other) return self unless other.is_a?(self.class) dup.tap { |env| env..update(other.) } end |