Travis Build无法为Rspec找到Diff :: LCS :: SpecHelper

时间:2014-10-25 11:31:21

标签: ruby rspec

我正在尝试为我的Ruby项目设置Travis构建。测试使用的是rspec。他们使用默认的' rake'在本地传递。任务,但Travis构建失败并出现错误:

  

/ home / travis /.../ vendor / bundle / ruby​​ / 2.0.0 / gems / diff-lcs-1.2.5 / spec / diff_spec.rb:6:在`block in':未初始化常量Diff :: LCS :: SpecHelper(NameError)

我的应用没有直接使用diff-lcs;它似乎是rspec内部需要的东西。

Full build log here

Full Source code here

到目前为止我尝试过的事情:

  • 检查依赖关系 - travis' bundler使用与我的本地框相同的版本用于所有依赖项
  • 添加"要求' diff-lcs'" Rakefile和我的内部spec-helper - 没有帮助
  • Google - 无法找到类似的内容

Travis配置:

language: ruby
rvm:
  - 2.0.0
  - 2.1.0
cache: bundler

Gemfile.lock的:

rspec (2.14.1)
  rspec-core (~> 2.14.0)
  rspec-expectations (~> 2.14.0)
  rspec-mocks (~> 2.14.0)
rspec-core (2.14.8)
rspec-expectations (2.14.5)
  diff-lcs (>= 1.1.3, < 2.0)

.rspec

-c 
--default_path . 
--pattern **/*_spec*.rb
--require spec_helper

1 个答案:

答案 0 :(得分:1)

通过将模式指定为**/*_spec*.rb,您告诉RSpec在项目内的所有目录中搜索规范文件。

您还可以将Bundler配置为将gem安装到项目目录中,因此RSpec正在搜索您的所有gem并尝试运行他们的规范以及您自己的。

使用更好的模式是spec/**/*_spec.rb(假设您的所有规范都在spec目录中)。这限制了RSpec对此路径的搜索。