【发布时间】:2012-03-18 06:36:26
【问题描述】:
将 rvm 与 ree-1.8.7-2011.03 和 rspec-1.3.2 一起使用,尝试使用 Rails 2.3.14 运行规范文件时出错
感谢任何帮助,因为我无法运行任何规范测试。谢谢!
从我的 Rails 文件夹运行规范文件,例如: 规范规范/模型/assignment_spec.rb
~/.rvm/gems/ree-1.8.7-2011.03/gems/rspec-1.3.2/lib/spec/runner/options.rb:247:in `initialize': 参数数量错误(1 代表2) (参数错误)
from ~/.rvm/gems/ree-1.8.7-2011.03/gems/rspec-1.3.2/lib/spec/runner/options.rb:247:in `new'
from ~/.rvm/gems/ree-1.8.7-2011.03/gems/rspec-1.3.2/lib/spec/runner/options.rb:247:in `load_formatters'
...
~/.rvm/gems/ree-1.8.7-2011.03/gems/rspec-1.3.2/lib/spec/runner/.rb:
...
def load_formatters(format_options, formatters)
format_options.map do |format, where|
formatter_type = if formatters[format]
require formatters[format][0]
eval(formatters[format][1], binding, __FILE__, __LINE__)
else
load_class(format, 'formatter', '--format')
end
formatter_type.new(formatter_options) # <-- 247
end
end
def formatter_options
@formatter_options ||= OpenStruct.new(
:colour => colour,
:autospec => autospec,
:dry_run => dry_run
)
end
...
编辑:
spec_helper.rb: https://github.com/instructure/canvas-lms/blob/stable/spec/spec_helper.rb
./.spec.opts:
--颜色
--需要规范/nested_instafail_formatter
--格式化RSpec::NestedInstafailFormatter
--html格式:tmp/spec_html/index.html
【问题讨论】:
-
请出示您的 spec_helper.rb
-
你试过
ree-1.8.7-2012.02吗? -
另外请出示
./spec.opts的内容 -
在上面添加了 spec_helper.rb 和 ./spec.opts。使用 ree-1.8.7-2012.02 安装,这似乎成功了,谢谢!
标签: ruby-on-rails rspec