Rspec doesn't see my model Class. uninitialized constant error

后端 未结 7 1915
予麋鹿
予麋鹿 2021-01-30 19:09

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         


        
7条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-30 19:50

    If other answers under this question don't work, try:

    • Check if there is any typo in the file name or class name (they should match)

    Other wise,

    • Check your config/environment/test.rb file, see if there is config.eager_load = false, set it to true.

    You should check in the written order since you don't want to solve the issue with the typo laying there.

提交回复
热议问题