[rspec-devel] [ rspec-Bugs-15659 ] GivenScenario fails when it is a RailsStory

noreply at rubyforge.org noreply at rubyforge.org
Thu Nov 15 18:06:42 EST 2007


Bugs item #15659, was opened at 2007-11-15 16:50
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3149&aid=15659&group_id=797

Category: rails plugin
Group: None
Status: Open
Resolution: None
Priority: 3
Submitted By: Nathan Sutton (fowlduck)
Assigned to: Nobody (None)
Summary: GivenScenario fails when it is a RailsStory

Initial Comment:
Given the following code:
require File.dirname(__FILE__) + "/helper"

Story "Checkin out the lil buggles", %Q{
  As a user of rspec
  I want to check out the lil buggles
  So that I can run rails stories
}, :type => RailsStory do
  Scenario "We have one scenario" do
    Given "a scenario"
    When "it is run"
    Then "it should be ok"
  end
    
  Scenario "We have a second scenario" do
    GivenScenario "We have one scenario"
    When "it is run again"
    Then "it should bork"
  end
end



And it is run:

$ ruby stories/test.story 
Running 2 scenarios:

Story: Checkin out the lil buggles

  
    As a user of rspec
    I want to check out the lil buggles
    So that I can run rails stories


Scenario: We have one scenario

  Given a scenario (PENDING)

  When it is run (PENDING)

  Then it should be ok (PENDING)

/Users/nate/Code/sevenwire/rediswhite/repository/trunk/vendor/plugins/rspec/lib/spec/story/world.rb:48:in `perform': wrong number of arguments (2 for 1) (ArgumentError)
	from /Users/nate/Code/sevenwire/rediswhite/repository/trunk/vendor/plugins/rspec/lib/spec/story/world.rb:48:in `run_given_scenario_with_suspended_listeners'
	from /Users/nate/Code/sevenwire/rediswhite/repository/trunk/vendor/plugins/rspec/lib/spec/story/world.rb:87:in `GivenScenario'
	from stories/test.story:15
	from /Users/nate/Code/sevenwire/rediswhite/repository/trunk/vendor/plugins/rspec/lib/spec/story/runner/scenario_runner.rb:14:in `instance_eval'
	from /Users/nate/Code/sevenwire/rediswhite/repository/trunk/vendor/plugins/rspec/lib/spec/story/runner/scenario_runner.rb:14:in `run'
	from /Users/nate/Code/sevenwire/rediswhite/repository/trunk/vendor/plugins/rspec/lib/spec/story/runner/story_runner.rb:48:in `run_stories'
	from /Users/nate/Code/sevenwire/rediswhite/repository/trunk/vendor/plugins/rspec/lib/spec/story/runner/story_runner.rb:44:in `each'
	from /Users/nate/Code/sevenwire/rediswhite/repository/trunk/vendor/plugins/rspec/lib/spec/story/runner/story_runner.rb:44:in `run_stories'
	from /Users/nate/Code/sevenwire/rediswhite/repository/trunk/vendor/plugins/rspec/lib/spec/story/runner/story_runner.rb:39:in `each'
	from /Users/nate/Code/sevenwire/rediswhite/repository/trunk/vendor/plugins/rspec/lib/spec/story/runner/story_runner.rb:39:in `run_stories'
	from /Users/nate/Code/sevenwire/rediswhite/repository/trunk/vendor/plugins/rspec/lib/spec/story/runner.rb:49:in `register_exit_hook'
	from stories/test.story:3
Scenario: We have a second scenario





It is an issue with Spec::Story::GivenScenario#perform in rspec_on_rails/lib/spec/rails/story_adapter.rb on line 42.  It expects it to take a second argument like GivenScenario does elsewhere.  

I have attached a patch, I think I did it right.

----------------------------------------------------------------------

>Comment By: Nathan Sutton (fowlduck)
Date: 2007-11-15 17:06

Message:
Oh, and with that change I get this output:

$ ruby stories/test.story 
Running 2 scenarios:

Story: Checkin out the lil buggles

  
    As a user of rspec
    I want to check out the lil buggles
    So that I can run rails stories


Scenario: We have one scenario

  Given a scenario (PENDING)

  When it is run (PENDING)

  Then it should be ok (PENDING)

Scenario: We have a second scenario

  When it is run again (PENDING)

  Then it should bork (PENDING)



2 scenarios: 0 succeeded, 0 failed, 2 pending

Pending Steps:
1) Checkin out the lil buggles (We have one scenario): Unimplemented step: a 
scenario
2) Checkin out the lil buggles (We have one scenario): Unimplemented step: it 
is run
3) Checkin out the lil buggles (We have one scenario): Unimplemented step: it 
should be ok
4) Checkin out the lil buggles (We have a second scenario): Unimplemented 
step: a scenario
5) Checkin out the lil buggles (We have a second scenario): Unimplemented 
step: it is run
6) Checkin out the lil buggles (We have a second scenario): Unimplemented 
step: it should be ok
7) Checkin out the lil buggles (We have a second scenario): Unimplemented 
step: it is run again
8) Checkin out the lil buggles (We have a second scenario): Unimplemented 
step: it should bork



----------------------------------------------------------------------

Comment By: Nathan Sutton (fowlduck)
Date: 2007-11-15 16:51

Message:
forgot to note:
rspec edge revision 2894
rspec_on_rails edge revision 2894
rails edge revision 8146


----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3149&aid=15659&group_id=797


More information about the rspec-devel mailing list