开发者

rails, tests, and fixtures - Error "underlying cause no such file to load"

开发者 https://www.devze.com 2023-01-30 13:36 出处:网络
I\'m trying to get the tests for my rails app to run, but it keeps giving me the following errors: Unable to load tp_approval_step, underlying cause no such file to load -- tp_approval_step

I'm trying to get the tests for my rails app to run, but it keeps giving me the following errors:

Unable to load tp_approval_step, underlying cause no such file to load -- tp_approval_step

I hav开发者_JAVA百科e a fixture named tp_approval_step.yml and I have also added this to my test_helper.rb

set_fixture_class :tp_approval_step => ApprovalProcessStep

I am receiving these errors for all of my fixtures. Any ideas about what I can do to eliminate these errors?

Thanks


Long story short - after browsing and asking on rubyonrails-talk - almost nobody uses or cares about fixtures. The prevailing wisdom in the community is to use a factory class to load the database. There are libraries that can help with this, in particular, factory_girl and machinist.


I had the same issue in my test. I had accidentally added a comma to the line above the "def setup". Once I removed that comma the yaml loaded and the tests worked. Example below, note the comma after :testing_dog.

 attr_accessor  :public_api_client, :testing_dog,

  ##############################
  #
  ##############################
  def setup
.....
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号