我需要在Travis上启动一个Rails服务器来运行集成测试。 我已经将以下内容添加到配置文件中:
before_script:
- psql -c 'create database scalia_test;' -U postgres
- "bundle exec rails server -p 3000 &"
然而,Cypress 依然报错:
http://localhost:3000/users/sign_in
We attempted to make an http request to this URL but the request failed without a response.
We received this error at the network level:
> Error: connect ECONNREFUSED 127.0.0.1:3000
Common situations why this would fail:
- you don't have internet access
- you forgot to run / boot your web server
- your web server isn't accessible
- you have weird network configuration settings on your computer
The stack trace for this error is:
Error: connect ECONNREFUSED 127.0.0.1:3000
at Object.exports._errnoException (util.js:1024:11)
at exports._exceptionWithHostPort (util.js:1047:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1150:14)
有人知道如何在Travis上启动Rails服务器吗?
sleep 3
命令。同时确保设置了RAILS_ENV=test
环境变量。 - Tarun Lalwani