[rspec-users] undefined method `route_for

Andrew Premdas apremdas at gmail.com
Mon Dec 14 05:01:14 EST 2009


2009/12/14 Amit Kulkarni <lists at ruby-forum.com>

> Thanks David.
> Also i am little bit confused regarding routes.
>
> Consider a routing example
>
> it "should map { :controller => 'channels', :action => 'new' } to
> /channels/new" do
>  route_for(:controller => "channels", :action => "new").should ==
> "/channels/new"
> end
>
> Now i can see all the routing methods by rake routes.In that i can see
> this new action defined.
>
> Now imagine if i write an action which is not defined in the rake routes
> then instead of failing it is passing.For e.g.
>
> it "should map { :controller => 'channels', :action => 'test' } to
> /channels/test" do
>  route_for(:controller => "channels", :action => "test").should ==
> "/channels/test"
> end
>
> Now here 'test' action is not defined in the routes.So it should fail
> but it isn't.
> May be i am missing something here.
> --
>


Are you sure you have the default last two lines commented out in routes.rb.
If you haven't they will match that action - I think.

All best

Andrew



> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20091214/7b90f2be/attachment.html>


More information about the rspec-users mailing list