Sha256: 1a16f630627207ac856187966c17ae3a5f5f687669c7e236e159cd47c7120e96

Contents?: true

Size: 869 Bytes

Versions: 3

Compression:

Stored size: 869 Bytes

Contents

module Shoulda
  module Context
    module TestFrameworkDetection
      def self.possible_test_frameworks
        [
          lambda { ActiveSupport::TestCase },
          lambda { Minitest::Test },
          lambda { MiniTest::Unit::TestCase },
          lambda { Test::Unit::TestCase }
        ]
      end

      def self.resolve_framework(future_framework)
        future_framework.call
      rescue NameError
        nil
      end

      def self.detected_test_framework_test_cases
        possible_test_frameworks.
          map { |future_framework| resolve_framework(future_framework) }.
          compact
      end

      def self.test_framework_test_cases
        @_test_framework_test_case ||= detected_test_framework_test_cases
      end
    end

    def self.test_framework_test_cases
      TestFrameworkDetection.test_framework_test_cases
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
shoulda-context-1.2.2 lib/shoulda/context/test_framework_detection.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/shoulda-context-1.2.1/lib/shoulda/context/test_framework_detection.rb
shoulda-context-1.2.1 lib/shoulda/context/test_framework_detection.rb