Sha256: 44ca862a4d25c9ee813b06f1baf1bb8f8febc15154097a76d423a2f2ca6c1f26

Contents?: true

Size: 693 Bytes

Versions: 2

Compression:

Stored size: 693 Bytes

Contents

module Slavery
  class Transaction
    # The methods on ActiveSupport::TestCase which can potentially be used
    # to determine if transactional fixtures are enabled
    TEST_CONFIG_METHODS = [
      :use_transactional_tests,
      :use_transactional_fixtures
    ]

    class << self
      def base_depth
        @base_depth ||= if defined?(ActiveSupport::TestCase) &&
          transactional_fixtures_enabled?
        then
          1
        else
          0
        end
      end

      private

      def transactional_fixtures_enabled?
        config = ActiveSupport::TestCase
        TEST_CONFIG_METHODS.any? {|m| config.respond_to?(m) and config.send(m) }
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
slavery-3.0.0 lib/slavery/transaction.rb
slavery-2.1.1 lib/slavery/transaction.rb