Rspec 测试失败,但应该通过。 Railstutorial.org 第 3 章
我从编程中休息了很长时间,因为其他事情引起了我的兴趣。当我重新拿起它时,我决定返回railstutorial.org是个好主意,因为我第一次发现它很有用,但记不清了,正如我希望的那样。
在简单地运行命令“railsgeneratecontrollerPageshomecontact”后,我有一个“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
I took a long break from programming, because other things caught my interest. When I picked it back up, I decided it would be a good idea to go back through railstutorial.org, since I found it useful the first time through, but couldn't remember much as I had hoped.
After simply running the command 'rails generate controller Pages home contact' I have a 'spec/controllers/pages_controllers_rspec.rb' file that looks like this:
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
Even though all the routes and controllers are in place as described in chapter 3, Rspec indicates failure. What am I doing wrong?
Both tests fail with messages:
Failure/Error: Unable to find matching line from backtrace
PGError: fe_sendauth: no password supplied
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尚未创建测试数据库。别问我为什么。一旦我返回并手动创建测试数据库,测试就开始通过。
The test database hadn't been created. Don't ask me why. Once I'd gone back in and manually created the test database, tests started passing.