Skip to content

Commit

Permalink
Merge branch 'master' of git://github.com/rubysolo/cucumber-rails
Browse files Browse the repository at this point in the history
  • Loading branch information
aslakhellesoy committed May 3, 2010
2 parents ef57dc0 + 00a3bd7 commit f415e2b
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions templates/skeleton/support/paths.rb
Expand Up @@ -7,19 +7,25 @@ module NavigationHelpers
#
def path_to(page_name)
case page_name

when /the home\s?page/
'/'

# Add more mappings here.
# Here is an example that pulls values out of the Regexp:
#
# when /^(.*)'s profile page$/i
# user_profile_path(User.find_by_login($1))

else
raise "Can't find mapping from \"#{page_name}\" to a path.\n" +
"Now, go and add a mapping in #{__FILE__}"
begin
page_name =~ /the (.*) page/
path_components = $1.split(/\s+/)
self.send(path_components.push('path').join('_').to_sym)
rescue Object => e
raise "Can't find mapping from \"#{page_name}\" to a path.\n" +
"Now, go and add a mapping in #{__FILE__}"
end
end
end
end
Expand Down

0 comments on commit f415e2b

Please sign in to comment.