Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
describe "route" do
# explicit listing
specify "days#index" do
route get('/days').should generate 'days#index' # wraps assert_generates
route 'days#index'.should recognize get('/days') # wraps assert_recognizes
end
# combined listing
specify "days#index" do
route get('/days').should be 'days#index' # This is generate and recognize (wraps assert_routing)
end
# Routing nested resources (AKA routes that recognize, but do not generate)
specify "days#index" do
route 'days#index'.should recognize get('/students/1/days') with :student_id => '1'
# or longhand (this is uglier)
route {:controller => 'days', :action => 'index', :student_id => '1'}.should recognize ('/students/1/days')
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment