运行时 Ruby/Rails rspec 下载错误

Ruby/Rails rspec download errors on run

运行

时出现以下错误

1
saasbook@saasbook:~/Documents/ruby-calisthenics$ rspec

错误信息

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/home/saasbook/.rvm/gems/ruby-2.0.0-p481/gems/rspec-core-3.0.3/lib/rspec/core/formatters.rb:167:in `find_formatter': Formatter 'nested' unknown - maybe you meant 'documentation' or 'progress'?. (ArgumentError)
from /home/saasbook/.rvm/gems/ruby-2.0.0-p481/gems/rspec-core-3.0.3/lib/rspec/core/formatters.rb:126:in `
add'
from /home/saasbook/.rvm/gems/ruby-2.0.0-p481/gems/rspec-core-3.0.3/lib/rspec/core/configuration.rb:624:in `add_formatter'

from /home/saasbook/.rvm/gems/ruby-2.0.0-p481/gems/rspec-core-3.0.3/lib/rspec/core/configuration_options.rb:106:in `block in load_formatters_into'
from /home/saasbook/.rvm/gems/ruby-2.0.0-p481/gems/rspec-core-3.0.3/lib/rspec/core/configuration_options.rb:106:in `
each'
from /home/saasbook/.rvm/gems/ruby-2.0.0-p481/gems/rspec-core-3.0.3/lib/rspec/core/configuration_options.rb:106:in `load_formatters_into'

from /home/saasbook/.rvm/gems/ruby-2.0.0-p481/gems/rspec-core-3.0.3/lib/rspec/core/configuration_options.rb:24:in `configure'
from /home/saasbook/.rvm/gems/ruby-2.0.0-p481/gems/rspec-core-3.0.3/lib/rspec/core/runner.rb:96:in `
setup'
from /home/saasbook/.rvm/gems/ruby-2.0.0-p481/gems/rspec-core-3.0.3/lib/rspec/core/runner.rb:85:in `run'

from /home/saasbook/.rvm/gems/ruby-2.0.0-p481/gems/rspec-core-3.0.3/lib/rspec/core/runner.rb:70:in `run'
from /home/saasbook/.rvm/gems/ruby-2.0.0-p481/gems/rspec-core-3.0.3/lib/rspec/core/runner.rb:38:in `
invoke'
from /home/saasbook/.rvm/gems/ruby-2.0.0-p481/gems/rspec-core-3.0.3/exe/rspec:4:in `<top (required)>'

from /home/saasbook/.rvm/gems/ruby-2.0.0-p481/bin/rspec:23:in `load'
from /home/saasbook/.rvm/gems/ruby-2.0.0-p481/bin/rspec:23:in `
<main>'
from /home/saasbook/.rvm/gems/ruby-2.0.0-p481/bin/ruby_executable_hooks:15:in `eval'

from /home/saasbook/.rvm/gems/ruby-2.0.0-p481/bin/ruby_executable_hooks:15:in `<main>'

我是 Ruby 和 Rails 的新手。我一直遇到兼容性问题,任何帮助将不胜感激!

我试图在 | 中运行 rspec 的文件目录的一些背景这是我正在上的在线课程的文件。它根据需要包含一个 lib 和 spec 文件。但我得到的错误似乎是我的 rspec 下载的问题。


编辑 Rails 应用程序根目录中的 .rspec 文件,并将以下行从:

1
--format nested

到:

1
--format documentation

rspec-3.0 中不再存在 nested 格式。


卸载所有以前版本的 rspec 及其依赖项。

1
2
3
4
gem uninstall rspec
gem uninstall rspec-core
gem uninstall rspec-mocks
gem uninstall rspec-expectations

在 gem 文件 install rspec.

中安装正确版本的 rspec

1
2
3
group :development, :test do
  gem 'rspec-rails', '~> 3.0.0'
end

我从这个链接得到了这个解决方案