Ask A Question


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
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?
Following is the whole error:
An error occurred while loading ./spec/models/completed_lesson_spec.rb.
  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)

  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.
Change your class name from `Completed_lesson` to 
Its a naming convention in Rails.
Join the discussion
Create an account Log in

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

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

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

    Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more.

    © 2023 GoRails, LLC. All rights reserved.