Permalink
Browse files

Don't use 'else' keyword

  • Loading branch information...
1 parent f2f1716 commit 37084af9f971aaa25f0af5bd2e959f64fc5eb0d3 @oriolgual oriolgual committed Feb 12, 2012
Showing with 10 additions and 6 deletions.
  1. +10 −6 lib/spinach/runner/scenario_runner.rb
View
16 lib/spinach/runner/scenario_runner.rb
@@ -56,18 +56,22 @@ def run
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
+ run_step_with_hooks(step)
end
end
- def skip_or_run_step(step)
+ def run_step_with_hooks(step)
+ Spinach.hooks.run_before_step step
+ run_step(step) unless skip_step?(step)
+ Spinach.hooks.run_after_step step
+ end
+
+ def skip_step?(step)
if @exception
Spinach.hooks.run_on_skipped_step step
- else
- run_step(step)
+ return true
end
+ return false
end
# Runs a particular step.

0 comments on commit 37084af

Please sign in to comment.