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

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

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

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

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

    logo Created with Sketch.

    Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

    © 2020 GoRails, LLC. All rights reserved.