On Feb 6, 2012, at 6:45 PM, Patrick J. Collins wrote:

> I've got a share method in my controller, and I have the following spec:
> 
>  describe PostsController do
> 
>    describe "#share" do
> 
>      it "doesn't blow up" do
>        post :share, :id => @post.id

Does @post actually have an id? I believe the :id key will not be present if 
the value is nil.

>      end
> 
>    # ... etc
> 
> And... It blows up!
> 
> Failures:
> 
>  1) PostsController#share shares
>     Failure/Error: post :share
>     ActionController::RoutingError:
>       No route matches {:controller=>"posts", :action=>"share"}
>     # ./spec/controllers/posts_controller_spec.rb:7
> 
> My routes has:
> 
>  resources :posts do
>    post :share, :on => :member
>  end
> 
> rake routes shows:
> 
>  share_post POST   /posts/:id/share(.:format) {:action=>"share", 
> :controller=>"posts"}
> 
> ...
> 
> Why is it ignoring the :id parameter in my test and therefore blowing up?
> 
> Thanks.
> 
> Patrick J. Collins
> http://collinatorstudios.com
> _______________________________________________
> rspec-users mailing list
> rspec-users@rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users

_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to