Last Updated: February 25, 2016
·
1.127K
· michiels

Collaborate better with fixtures

I have been a fan of features ever since I came back from the Cucumber and Rspec story and went into standard Rails testing. I have been increasingly using features ever since.

Things like FactoryGirl are pretty neat, but the managing of fixtures at the start of every test case or test suite really bummed me out. The simplicity of just heaving 1-5 standard features per model for different states or different validation types are really so much simpler.

Another advantage. Fixtures are great for collaboration.

Not only can everyone clearly look up how a certain fixture look when running or fixing broken tests. The best thing about fixtures so far has been this command:

rake db:fixtures:load

This will load all the fixtures into my development db instantly. You get shared test data for free!

You don't need to keep a certain SQL dump in your repo or team's server to collaborate on real live data. You can just tell someone: hey, fixture "product_abcd" doesn't look so good on so and so product detail page. Please fix it!

Designers can easily modify or add a fixture that developers can than load into their pages, or the other way around.

It's so much easier to communicatie that fixture users(:john) doesn't work than it is to FactoryGirl.create some state with a bunch of lines of Ruby code behind it.

Fixtures are a collaboration heaven for every team.