规格在Travis-CI Net :: ReadTimeout中失败

时间:2019-03-27 02:37:18

标签: ruby-on-rails deployment rspec travis-ci

我刚刚开始学习编码,因此我很抱歉,如果我的问题很简单,那就是我的问题。我有2条未通过travis-ci的规范正在我的测试环境中通过。我收到的错误是:

148.18s$ bundle exec rspec
Running via Spring preloader in process 15472
.............................Capybara starting Puma...
* Version 3.12.0 , codename: Llamas in Pajamas
* Min threads: 0, max threads: 4
* Listening on tcp://127.0.0.1:35193
F..F.............................................................

Failures:
1) Users can create new tickets with multiple attachment
Failure/Error: visit project_path(project)
Net::ReadTimeout:
Net::ReadTimeout
# ./spec/features/creating_tickets_spec.rb:12:in `block (2 levels) in <top (required)>'
2) Users can delete unwanted tags from a ticket successfully
Failure/Error: visit project_ticket_path(project, ticket)

Net::ReadTimeout:
Net::ReadTimeout
# ./spec/features/deleting_tags_spec.rb:16:in `block (2 levels) in <top (required)>'
Finished in 2 minutes 17.9 seconds (files took 9.62 seconds to load)
131 examples, 2 failures
Failed examples:
rspec ./spec/features/creating_tickets_spec.rb:45 # Users can create new tickets with multiple attachment
rspec ./spec/features/deleting_tags_spec.rb:15 # Users can delete unwanted tags from a ticket successfully
The command "bundle exec rspec" exited with 1.
Done. Your build exited with 1.

我的项目中的多个规范中都包含了访问xxx_path(xxx)失败的代码行,因此我对出现的问题不知所措。请您能帮我解决这个问题,以便最终让travis-ci为我的项目工作。谢谢!!

我的代码库托管在github上:https://github.com/mellansquare/rails-4-in-action-2

1 个答案:

答案 0 :(得分:0)

在我看来,您的测试要求在Travis CI上使用图形用户界面, 因此,请尝试将以下内容添加到您的.travis.yml

before_script:
  - "export DISPLAY=:99.0"
  - "sh -e /etc/init.d/xvfb start"
  - sleep 3 # give xvfb some time to start