Error Message:PageController GET 'contact' should have the right title....
我想向更有经验的Rubists寻求建议。我正在关注Michael Hartl的rails tutorial 3,就在第3章结束之前,我附上了错误信息。
我真的不知道要改变什么,因为我多次检查过,而且我的文件与教科书中的相同。
我的代码可在Github上找到: https://github.com/maro9/sample_app
提前感谢您的帮助。
错误信息printscreen: http://s11.postimage.org/pcz9us1tv/rspec_error.jpg
答案 0 :(得分:1)
改变这个:
response.should have_selector("title",
:content => "Ruby on Rails Tutorial Sample App|Home")
到此:
response.should have_selector("title",
:content => "Ruby on Rails Tutorial Sample App | Home")
在pages_controller_spec.rb
:https://github.com/maro9/sample_app/blob/master/spec/controllers/pages_controller_spec.rb#L15
答案 1 :(得分:0)
在您的代码中,内容中的“应用”是小写的,但您正在针对大写进行测试。
你创造了什么
"Ruby on Rails Tutorial Sample app | About"
你声称自己创造了什么
"Ruby on Rails Tutorial Sample App | About"
app / views / layouts / application.html.erb应更改为:
- <title>Ruby on Rails Tutorial Sample app | <%= @title %></title>
+ <title>Ruby on Rails Tutorial Sample App | <%= @title %></title>