Ask A Question

Notifications

You’re not receiving notifications from this thread.

I have an error of the following form and I am unable to point out the error.

Ananya Singh asked in Testing
 Unable to autoload constant CONSTANT_NAME, expected TESTING_FILE_PATH to define it
Reply
Without more information and background on what you're doing it's hard to say.  A google search turns up a ton of SO articles on this, some related to testing, some not.  Can you give more detail?
Reply
Following is the whole error:
An error occurred while loading ./spec/models/completed_lesson_spec.rb.
Failure/Error:
  RSpec.describe Completed_lesson, type: :model do
    it "has a user_id" do
      completed_lesson = Completed_lesson.create!(user_id: 1)

      second_completed_lesson = Completed_lesson.create!(user_id: 2)

       expect(second_completed_lesson.user_id).to eq(2)
    end
  end

LoadError:
  Unable to autoload constant Completed_lesson, expected C:/Sites/SM-rails/app/models/completed_lesson.rb to define it
# ./spec/models/completed_lesson_spec.rb:3:in `<top (required)>'
No examples found.
Reply
Change your class name from `Completed_lesson` to 
CompletedLesson
Its a naming convention in Rails.
Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 87,563+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.