简体   繁体   English

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

[英]RSpec: cannot load such file — teamcity/spec/runner/formatter/teamcity/formatter (LoadError)

This solution doesn't work with me: 此解决方案不适用于我:

Running a spec in RubyMine results in "cannot load such file -- teamcity/spec/runner/formatter/teamcity/formatter (LoadError)" 在RubyMine中运行规范会导致“无法加载此类文件 - teamcity / spec / runner / formatter / teamcity / formatter(LoadError)”

as well as this article: 以及这篇文章:

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

I'm using Ubuntu 15.10, RubyMine 7.1, Ruby 2.2.3, Rails 4.2.5 我使用的是Ubuntu 15.10,RubyMine 7.1,Ruby 2.2.3,Rails 4.2.5

When I'm trying to start RSpec with Run 'spec:project it's returning an error: 当我试图用Run'ppec开始RSpec时Run 'spec:project它返回一个错误:

/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

The same time, if I'm runnig $ bundle exec rspec in the terminal, the output is: 同时,如果我在终端中运行$ bundle exec rspec ,则输出为:

No examples found.


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

I'm totally new in testing, so it's all weird for me. 我是测试的新手,所以这对我来说都很奇怪。

UPD: .rspec is pretty empty UPD: .rspec很空

--color
--require spec_helper

My spec folder: 我的spec文件夹:

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

In Gemfile I added: 在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

And ran bundle install , so gems are installed. 并运行bundle install ,因此bundle install gem。

UPD2: my test works fine if I'm running 'Run spec 'destroy_user_spec.rb'' directly. UPD2:如果我直接运行'运行规范'destroy_user_spec.rb''我的测试工作正常。

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在RubyMine中运行规范会导致“无法加载此类文件 - teamcity / spec / runner / formatter / teamcity / formatter(LoadError)” - Running a spec in RubyMine results in “cannot load such file — teamcity/spec/runner/formatter/teamcity/formatter (LoadError)” rubymine debug rspec未捕获的异常:无法加载此类文件-teamcity / spec / runner / formatter / teamcity / formatter - rubymine debug rspec Uncaught exception: cannot load such file — teamcity/spec/runner/formatter/teamcity/formatter CircleCI 与 Rspec 获取 LoadError:无法加载此类文件 -- rspec_junit_formatter - CircleCI with Rspec getting LoadError: cannot load such file -- rspec_junit_formatter spec / runner / formatter / html_formatter的文件路径 - File path for spec/runner/formatter/html_formatter Rspec测试加载错误:无法加载此类文件 - spec_helper(LoadError) - Rspec tests load error: cannot load such file — spec_helper (LoadError) TeamCity返回没有此类文件要加载-rubygems(LoadError)但终端运行正常 - TeamCity returns No such file to load — rubygems (LoadError) but terminal runs fine `require':无法加载这样的文件 - capybara / rspec(LoadError) - `require': cannot load such file — capybara/rspec (LoadError) 脚本/运行程序:3:在“需要”中:无法加载此类文件-命令/运行程序(LoadError) - script/runner:3:in `require': cannot load such file — commands/runner (LoadError) LoadError:无法加载此类文件-spec / rake / spectask Fedena - LoadError: cannot load such file — spec/rake/spectask Fedena LoadError:无法加载此类文件-…/ advertisement_controller_spec.rb - LoadError: cannot load such file — …/advertisement_controller_spec.rb
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM