2016-09-26 55 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"