Created
July 5, 2010 19:46
-
-
Save trevmex/464636 to your computer and use it in GitHub Desktop.
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 "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