Class: Minitest::Substitute::Substitutor
- Inherits:
-
Object
- Object
- Minitest::Substitute::Substitutor
- Defined in:
- lib/minitest/substitute/substitutor.rb
Instance Attribute Summary collapse
-
#on ⇒ Object
writeonly
Sets the attribute on.
Instance Method Summary collapse
- #commit ⇒ Object
-
#initialize(target, on:) ⇒ Substitutor
constructor
A new instance of Substitutor.
- #rollback ⇒ Object
- #substitute(value) ⇒ Object
Constructor Details
#initialize(target, on:) ⇒ Substitutor
Returns a new instance of Substitutor.
9 10 11 |
# File 'lib/minitest/substitute/substitutor.rb', line 9 def initialize(target, on:) @target, @on = target, on end |
Instance Attribute Details
#on=(value) ⇒ Object (writeonly)
Sets the attribute on
7 8 9 |
# File 'lib/minitest/substitute/substitutor.rb', line 7 def on=(value) @on = value end |
Instance Method Details
#commit ⇒ Object
18 19 20 21 |
# File 'lib/minitest/substitute/substitutor.rb', line 18 def commit @original = get set @substitute end |
#rollback ⇒ Object
23 24 25 |
# File 'lib/minitest/substitute/substitutor.rb', line 23 def rollback set @original end |
#substitute(value) ⇒ Object
13 14 15 16 |
# File 'lib/minitest/substitute/substitutor.rb', line 13 def substitute(value) @substitute = value unless instance_variable_defined? :@substitute self end |