2010-09-14 20 views
1

je dois tester avec concombre/Webrat la présence de ce bouton:Webrat + nokogiri + sélecteurs css + espaces blancs = Cauchemar

<%=submit_tag 'Get it'%> 

Mais quand j'utilise cette étape personnalisée:

And I should see a button with a value of "Get it" 

que est:

Then /^I should see a button with a value of "([^\"]*)"$/ do |value| 
response.should have_selector("form input[value=#{value}]") 
end 

Je reçois:

 
    And I should see a button with a value of "Get it"      # features/step_definitions/common_steps.rb:181 
     unexpected ' ' after 'includesGet' (Nokogiri::CSS::SyntaxError) 
     /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/racc/parser.rb:99:in `_racc_do_parse_c' 
     /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/racc/parser.rb:99:in `__send__' 
     /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/racc/parser.rb:99:in `do_parse' 
     ./features/step_definitions/common_steps.rb:182:in `/^I should see a button with a value of "([^\"]*)"$/' 

Lorsque je teste un bouton avec une valeur ONE MOT il fonctionne, donc c'est l'espace entre "Get" et "it".

Des idées?

Merci

Répondre

0

Cela semble être un problème spécifique avec Nokogiri, pour moi:

page.search("input[value='Next Batch']") # => Nokogiri::CSS::SyntaxError 
page.search("//input[@value='Next Batch']") # => Okay