Skip to content

Commit

Permalink
Don't use 'else' keyword
Browse files Browse the repository at this point in the history
  • Loading branch information
oriolgual committed Feb 12, 2012
1 parent f2f1716 commit 37084af
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions lib/spinach/runner/scenario_runner.rb
Expand Up @@ -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.
Expand Down

0 comments on commit 37084af

Please sign in to comment.