We are a user experience design and software development firm
Hire us to design your site, build your application, serve billions of users and solve real problems.
We have been using fixture_replacement2 on some of our Ruby on Rails projects. I am writing an internal application and finally switched over from using fixtures. It took a bit of time to get the tests that I had written modified to stop using the fixture data, but now I am completely fixture free. The tests are a lot easier to write, and I created a few helper methods that setup common datasets. This way, I can call a setup method to configure my data, and then - it's all good. At first I called the method test_data_blah, and was wondering why I was getting an error running any test, so now it's called data_blah. Doh!
At first I didn't like the fact that I needed to explicitly create the data for what I was working on, but then I realized that (especially for unit tests) you don't need much dependent data; usually it's one or two records. For functional tests, I found that the data setup methods rocked, as I could quickly get the data set up that I needed.I could quickly assert the content of the response, based on the data in my setup. I missed fixtures at first, but now realize that over time, they are a pain.
Topics: fixture replacement, fixtures, plugin, plugins, Ruby on Rails, Testing
Hire us to design your site, build your application, serve billions of users and solve real problems.