mardi 7 avril 2015

Can I add tests in custom folders under test/models related to existing models?

In my rails 4.2.1 app, I have a model called Foo, and the default test/models/foo_test.rb. I want to create separate tests for several different logical variants of foo, for which I would like to add a folder called test/models/foo_variants, with tests like foo_variant1_test.rb, foo_variant2_test.rb, etc.


I realize there is no model called FooVariant1, so I suspect this will not work with the convention of (modelname)_test.rb under test/models - what is the best way to enable this?


I could of course, lump all the variants' tests into foo_test.rb, but wondered if there was a more elegant way to achieve this (especially since I expect to have twenty to hundreds of variants).


Aucun commentaire:

Enregistrer un commentaire