Class: Cucumberator::Commands::Undo
- Inherits:
-
Object
- Object
- Cucumberator::Commands::Undo
- Defined in:
- lib/cucumberator/commands/undo.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(scenario, step_line, saved_stack) ⇒ Undo
constructor
A new instance of Undo.
Constructor Details
#initialize(scenario, step_line, saved_stack) ⇒ Undo
Returns a new instance of Undo.
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/cucumberator/commands/undo.rb', line 15 def initialize(scenario, step_line, saved_stack) @feature_file = Cucumberator::FeatureFile.new(scenario) lines = @feature_file.lines remove_line, remove_string = saved_stack.pop lines.delete_at(remove_line - 1) @feature_file.overwrite(lines.join) step_line.decrement! puts "Removed `#{remove_string.to_s.strip}` from #{@feature_file}" end |
Class Method Details
.perform(scenario, step_line, last_input, saved_stack, *args, &block) ⇒ Object
4 5 6 7 8 9 10 11 12 |
# File 'lib/cucumberator/commands/undo.rb', line 4 def perform(scenario, step_line, last_input, saved_stack, *args, &block) if saved_stack.empty? puts "There's nothing to revert yet" return false end new(scenario, step_line, saved_stack) false end |