Sha256: dc79dd4da158435ce08d862b006a1e351fc3e5ca44e35e6c1e30a38b893c874a

Contents?: true

Size: 966 Bytes

Versions: 6

Compression:

Stored size: 966 Bytes

Contents

module Shoulda
  module Matchers
    # @private
    module Integrations
      # @private
      module NUnitTestCaseDetection
        def self.possible_test_case_constants
          [
            -> { ActiveSupport::TestCase },
            -> { Minitest::Test },
            -> { MiniTest::Unit::TestCase },
            -> { Test::Unit::TestCase }
          ]
        end

        def self.resolve_constant(future_constant)
          future_constant.call
        rescue NameError
          nil
        end

        def self.detected_test_case_constants
          possible_test_case_constants.
            map { |future_constant| resolve_constant(future_constant) }.
            compact
        end

        def self.test_case_constants
          @_test_case_constants ||= detected_test_case_constants
        end
      end
    end

    # @private
    def self.nunit_test_case_constants
      Integrations::NUnitTestCaseDetection.test_case_constants
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/shoulda-matchers-2.8.0/lib/shoulda/matchers/integrations/nunit_test_case_detection.rb
shoulda-matchers-2.8.0 lib/shoulda/matchers/integrations/nunit_test_case_detection.rb
shoulda-matchers-2.8.0.rc2 lib/shoulda/matchers/integrations/nunit_test_case_detection.rb
shoulda-matchers-2.8.0.rc1 lib/shoulda/matchers/integrations/nunit_test_case_detection.rb
shoulda-matchers-2.7.0 lib/shoulda/matchers/integrations/nunit_test_case_detection.rb
shoulda-matchers-2.6.2 lib/shoulda/matchers/integrations/nunit_test_case_detection.rb