Loading Fixture Data
Learn about fixtures loading, fixtures file, state fixtures, objects fixtures, and why fixtures are great.
Fixtures loading
By default, all our defined fixtures are loaded into the database once at the beginning of our test run. Rails start a database transaction at the beginning of each test. At the end of each test, the transaction is rolled back, restoring the initial state quickly.
The spec_helper.rb
file fixtures
The fixtures’ transactional behavior is a problem if we’re trying to test transactional behavior in our application. In that case, the fixture transaction will overwhelm the transaction we’re trying to test. If we need less aggressive transaction behavior, we can go into ...