I'm new to Ruby. I'm trying to figure out how to write a nested case statement. Here is an example of what I am trying to do:
# cucumber, webrat paths.rb
def path_to(page_name)
case page_name
when /the "?(.*)"? event registration homepage/ then
case $1
when '2011 CIO GL Global' then '/event/index/id/236'
when '2011 CIO IS Chicago' then '/event/index/id/275'
when '2011 CIO ES Denver' then '/event/index/id/217'
when '2011 CIO ES Vancouver, BC' then '/event/index/id/234'
else
raise "Can't find mapping for \"#{$1}\" to a path.\n" +
"Now, go and add a mapping in #{__FILE__}"
end
when /the contact match verification page/
'/attendee/user-verification'
end
end
In my feature file it says:
When I go to the "2011 CIO IS Chicago" event registration homepage
It's failing on this step because its raising the exception mentioned above, even though I have it defined in my case statement above. What am I doing wrong?