Skip to content

Commit

Permalink
Update generated paths.rb for cucumber features
Browse files Browse the repository at this point in the history
  • Loading branch information
ianwhite committed Jul 9, 2009
1 parent 2e5b38b commit 9e53777
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions features/support/paths.rb
@@ -1,24 +1,22 @@
module NavigationHelpers
# Maps a static name to a static route.
# Maps a name to a path. Used by the
#
# This method is *not* designed to map from a dynamic name to a
# dynamic route like <tt>post_comments_path(post)</tt>. For dynamic
# routes like this you should *not* rely on #path_to, but write
# your own step definitions instead. Example:
# When /^I go to (.+)$/ do |page_name|
#
# Given /I am on the comments page for the "(.+)" post/ |name|
# post = Post.find_by_name(name)
# visit post_comments_path(post)
# end
# step definition in webrat_steps.rb
#
def path_to(page_name)
case page_name

when /the homepage/
root_path

# Add more page name => path mappings here
'/'

# Add more mappings here.
# Here is a more fancy example:
#
# when /^(.*)'s profile page$/i
# user_profile_path(User.find_by_login($1))

# added by script/generate pickle path

when /^#{capture_model}(?:'s)? page$/ # eg. the forum's page
Expand All @@ -40,7 +38,7 @@ def path_to(page_name)

else
raise "Can't find mapping from \"#{page_name}\" to a path.\n" +
"Now, go and add a mapping in features/support/paths.rb"
"Now, go and add a mapping in #{__FILE__}"
end
end
end
Expand Down

0 comments on commit 9e53777

Please sign in to comment.