0

I have two models: User, Group

I have fixtures for both of them.

I have UserTest class which is unitTest and I can use fixture finder users(:someuserfixture). However, if I try to use groups(:somegroupfixture) it says that groups isn't recognized.

How can I access fixtures of another model?


Victor Ronin
  • 22,758
  • 18
  • 92
  • 184

2 Answers2

0

Generally people have this line in their test/test_helper.rb file:

fixtures :all

Which loads all the fixtures for all the tests. If you don't have this, add it.

smathy
  • 26,283
  • 5
  • 48
  • 68
0

Stupid plurality.

I created fixture with a name "users.yml" for User model.

And I created fixture called "group.yml" for Group model.

Both naming is good apparently. However, it creates a finder which has the same name as a file. So, the finder was group() vs groups()

Victor Ronin
  • 22,758
  • 18
  • 92
  • 184