Created
October 16, 2008 03:36
-
-
Save bkaney/17072 to your computer and use it in GitHub Desktop.
Sample routing specs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe UsersController, " (routing)" do | |
describe "generation" do | |
it "should route users's 'index' action correctly" do | |
route_for(:controller => 'admin/users', :action => 'index').should == "/admin/users" | |
end | |
# Other route_for's... | |
end | |
describe "recognition" do | |
it "should generate params for users's index action from GET admin/users" do | |
params_from(:get, '/admin/users').should == {:controller => 'admin/users', :action => 'index'} | |
params_from(:get, '/admin/users.xml').should == {:controller => 'admin/users', :action => 'index', :format => 'xml'} | |
params_from(:get, '/admin/users.json').should == {:controller => 'admin/users', :action => 'index', :format => 'json'} | |
end | |
# other params_from... | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment