I have a model with polymorphic association that I am running rspecs on.
The tests require the polymorphic field to point to a model with some fields (e.g. name).
Since I prefer not to use any of my existing (and complex)models, I was thinking of somehow creating a new simple models (that will only exist in tests) that my main models can point to.
Is there a way to do this ?
Any other way to test models when they are dependant on another models ?
Problem solved – using the ‘mocha’ gem.
In tests, can just do:
Now it will simply work: