When you testing or specing a Rails app and trying to avoid database hits, the process of creating a mock model objects with all the required columns and values stubbed can be tedious.
If you have
... [More]
gone to the trouble of creating fixture files for you model specs then these can be reused for the controller, (functional tests), view and helper specs without the performance hit of the accessing the database.
This is where mocked_fixtures comes in.
For example in a spec where you have
fixtures :peopleyou can replace with
mock_fixtures :peopleand use the mocked models loaded with the fixture values like this
@joe = mock_people(:joe)presuming you have a fixture labelled 'joe'.
You get backed a mock object with all attribute methods stubbed out with the values that were in the fixture. [Less]