0

I'm trying to translate the steps definitions of cucumber to spanish but I'm getting this error:

Ambiguous match of "que estoy en la página "inicio de sesión""


  features/step_definitions/web_steps.rb:3:in `/^que estoy en la página "([^"]*)"$/'
  features/step_definitions/web_steps.rb:7:in `/^visito la pa|ágina "([^"]*)"$/'

Here's my web_steps.rb

# encoding: utf-8

Dado /^que estoy en la página "([^"]*)"$/ do |page|
  visit(path_to page)
end

Cuando /^visito la página "([^"]*)"$/ do |page|
  visit(path_to page)
end

How can that be ambiguos if I got the ^ and the $ in the regexp?

Bishma Stornelli
  • 2,539
  • 4
  • 22
  • 30

1 Answers1

1

It looks like it's seeing a | in the latter step definition. Look closely at the second line of the error:

features/step_definitions/web_steps.rb:3:in `/^que estoy en la página "([^"]*)"$/'
features/step_definitions/web_steps.rb:7:in `/^visito la pa|ágina "([^"]*)"$/'

It's seeing /^visito la pa|ágina "([^"]*)"$/, which it interprets as an OR, i.e. /^visito la pa OR ágina "([^"]*)"$/. With that interpretation, the match does indeed become ambiguous.

Now why it is reading it that way is a mystery to me, perhaps some UTF-8 garbling?

Chris Salzberg
  • 27,099
  • 4
  • 75
  • 82
  • Actually I removed the | in the step definition when I post it here. The bar is in there. I thought that is was going to accept pagina or página not half of the phrase. Thanks, it's solved now. – Bishma Stornelli Aug 22 '12 at 21:21