Module: FunWith::Gems::Testing::TestCaseExtensions

Defined in:
lib/fun_with/gems/testing/test_case_extensions.rb

Overview

Extensions to the FunWith::Testing::TestCase class.

Instance Method Summary collapse

Instance Method Details

#install_gem_assertionsObject



21
22
23
# File 'lib/fun_with/gems/testing/test_case_extensions.rb', line 21

def install_gem_assertions
  include FunWith::Gems::Testing::Assertions
end

#install_yet_more_assertions(testable_gem) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/fun_with/gems/testing/test_case_extensions.rb', line 25

def install_yet_more_assertions( testable_gem )
  if testable_gem.respond_to?( :root )
    f = testable_gem.root( :test, "assertions.rb" )
    
    require f if f.file?
  end
  
  if defined?( testable_gem::Testing::Assertions )
    
  end
end

#make_testing_fun(testable_gem, config = {}) ⇒ Object

config options :factory_bot => true : load FactoryBot factory definitions from the places FactoryBot expects them to live. :include => true : include the namespace of the gem being tested.



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/fun_with/gems/testing/test_case_extensions.rb', line 9

def make_testing_fun( testable_gem, config = {} )
  include GemToTestMethods
  install_basic_assertions           # The assertions included by FunWith::Testing
  install_gem_assertions             # The assertions included by FunWith::Gems
  install_yet_more_assertions( testable_gem )
  
  self.gem_to_test = testable_gem

  self.add_factorybot_support if config[:factory_bot] == true
  self.send( :include, self.gem_to_test ) if config[:include] == true
end