Permalink
Browse files

Use only one level of indentation per method

  • Loading branch information...
oriolgual committed Feb 12, 2012
1 parent 6bd8a65 commit f2f1716679b5a301585e0bf7c834f62e75c3cc5f
Showing with 17 additions and 12 deletions.
  1. +17 −12 lib/spinach/runner/scenario_runner.rb
@@ -47,23 +47,29 @@ def run
scenario_run = false
Spinach.hooks.run_around_scenario @scenario do
scenario_run = true
- steps.each do |step|
- Spinach.hooks.run_before_step step
-
- if @exception
- Spinach.hooks.run_on_skipped_step step
- else
- run_step(step)
- end
-
- Spinach.hooks.run_after_step step
- end
+ run_scenario_steps
end
raise "around_scenario hooks *must* yield" if !scenario_run && !@exception
Spinach.hooks.run_after_scenario @scenario
!@exception
end
+ def run_scenario_steps
+ steps.each do |step|
+ Spinach.hooks.run_before_step step
+ skip_or_run_step(step)
+ Spinach.hooks.run_after_step step
+ end
+ end
+
+ def skip_or_run_step(step)
+ if @exception
+ Spinach.hooks.run_on_skipped_step step
+ else
+ run_step(step)
+ end
+ end
+
# Runs a particular step.
#
# @param [Gherkin::AST::Step] step
@@ -84,7 +90,6 @@ def run_step(step)
@exception = e
Spinach.hooks.run_on_error_step step, @exception, step_location
end
-
end
end
end

0 comments on commit f2f1716

Please sign in to comment.