Confusing error with GivenScenario
Reported by Glenn Ford | March 31st, 2008 @ 05:18 PM | in No-Milestone-Assigned
When you misspell a Step, the step gets marked PENDING and the rest as FAILED. When you misspell a Scenario with GivenScenario, you get:
Users/Malohkan/Sites/blog/vendor/plugins/rspec_on_rails/lib/spec/rails/../../../../rspec/lib/spec/story/runner/scenario_runner.rb:11:in `run': You have a nil object when you didn't expect it! (NoMethodError)
The error occurred while evaluating nil.story from /Users/Malohkan/Sites/blog/vendor/plugins/rspec_on_rails/lib/spec/rails/story_adapter.rb:69:in `perform'
from /Users/Malohkan/Sites/blog/vendor/plugins/rspec_on_rails/lib/spec/rails/../../../../rspec/lib/spec/story/world.rb:52:in `run_given_scenario_with_suspended_listeners'
from /Users/Malohkan/Sites/blog/vendor/plugins/rspec_on_rails/lib/spec/rails/../../../../rspec/lib/spec/story/world.rb:101:in `GivenScenario'
from /Users/Malohkan/Sites/blog/vendor/plugins/rspec_on_rails/lib/spec/rails/../../../../rspec/lib/spec/story/runner/story_mediator.rb:115:in `send'
from /Users/Malohkan/Sites/blog/vendor/plugins/rspec_on_rails/lib/spec/rails/../../../../rspec/lib/spec/story/runner/story_mediator.rb:115:in `to_proc'
from /Users/Malohkan/Sites/blog/vendor/plugins/rspec_on_rails/lib/spec/rails/../../../../rspec/lib/spec/story/runner/story_mediator.rb:95:in `instance_eval'
from /Users/Malohkan/Sites/blog/vendor/plugins/rspec_on_rails/lib/spec/rails/../../../../rspec/lib/spec/story/runner/story_mediator.rb:95:in `to_proc'
from /Users/Malohkan/Sites/blog/vendor/plugins/rspec_on_rails/lib/spec/rails/../../../../rspec/lib/spec/story/runner/story_mediator.rb:95:in `each'
... 6 levels...
from /Users/Malohkan/Sites/blog/vendor/plugins/rspec_on_rails/lib/spec/rails/../../../../rspec/lib/spec/story/runner/story_runner.rb:39:in `each'
from /Users/Malohkan/Sites/blog/vendor/plugins/rspec_on_rails/lib/spec/rails/../../../../rspec/lib/spec/story/runner/story_runner.rb:39:in `run_stories'
from /Users/Malohkan/Sites/blog/vendor/plugins/rspec_on_rails/lib/spec/rails/../../../../rspec/lib/spec/story/runner.rb:44:in `register_exit_hook'
I think that the exception should be caught on line 52 of "world.rb". The one with "scenario.perform(world, name)" on it. Below in the following method I see where "step.perform(world, *args)" gets called and is wrapped with begin/rescue.
If catching the exception isn't the right way to go, then check line 66 of "story_adapter.rb" which has "StoryRunner.scenario_from_current_story". This call does a .find() and returns nil. That's the first place it's made known that this Scenario doesn't exist.
Comments and changes to this ticket
-
Aslak Hellesøy April 7th, 2008 @ 04:17 PM
- → State changed from new to open
I just saw this, It seems to happen when you use GivenScenario and the referred scenario doesn't exist (or is misspelled).
Please Login or create a free account to add a new comment.
You can update this ticket by sending an email to from your email client. (help)
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
Behaviour Driven Development for Ruby.
