Commit b0f293d7d026292fd35d46e1ff2b16d9f9399a50
Committed by
Daniela Feitosa
1 parent
2785cb8f
Exists in
master
and in
29 other branches
small changes in cucumber paths file
Showing
1 changed file
with
15 additions
and
9 deletions
Show diff stats
features/support/paths.rb
@@ -3,7 +3,7 @@ module NavigationHelpers | @@ -3,7 +3,7 @@ module NavigationHelpers | ||
3 | # | 3 | # |
4 | # When /^I go to (.+)$/ do |page_name| | 4 | # When /^I go to (.+)$/ do |page_name| |
5 | # | 5 | # |
6 | - # step definition in webrat_steps.rb | 6 | + # step definition in web_steps.rb |
7 | # | 7 | # |
8 | def path_to(page_name) | 8 | def path_to(page_name) |
9 | case page_name | 9 | case page_name |
@@ -11,6 +11,12 @@ module NavigationHelpers | @@ -11,6 +11,12 @@ module NavigationHelpers | ||
11 | when /the homepage/ | 11 | when /the homepage/ |
12 | '/' | 12 | '/' |
13 | 13 | ||
14 | + # Add more mappings here. | ||
15 | + # Here is an example that pulls values out of the Regexp: | ||
16 | + # | ||
17 | + # when /^(.*)'s profile page$/i | ||
18 | + # user_profile_path(User.find_by_login($1)) | ||
19 | + | ||
14 | when /^\// | 20 | when /^\// |
15 | page_name | 21 | page_name |
16 | 22 | ||
@@ -111,15 +117,15 @@ module NavigationHelpers | @@ -111,15 +117,15 @@ module NavigationHelpers | ||
111 | when /^(.+)'s members page/ | 117 | when /^(.+)'s members page/ |
112 | '/profile/%s/members' % Profile.find_by_name($1).identifier | 118 | '/profile/%s/members' % Profile.find_by_name($1).identifier |
113 | 119 | ||
114 | - # Add more mappings here. | ||
115 | - # Here is a more fancy example: | ||
116 | - # | ||
117 | - # when /^(.*)'s profile page$/i | ||
118 | - # user_profile_path(User.find_by_login($1)) | ||
119 | - | ||
120 | else | 120 | else |
121 | - raise "Can't find mapping from \"#{page_name}\" to a path.\n" + | ||
122 | - "Now, go and add a mapping in #{__FILE__}" | 121 | + begin |
122 | + page_name =~ /the (.*) page/ | ||
123 | + path_components = $1.split(/\s+/) | ||
124 | + self.send(path_components.push('path').join('_').to_sym) | ||
125 | + rescue Object => e | ||
126 | + raise "Can't find mapping from \"#{page_name}\" to a path.\n" + | ||
127 | + "Now, go and add a mapping in #{__FILE__}" | ||
128 | + end | ||
123 | end | 129 | end |
124 | end | 130 | end |
125 | end | 131 | end |