我从编程中休息了很长时间,因为其他事情引起了我的兴趣。当我把它拿回来时,我决定回到 railstutorial.org 是个好主意,因为我第一次发现它很有用,但记不太清了。
简单地运行命令“rails generate controller Pages home contact”后,我有一个“spec/controllers/pages_controllers_rspec.rb”文件,如下所示:
require 'spec_helper'
describe PagesController do
describe "GET 'home'" do
it "should be successful" do
get 'home'
response.should be_success
end
end
describe "GET 'contact'" do
it "should be successful" do
get 'contact'
response.should be_success
end
end
end
尽管如第 3 章所述,所有路由和控制器都已到位,但 Rspec 指示失败。我究竟做错了什么?
两个测试都失败并显示消息:
Failure/Error: Unable to find matching line from backtrace
PGError: fe_sendauth: no password supplied