如何在TravisCI中禁用RSpec

时间:2016-09-26 22:17:24

标签: ruby-on-rails travis-ci

我使用Rails 5和功能测试与RSpec / Capybara / Poltergeist / Selenium。在我手动安装必要的geckodriver之后,本地测试运行正常。

但是在TravisCI上,RSpec测试失败并显示错误消息:

   <head>
   <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
        </head>
      
        <body>
 

<ul id="grid">
   <li id="gridli">
      <form action="http://google.com">
         <button class="button" type="submit"  />
         Computers, printers, mobile phones and the widgets that accompany them account for the emission of about two per cent of the estimated total of emissions from human activity. And that is the same as the aviation industry&#8217;s contribution. 25 per cent of the emissions in question are generated by the manufacture of computers. The rest come from their use.
         </button>
      </form>
   </li>
   <li  id="gridli">
      <form action="http://google.com" style="float: left">
         <button class="button" type="submit"  />
         Computers can be used to reduce emissions produced by other industries, up to 7.8 billion tonnes by 2020, or five times ICT&#8217;s own footprint. Computers can make industries more efficient and less wasteful of power and fuel.
         </button>
      </form>
   </li>
   <li   id="gridli">
      <form action="http://google.com" style="float: left">
         <button class="button" type="submit"  />
         The use of computers has led to both positive and negative impacts on the climate change of our planet. Computers can help make some processes more efficient and save energy while the use and manufacture of computers contributes to the increased use of energy which leads to global warming. This website helps you to look at the positives and negatives of computing and climate change.</p>
         </button>
      </form>
   </li>
   <li   id="gridli">
      <form action="http://google.com" style="float: left">
         <button class="button" type="submit"  />
            <h3> Saving Energy</h3>
            There are many ways in which computers can help cut down on our use of energy. Computers are steadily improving the amount of energy that they use with the smaller computers producing less CO2 than larger desktop computers.
         </button>
      </form>
   </li>
</ul>

是否可以选择跳过RSpec功能测试?或者我如何配置TravisCI使用geckodriver?

1 个答案:

答案 0 :(得分:0)

我无法找到在TravisCI中为集成测试配置geckodriver的方法,但至少我可以指定要运行的测试:

env:
  - TEST_SUITE=controllers
  - TEST_SUITE=models
script: "bundle exec rake spec:$TEST_SUITE"

所以跳过所有功能测试,我的完整.travis.yml看起来像这样:

language: ruby
rvm:
  - 2.2.2
services:
  - postgresql
before_script:
  - psql -c 'create database travis_ci_test;' -U postgres
  - cp config/database.yml.travis config/database.yml
bundler_args: --without production
env:
  - TEST_SUITE=controllers
  - TEST_SUITE=models

script: "bundle exec rake spec:$TEST_SUITE"