【发布时间】:2014-12-21 02:46:26
【问题描述】:
我正在尝试为我的 Ruby 项目设置 Travis 构建。测试使用 rspec。他们使用默认的“rake”任务在本地通过,但在 Travis 构建中失败并出现错误:
/home/travis/.../vendor/bundle/ruby/2.0.0/gems/diff-lcs-1.2.5/spec/diff_spec.rb:6:in `block in ': 未初始化的常量 Diff: :LCS::SpecHelper (NameError)
我的应用没有直接使用 diff-lcs;这似乎是 rspec 内部需要的东西。
到目前为止我尝试过的事情:
- 检查依赖项 - travis 的捆绑器对所有依赖项使用与我本地盒子相同的版本
- 将“require 'diff-lcs'”添加到 Rakefile 和我的内部规范助手 - 没有帮助
- Google - 找不到类似的东西
特拉维斯配置:
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
【问题讨论】:
-
gem 不应该像
diff-lcs-1.2.5/spec/diff_spec.rb:6这样从 spec 文件夹中加载文件,这是怎么回事? -
@phoet - 我添加了我的 .rspec 文件 - 你认为我的路径或模式搞砸了吗?
-
绝对是模式。