---
title: "Rails 5 Renaming transactional fixtures to tests"
description:
  "Rails 5 renamed use_transactional_fixtures method to use_transactional_tests.
  This was to make it clear that its functionality has nothing to do with use of
  fixtures."
canonical_url: "https://www.bigbinary.com/blog/rails-5-renamed-transactional-fixtures-to-transactional-tests"
markdown_url: "https://www.bigbinary.com/blog/rails-5-renamed-transactional-fixtures-to-transactional-tests.md"
---

# Rails 5 Renaming transactional fixtures to tests

Rails 5 renamed use_transactional_fixtures method to use_transactional_tests.
This was to make it clear that its functionality has nothing to do with use of
fixtures.

- Author: Mohit Natoo
- Published: May 26, 2016
- Categories: Rails 5, Rails

In Rails 4.x we have transactional fixtures that wrap each test in a database
transaction. This transaction rollbacks all the changes at the end of the test.
It means the state of the database, before the test is same as after the test is
done.

By default this functionality is enabled. We can choose to disable it in a test
case class by setting the class attribute `use_transactional_fixtures` to
`false`

```ruby

class FooTest < ActiveSupport::TestCase
  self.use_transactional_fixtures = false
end

```

Rails also comes with fixtures for tests. So it may seem that
`use_transactional_fixtures` has something to do with the Rails fixtures. A lot
of people don't use fixtures and they think that they should disable
`use_transactional_fixtures` because they do not use fixtures.

To overcome this confusion, Rails 5 has
[renamed transactional fixtures to transactional tests](https://github.com/rails/rails/pull/19282)
making it clear that it has nothing to do with the fixtures used in tests.

In Rails 5, the above example will be written as follows.

```ruby

class FooTest < ActiveSupport::TestCase
  self.use_transactional_tests = false
end

```

## Links

- [Human page](https://www.bigbinary.com/blog/rails-5-renamed-transactional-fixtures-to-transactional-tests)
