[rspec-users] RESTful Routes

Raimond Garcia voodoorai2000 at gmail.com
Mon Feb 4 11:49:39 EST 2008


On Feb 4, 2008 6:54 AM, Raimond Garcia <voodoorai2000 at gmail.com> wrote:
> Hi,
>
> I'm trying to test the behavior of a route with a delete method.
>
> Something like this:
> When "the admin clicks on 'delete'" do
>     delete admin_blog_path(@blog)
>   end
>
> which raises the following exception:
> NoMethodError: You have a nil object when you didn't expect it!
> The error occurred while evaluating nil.env

Can you show the rest of the backtrace?

Sure, I'm using rspec 1.1.2, the backtrace is nice and clean, to get  
the following, I commented out all the IGNORE_PATTERS, there is  
probably a better way of doing it, but it worked.

     NoMethodError: You have a nil object when you didn't expect it!
The error occurred while evaluating nil.env
     /Users/raimondgarcia/Documents/workspace/breport.git/config/../ 
vendor/rails/actionpack/lib/action_controller/test_process.rb:352:in  
`delete'
./stories/steps/blog_steps.rb:10:in `the admin clicks on 'delete''
/Users/raimondgarcia/Documents/workspace/breport.git/config/../vendor/ 
plugins/rspec_on_rails/lib/spec/rails/../../../../rspec/lib/spec/story/ 
step.rb:16:in `__send__'
/Users/raimondgarcia/Documents/workspace/breport.git/config/../vendor/ 
plugins/rspec_on_rails/lib/spec/rails/../../../../rspec/lib/spec/story/ 
step.rb:16:in `perform'
/Users/raimondgarcia/Documents/workspace/breport.git/config/../vendor/ 
plugins/rspec_on_rails/lib/spec/rails/../../../../rspec/lib/spec/story/ 
world.rb:73:in `store_and_call'
/Users/raimondgarcia/Documents/workspace/breport.git/config/../vendor/ 
plugins/rspec_on_rails/lib/spec/rails/../../../../rspec/lib/spec/story/ 
world.rb:110:in `When'
/Users/raimondgarcia/Documents/workspace/breport.git/config/../vendor/ 
plugins/rspec_on_rails/lib/spec/rails/../../../../rspec/lib/spec/story/ 
runner/story_mediator.rb:115:in `send'
/Users/raimondgarcia/Documents/workspace/breport.git/config/../vendor/ 
plugins/rspec_on_rails/lib/spec/rails/../../../../rspec/lib/spec/story/ 
runner/story_mediator.rb:115:in `to_proc'
/Users/raimondgarcia/Documents/workspace/breport.git/config/../vendor/ 
plugins/rspec_on_rails/lib/spec/rails/../../../../rspec/lib/spec/story/ 
runner/story_mediator.rb:95:in `instance_eval'
/Users/raimondgarcia/Documents/workspace/breport.git/config/../vendor/ 
plugins/rspec_on_rails/lib/spec/rails/../../../../rspec/lib/spec/story/ 
runner/story_mediator.rb:95:in `to_proc'
/Users/raimondgarcia/Documents/workspace/breport.git/config/../vendor/ 
plugins/rspec_on_rails/lib/spec/rails/../../../../rspec/lib/spec/story/ 
runner/story_mediator.rb:95:in `each'
/Users/raimondgarcia/Documents/workspace/breport.git/config/../vendor/ 
plugins/rspec_on_rails/lib/spec/rails/../../../../rspec/lib/spec/story/ 
runner/story_mediator.rb:95:in `to_proc'
/Users/raimondgarcia/Documents/workspace/breport.git/config/../vendor/ 
plugins/rspec_on_rails/lib/spec/rails/../../../../rspec/lib/spec/story/ 
runner/scenario_runner.rb:14:in `instance_eval'
/Users/raimondgarcia/Documents/workspace/breport.git/config/../vendor/ 
plugins/rspec_on_rails/lib/spec/rails/../../../../rspec/lib/spec/story/ 
runner/scenario_runner.rb:14:in `run'
/Users/raimondgarcia/Documents/workspace/breport.git/config/../vendor/ 
plugins/rspec_on_rails/lib/spec/rails/../../../../rspec/lib/spec/story/ 
runner/story_runner.rb:48:in `run_stories'
/Users/raimondgarcia/Documents/workspace/breport.git/config/../vendor/ 
plugins/rspec_on_rails/lib/spec/rails/../../../../rspec/lib/spec/story/ 
runner/story_runner.rb:44:in `each'
/Users/raimondgarcia/Documents/workspace/breport.git/config/../vendor/ 
plugins/rspec_on_rails/lib/spec/rails/../../../../rspec/lib/spec/story/ 
runner/story_runner.rb:44:in `run_stories'
/Users/raimondgarcia/Documents/workspace/breport.git/config/../vendor/ 
plugins/rspec_on_rails/lib/spec/rails/../../../../rspec/lib/spec/story/ 
runner/story_runner.rb:39:in `each'
/Users/raimondgarcia/Documents/workspace/breport.git/config/../vendor/ 
plugins/rspec_on_rails/lib/spec/rails/../../../../rspec/lib/spec/story/ 
runner/story_runner.rb:39:in `run_stories'
/Users/raimondgarcia/Documents/workspace/breport.git/config/../vendor/ 
plugins/rspec_on_rails/lib/spec/rails/../../../../rspec/lib/spec/story/ 
runner.rb:46:in `register_exit_hook'
stories/user_blogs.rb:4

Thanks,


Raimond Garcia
>
>
> If I change the delete, for a get or a post it works like a charm.
>
> What am I missing here?
>
> Thanks in advance!
>
>
> Raimond Garcia
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rspec-users/attachments/20080204/52717d1d/attachment.html 


More information about the rspec-users mailing list