[rspec-users] spec'ing namespaced routes

53 views
Skip to first unread message

Frank Mattia

unread,
Jul 4, 2010, 8:15:03 PM7/4/10
to rspec...@rubyforge.org
What's the appropriate way to test namespaced routes with rspec-2 &
rails 3?

I imagined that the following would work but it does not.

describe Admin::UsersController do
describe "routing" do
it "recognizes and generates #index" do
{ :get => "/admin/users" }.should route_to(:controller =>
"admin_users", :action => "index")
end
end
end

In fact,

{ :get => "/admin/users" }.should be_routable

fails as well. Yet rake routes disagrees.

Any suggestions?
--
Posted via http://www.ruby-forum.com/.
_______________________________________________
rspec-users mailing list
rspec...@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

David Chelimsky

unread,
Jul 5, 2010, 8:02:50 AM7/5/10
to rspec...@rubyforge.org
On Jul 4, 2010, at 7:15 PM, Frank Mattia wrote:

> What's the appropriate way to test namespaced routes with rspec-2 &
> rails 3?
>
> I imagined that the following would work but it does not.
>
> describe Admin::UsersController do
> describe "routing" do
> it "recognizes and generates #index" do
> { :get => "/admin/users" }.should route_to(:controller =>
> "admin_users", :action => "index")
> end
> end
> end
>
> In fact,
>
> { :get => "/admin/users" }.should be_routable
>
> fails as well. Yet rake routes disagrees.
>
> Any suggestions?

This is a deficiency in the API recognized and discussed in http://groups.google.com/group/rspec/browse_thread/thread/50b46ca3e4bd3a78 (which came after your post). Please feel free to follow and/or contribute to that conversation.

Cheers,
David

Reply all
Reply to author
Forward
0 new messages