Rails3: How can I use UTF-8 when testing with Capybara
I use Rails 3, Capybara 0.4.0, Akephalos (https://github.com/sorentwo/akephalos) Selenium-webdriver and Rspec 2. I use ruby 1.9
I have the following spec:
scenario "Create a new Group course with complex name" do
school = School.make!
switch_to_subdomain(school)
course_group = CourseGroup.make
click_link("Asignaturas")
click_link("Nuevo grupo")
fill_in('Nombre del curso', :with => 'Cuarto de E.S.O - Opción de Ciencias')
fill_in('course_group_courses_attributes_0_name', :with => 'Laboratorio')
save_and_open_page
click_button("Create Course group")
page.has_c开发者_如何学运维ontent?("Curso creado").should == true
course_groupDB = CourseGroup.where(:name => 'Cuarto de E.S.O - Opción de Ciencias').first
course_groupDB.name.should == 'Cuarto de E.S.O - Opción de Ciencias'
end
If I use Selenium as a driver all is right. But When I use Akephalos I get:
Failure/Error: course_groupDB.name.should == 'Cuarto de E.S.O - Opción de Ciencias'
undefined method `name' for nil:NilClass
Which means that there is no model in the database with that name. It wasn't saved. The thing is, it was saved, but with non-utf characters.
How can I make sure that utf is used?
I made a fork that add support for utf8.
https://github.com/Nerian/akephalos
精彩评论