diaspora/features/support/paths.rb
2010-11-04 22:02:27 -07:00

20 lines
481 B
Ruby

module NavigationHelpers
def path_to(page_name)
case page_name
when /^the home page$/
root_path
when /^its ([\w ]+) page$/
send("#{$1.gsub(/\W+/, '_')}_path", @it)
when /^the ([\w ]+) page$/
send("#{$1.gsub(/\W+/, '_')}_path")
when /^my edit profile page$/
edit_person_path(@me.person)
when /^"(\/.*)"/
$1
else
raise "Can't find mapping from \"#{page_name}\" to a path."
end
end
end
World(NavigationHelpers)