Ruby on Rails: Unit Testing non activerecord models and still load fixtures
- by Vaibhav Gumashta
I may be missing something but I am stuck in this scenario:
I have a non activerecord model, which I want to test. I have derived its test case class from: Test::Unit::TestCase.
However, the test case class for the model, uses within itself, other activerecord model classes and I want to load fixtures for them. My problem is that the fixtures class method is available only when I subclass the test case class from ActiveSupport::TestCase (it is defined within ActiveRecord::TestFixtures which gets included in ActiveSupport::TestCase).
Any help, coz running the tests gives me the error: undefined method "fixtures" (which is understandable) and in case I derive my test case class from ActiveSupport::TestCase it complains that there is no corresponding DB table. Also, I don't want to create a dummy table for backing my model class.
Thanks a ton!