Bike!Bike! Website!
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
935 B

10 years ago
module NavigationHelpers
8 years ago
def path_to(path)
path = path.to_sym
args = []
8 years ago
case path
when /^landing$/i
path = :home
when /^(my )?workshop$/i
path = :view_workshop
args << TestState.last_conference.slug
args << TestState.last_workshop.id
when /^registration$/i
path = :register
args << TestState.last_conference.slug
when /^(conference|register|workshops)$/i
args << TestState.last_conference.slug
when /^confirm(ation)?$/
path = :confirm
args << TestState.last_token
when /^google maps$/
path = /^https:\/\/www\.google\.com\/maps\/place\/.*/
end
10 years ago
8 years ago
if path.is_a?(Symbol)
path = Rails.application.routes.url_helpers.send("#{path}_path".to_sym, *args)
end
8 years ago
raise "Can't find mapping from \"#{path}\" to a path." unless path.present?
8 years ago
return path
end
10 years ago
end
World(NavigationHelpers)