Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

page.should have_content - Special Characters causing error

I am working on a basic Rspec test using Capybara that opens a webpage and checks that a string is contained within the home page. The tests require checking eaching of 8 different language sub domains on the sites and I have run into some problems with the special characters in the code.

The following code works:

it "should have an American Home page", :js => true do
  visit '/'
  page.should have_content('Workforce Management from InVision')
end

it "should have an English Home page", :js => true do
  visit '/uk/'
  page.should have_content('Workforce Management from InVision')
end

The following code DOES NOT WORK

it "should have a Spanish Home page at '/es/callcenter'", :js => true do
  visit '/es/'
  page.should have_content('Gestión de la plantilla con InVision')
end

I think that this is in relation to the ó in the word "Gestión". Any ideas how to stop this problem from occurring?

like image 975
John Paul Mc Feely Avatar asked Jan 26 '26 16:01

John Paul Mc Feely


1 Answers

Try adding # encoding: UTF-8 on the first line of the spec file.

like image 93
ezkl Avatar answered Jan 29 '26 12:01

ezkl



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!