Sha256: 989e0d233f3a87b86212c9729386373f3fa31a76608b7906eb6aa2f66c9d0bd1

Contents?: true

Size: 693 Bytes

Versions: 3

Compression:

Stored size: 693 Bytes

Contents

module Standby
  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

3 entries across 3 versions & 2 rubygems

Version Path
standby-5.0.0 lib/standby/transaction.rb
slavery-4.0.0 lib/standby/transaction.rb
standby-4.0.0 lib/standby/transaction.rb