]> git.openstreetmap.org Git - rails.git/blob - vendor/gems/rspec-1.1.2/spec/spec/story/given_scenario_spec.rb
added RSpec and RSpec on Rails
[rails.git] / vendor / gems / rspec-1.1.2 / spec / spec / story / given_scenario_spec.rb
1 require File.dirname(__FILE__) + '/story_helper'
2
3 module Spec
4   module Story
5     describe GivenScenario do
6       it 'should execute a scenario from the current story in its world' do
7         # given
8         class MyWorld
9           attr :scenario_ran
10         end
11         instance = World.create(MyWorld)
12         scenario = ScenarioBuilder.new.to_scenario do
13           @scenario_ran = true
14         end
15         Runner::StoryRunner.should_receive(:scenario_from_current_story).with('scenario name').and_return(scenario)
16         
17         step = GivenScenario.new 'scenario name'
18         
19         # when
20         step.perform(instance, nil)
21         
22         # then
23         instance.scenario_ran.should be_true
24       end
25     end
26   end
27 end