I\'m writing tests on Rspec for my models in Ruby on Rails application. And I receive this error while starting \'rspec spec\'
command:
/spec/models/client_spec
Things have moved a bit since this thread has been created, I have experienced the uninitialized constant ClassName (NameError)
error too using Ruby 2.1, Rails 4.2, rspec-rails 3.3.
I have solved my problems reading the rspec-rails gem documentation :
https://github.com/rspec/rspec-rails#model-specs
where it confirms what Swards says about requiring "rails_helper" not "spec_helper" anymore.
Also my model specification looks more like the one from the gem docs
RSpec.describe Url, :type => :model do
it 'is invalid without first_name', :focus => true do
client = Client.new
client.should_not be_valid
end
end