2016-09-26 52 views
0

我使用Rails 5和RSpec /水豚/ Poltergeist/Selenium的功能測試。在我手動安裝必要的geckodriver後,本地測試運行良好。如何在TravisCI中禁用RSpec

但在TravisCI的RSpec的測試失敗,出現錯誤消息:

Selenium::WebDriver::Error::WebDriverError: 

Unable to find Mozilla geckodriver. Please download the server from 
    https://github.com/mozilla/geckodriver/releases and place it 
somewhere on your PATH. More info at 
https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette/WebDriver. 

有隻跳過RSpec的功能測試的選項?或者我怎樣才能配置TravisCI使用geckodriver?

+0

你有沒有嘗試添加 '插件: 火狐: 「50.0」' 你'.travis.yml'文件? –

+0

謝謝你指點我正確的方向。但現在我的功能規範失敗TravisCI:NameError: 未定義的局部變量或方法'new_user_registration_path'爲# 似乎TravisCI不使用spec/rails_helper.rb其中我定義了使用url-helpers:config.include Rails.application.routes.url_helpers – StandardNerd

+0

你需要在'RSpec.configure do | config |'-block中的config.include Rails.application.routes.url_helpers' 'rspec_helper.rb' –

回答

0

我無法想出一個辦法來配置geckodriver在TravisCI集成測試,但至少我可以指定哪些測試與運行:

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"