Module: Shoulda::Context::TestFrameworkDetection

Defined in:
lib/shoulda/context/test_framework_detection.rb

Class Method Summary collapse

Class Method Details

.detected_test_framework_test_casesObject



19
20
21
22
23
# File 'lib/shoulda/context/test_framework_detection.rb', line 19

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

.possible_test_frameworksObject



4
5
6
7
8
9
10
11
# File 'lib/shoulda/context/test_framework_detection.rb', line 4

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

.resolve_framework(future_framework) ⇒ Object



13
14
15
16
17
# File 'lib/shoulda/context/test_framework_detection.rb', line 13

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

.test_framework_test_casesObject



25
26
27
# File 'lib/shoulda/context/test_framework_detection.rb', line 25

def self.test_framework_test_cases
  @_test_framework_test_case ||= detected_test_framework_test_cases
end