gpt4 book ai didi

ruby-on-rails - RSpec:无法加载此类文件——teamcity/spec/runner/formatter/teamcity/formatter (LoadError)

转载 作者:数据小太阳 更新时间:2023-10-29 07:06:02 25 4
gpt4 key购买 nike

这个解决方案对我不起作用:

Running a spec in RubyMine results in "cannot load such file -- teamcity/spec/runner/formatter/teamcity/formatter (LoadError)"

还有这篇文章:

https://www.jetbrains.com/ruby/help/using-rspec-in-rails-applications.html

我正在使用 Ubuntu 15.10、RubyMine 7.1、Ruby 2.2.3、Rails 4.2.5

当我尝试使用 Run 'spec:project 启动 RSpec 时,它返回了一个错误:

/home/duke/.rvm/rubies/ruby-2.2.3/bin/ruby -I/home/duke/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/lib:/home/duke/.rvm/gems/ruby-2.2.3/gems/rspec-support-3.4.1/lib /home/duke/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb
/home/duke/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/lib/rspec/core/configuration.rb:1295:in `require': cannot load such file -- teamcity/spec/runner/formatter/teamcity/formatter (LoadError)
from /home/duke/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/lib/rspec/core/configuration.rb:1295:in `block in requires='
from /home/duke/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/lib/rspec/core/configuration.rb:1295:in `each'
from /home/duke/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/lib/rspec/core/configuration.rb:1295:in `requires='
from /home/duke/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/lib/rspec/core/configuration_options.rb:109:in `block in process_options_into'
from /home/duke/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/lib/rspec/core/configuration_options.rb:108:in `each'
from /home/duke/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/lib/rspec/core/configuration_options.rb:108:in `process_options_into'
from /home/duke/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/lib/rspec/core/configuration_options.rb:21:in `configure'
from /home/duke/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/lib/rspec/core/runner.rb:101:in `setup'
from /home/duke/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/lib/rspec/core/runner.rb:88:in `run'
from /home/duke/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/lib/rspec/core/runner.rb:73:in `run'
from /home/duke/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/lib/rspec/core/runner.rb:41:in `invoke'
from /home/duke/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/exe/rspec:4:in `<main>'
/home/duke/.rvm/rubies/ruby-2.2.3/bin/ruby -I/home/duke/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/lib:/home/duke/.rvm/gems/ruby-2.2.3/gems/rspec-support-3.4.1/lib /home/duke/.rvm/gems/ruby-2.2.3/gems/rspec-core-3.4.1/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb failed

Process finished with exit code 1

同时,如果我在终端中运行 $ bundle exec rspec,输出是:

No examples found.


Finished in 0.00029 seconds (files took 2.21 seconds to load)
0 examples, 0 failures

我是测试新手,所以这对我来说很奇怪。

更新:.rspec 非常空

--color
--require spec_helper

我的 spec 文件夹:

.
├── lib
│   └── destroy_user_spec.rb
├── rails_helper.rb
└── spec_helper.rb

我在 Gemfile 中添加了:

group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
gem 'rspec-rails'
#gem 'factory_girl'
#gem 'ffaker'
#gem 'shoulda-matchers'
#gem 'pry-byebug'
end

然后运行 ​​bundle install,这样 gem 就安装好了。

UPD2:如果我直接运行 'Run spec 'destroy_user_spec.rb'',我的测试工作正常。

最佳答案

已解决:我只需要在 rails g rspec:install 之后重启 Rubymine

关于ruby-on-rails - RSpec:无法加载此类文件——teamcity/spec/runner/formatter/teamcity/formatter (LoadError),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34720398/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com