Created
February 14, 2011 21:04
-
-
Save patricksrobertson/826538 to your computer and use it in GitHub Desktop.
Two options for named routing with dynamic paths.
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
## | |
# Option #1: Hacking the routes file. | |
## | |
#config/routes.rb | |
match ‘auth/:provider/callback’ => ‘authentications#create’ | |
match ‘auth/twitter/callback’ => ‘authentications#create’, :as => :twitter_callback | |
## | |
# Option #2: Using cucumber web steps | |
## | |
#features/step_definitions/twitter_steps.rb | |
Given /^I am signed in$/ do | |
visit twitter_auth_path | |
# This is important!!!!! You must manually visit this page. | |
Given “I am on the twitter callback page” | |
end | |
#features/support/paths.rb | |
#.. start of file | |
case page_name | |
when /the twitter callback page/ | |
‘/auth/twitter/callback’ | |
#…more code |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment