Module: Matchy

Defined in:
lib/matchy.rb,
lib/matchy/modals.rb,
lib/matchy/version.rb,
lib/matchy/def_matcher.rb,
lib/matchy/matcher_builder.rb,
lib/matchy/expectation_builder.rb,
lib/matchy/built_in/error_expectations.rb,
lib/matchy/built_in/truth_expectations.rb,
lib/matchy/built_in/change_expectations.rb,
lib/matchy/built_in/operator_expectations.rb,
lib/matchy/built_in/enumerable_expectations.rb

Overview

Matchy should work with either test/unit or minitest

Defined Under Namespace

Modules: DefMatcher, ExpectationBuilder, Expectations, MatcherBuilder, Modals, VERSION

Class Method Summary collapse

Class Method Details

.assertions_moduleObject



16
17
18
# File 'lib/matchy.rb', line 16

def self.assertions_module
  minitest? ? MiniTest::Assertions : Test::Unit::Assertions
end

.minitest?Boolean

Returns:

  • (Boolean)


7
8
9
10
11
12
13
14
15
# File 'lib/matchy.rb', line 7

def self.minitest?
  # This needs to be better.
  # How can we decide if we really have a 
  # suite of MiniTest Tests?
  # Rails for example defines MiniTest, so only check for
  # defined?(MiniTest) would be malicious
  defined?(MiniTest) && defined?(MiniTest::Assertions) && 
      (!defined?(Test::Unit::TestCase) || !(Test::Unit::TestCase < MiniTest::Assertions))
end

.test_case_classObject



19
20
21
# File 'lib/matchy.rb', line 19

def self.test_case_class
  minitest? ? MiniTest::Unit::TestCase : Test::Unit::TestCase
end