Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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)"

as well as this article:

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

When I'm trying to start RSpec with Run 'spec:project it's returning an error:

/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:

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

--color
--require spec_helper

My spec folder:

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

In Gemfile I added:

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.

UPD2: my test works fine if I'm running 'Run spec 'destroy_user_spec.rb'' directly.

like image 487
Viktor Avatar asked Jan 11 '16 11:01

Viktor


1 Answers

Solved: I just had to restart Rubymine after rails g rspec:install

like image 117
Viktor Avatar answered Nov 10 '22 00:11

Viktor