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



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

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
# File 'lib/shoulda/context/test_framework_detection.rb', line 4

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

.resolve_framework(future_framework) ⇒ Object



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

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

.test_framework_test_casesObject



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

def self.test_framework_test_cases
  @_test_framework_test_cases ||= detected_test_framework_test_cases
end