[rspec-users] Cucumber: GivenScenario doesn't seem to work

Matt Wynne matt at mattwynne.net
Mon Sep 1 13:12:59 EDT 2008


I'm hardly a story-runner expert, so I may be making a dumb mistake  
here... I'm trying to get one scenario to run another as part of its  
Given clause. It looks like this:

	Scenario: Admin user merges two venues
		GivenScenario Admin user views two venues
		When I go to "/admin/venues"
		Then I should see "Venue1"

Obviously the When / Then bits will get more complicated once I get  
this working.

In another .feature file, I have the following scenario (which passes)

	Scenario: Admin user views two venues
		Given the default city exists
		...

The scenario "Admin user merges two venues" fails with this ugly  
backtrace:

/Users/matt/Documents/projects/songkick/skweb/vendor/plugins/cucumber/ 
lib/cucumber/tree/scenario.rb:45:in `given_scenario_steps': You have  
a nil object when you didn't expect it! (NoMethodError)
The error occurred while evaluating nil.steps   from /Users/matt/ 
Documents/projects/songkick/skweb/vendor/plugins/cucumber/lib/ 
cucumber/tree/given_scenario.rb:9:in `steps'
         from /Users/matt/Documents/projects/songkick/skweb/vendor/ 
plugins/cucumber/lib/cucumber/tree/scenario.rb:41:in `steps'
         from /Users/matt/Documents/projects/songkick/skweb/vendor/ 
plugins/cucumber/lib/cucumber/tree/scenario.rb:41:in `map'
         from /Users/matt/Documents/projects/songkick/skweb/vendor/ 
plugins/cucumber/lib/cucumber/tree/scenario.rb:41:in `steps'
         from /Users/matt/Documents/projects/songkick/skweb/vendor/ 
plugins/cucumber/lib/cucumber/tree/scenario.rb:9:in `accept'
         from /Users/matt/Documents/projects/songkick/skweb/vendor/ 
plugins/cucumber/lib/cucumber/executor.rb:62:in `visit_scenario'
         from /Users/matt/Documents/projects/songkick/skweb/vendor/ 
plugins/cucumber/lib/cucumber/executor.rb:53:in `visit_regular_scenario'
         from /Users/matt/Documents/projects/songkick/skweb/vendor/ 
plugins/cucumber/lib/cucumber/tree/feature.rb:47:in `accept'
          ... 6 levels...
         from /Users/matt/Documents/projects/songkick/skweb/vendor/ 
plugins/cucumber/lib/cucumber/executor.rb:36:in `visit_features'
         from /Users/matt/Documents/projects/songkick/skweb/vendor/ 
plugins/cucumber/lib/cucumber/cli.rb:84:in `execute!'
         from /Users/matt/Documents/projects/songkick/skweb/vendor/ 
plugins/cucumber/lib/cucumber/cli.rb:11:in `execute'
         from /Users/matt/Documents/projects/songkick/skweb/vendor/ 
plugins/cucumber/bin/cucumber:3
rake aborted!
Command failed with status (1): [/usr/local/bin/ruby -I "/Users/matt/ 
Docume...]


What am I doing wrong?


cheers,
Matt
----
http://blog.mattwynne.net
http://songkick.com

In case you wondered: The opinions expressed in this email are my own  
and do not necessarily reflect the views of any former, current or  
future employers of mine.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20080901/882d9df9/attachment-0001.html>


More information about the rspec-users mailing list