Title test failing for request specs in Michael Hartls tutorial for Rails 3

馋奶兔 提交于 2019-12-03 20:58:42

Capybara 2.1 changed its support for querying the title element. So using have selector in to query for the title element in the head of the html doc in this fashion will fail "page.should have_selector('title', :text => 'Some text').

Use "page.should have_title('Some text')" to query the title element should work. That is new method that the 2.1 API implemented to query the title element.

Also if you using capybara 2x its suggested to move your files in the subfolder called 'requests' located in the 'spec' folder (spec/folder) into a new folder called 'features' (spec/features).

Hope this works out.

Happy coding!!

In your gemfile, change

gem 'capybara'

into

gem 'capybara', '1.1.2'

and run 'bundle update'.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!