Permalink
Browse files

Wrap all primitive and strings

  • Loading branch information...
oriolgual committed Feb 12, 2012
1 parent 37084af commit 9ebbe9720e13403aa294207a84fc5a322b179674
Showing with 25 additions and 3 deletions.
  1. +25 −3 lib/spinach/runner/scenario_runner.rb
@@ -44,16 +44,20 @@ def step_definitions
# @api public
def run
Spinach.hooks.run_before_scenario @scenario
scenario_run = false
scenario_mutex.deactivate
Spinach.hooks.run_around_scenario @scenario do
scenario_run = true
scenario_mutex.activate
run_scenario_steps
end
raise "around_scenario hooks *must* yield" if !scenario_run && !@exception
raise "around_scenario hooks *must* yield" if !scenario_mutex.active? && !@exception
Spinach.hooks.run_after_scenario @scenario
!@exception
end
def scenario_mutex
@scenario_mutex ||= ScenarioMutex.new
end
def run_scenario_steps
steps.each do |step|
run_step_with_hooks(step)
@@ -94,6 +98,24 @@ def run_step(step)
@exception = e
Spinach.hooks.run_on_error_step step, @exception, step_location
end
class ScenarioMutex
def initialize
@running = false
end
def deactivate
@running = false
end
def activate
@running = true
end
def active?
!!@running
end
end
end
end
end

0 comments on commit 9ebbe97

Please sign in to comment.