Attempt to run exec rspec spec / models / user_spec.rb package but not execute (see below).
The contents of user_spec.rb:
require 'rails_helper' describe User do pending "add some examples to (or delete) #{__FILE__}" end
If I delete the last 3 lines, then it will contain 0 examples and 0 failures. However, when the last 3 lines are present, it generates an error
/spec/models/user_spec.rb:4:in `<top (required)>': uninitialized constant User (NameError) from /var/lib/gems/1.9.1/gems/rspec-core-3.0.3/lib/rspec/core/configuration.rb:1057:in `load' from /var/lib/gems/1.9.1/gems/rspec-core-3.0.3/lib/rspec/core/configuration.rb:1057:in `block in load_spec_files' from /var/lib/gems/1.9.1/gems/rspec-core-3.0.3/lib/rspec/core/configuration.rb:1057:in `each' from /var/lib/gems/1.9.1/gems/rspec-core-3.0.3/lib/rspec/core/configuration.rb:1057:in `load_spec_files' from /var/lib/gems/1.9.1/gems/rspec-core-3.0.3/lib/rspec/core/runner.rb:97:in `setup' from /var/lib/gems/1.9.1/gems/rspec-core-3.0.3/lib/rspec/core/runner.rb:85:in `run' from /var/lib/gems/1.9.1/gems/rspec-core-3.0.3/lib/rspec/core/runner.rb:70:in `run' from /var/lib/gems/1.9.1/gems/rspec-core-3.0.3/lib/rspec/core/runner.rb:38:in `invoke' from /var/lib/gems/1.9.1/gems/rspec-core-3.0.3/exe/rspec:4:in `<top (required)>' from /usr/local/bin/rspec:23:in `load' from /usr/local/bin/rspec:23:in `<main>'
It seems that he does not know what the User is, and considers it as a constant when this introduces the model. I checked in the ruby โโsandbox that I can create new users in the database. Any ideas?
Answer: After removing --warnings from .rspec (thanks to kirti), the current error was that the version of capybara was too low (2.2 required). After installing the latest version (changing gemfile and installing the package), rspec seems to be working correctly. Thank you all for your comments.
source share