Skip to content

Instantly share code, notes, and snippets.

@patricksrobertson
Created February 14, 2011 21:04
Show Gist options
  • Save patricksrobertson/826538 to your computer and use it in GitHub Desktop.
Save patricksrobertson/826538 to your computer and use it in GitHub Desktop.
Two options for named routing with dynamic paths.
##
# 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