aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/test_fixtures_test.rb
blob: 7090202a898caa3247c0b8cf6ecc2afb3e4d839b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
require "cases/helper"

class TestFixturesTest < ActiveRecord::TestCase
  setup do
    @klass = Class.new
    @klass.include(ActiveRecord::TestFixtures)
  end

  def test_deprecated_use_transactional_fixtures=
    assert_deprecated "use use_transactional_tests= instead" do
      @klass.use_transactional_fixtures = true
    end
  end

  def test_use_transactional_tests_prefers_use_transactional_fixtures
    ActiveSupport::Deprecation.silence do
      @klass.use_transactional_fixtures = false
    end

    assert_equal false, @klass.use_transactional_tests
  end

  def test_use_transactional_tests_defaults_to_true
    ActiveSupport::Deprecation.silence do
      @klass.use_transactional_fixtures = nil
    end

    assert_equal true, @klass.use_transactional_tests
  end

  def test_use_transactional_tests_can_be_overridden
    @klass.use_transactional_tests = "foobar"

    assert_equal "foobar", @klass.use_transactional_tests
  end
end