Class: FunWith::Gems::TestCaseExtender
- Inherits:
-
Object
- Object
- FunWith::Gems::TestCaseExtender
- Defined in:
- lib/fun_with/gems/test_case_extender.rb
Overview
If the gem has a ::Testing::TestCaseExtensions module, (<GEM_ROOT>/lib/<GEM_NAME>/testing/test_case_extensions.rb) include the module in FunWith::Testing::TestCase
Best practice: reserve the TestCaseExtensions module for methods that you want to be available to any gem that includes the gem being extended.
Class Method Summary collapse
Instance Method Summary collapse
-
#extend_test_case(gem_const, test_case_class = nil) ⇒ Object
If the caller doesn't specify a class to be extended, assumes the target is FunWith::Testing::TestCase.
Class Method Details
.extend_test_case(*args, &block) ⇒ Object
9 10 11 |
# File 'lib/fun_with/gems/test_case_extender.rb', line 9 def self.extend_test_case( *args, &block ) self.new.extend_test_case( *args, &block ) end |
Instance Method Details
#extend_test_case(gem_const, test_case_class = nil) ⇒ Object
If the caller doesn't specify a class to be extended, assumes the target is FunWith::Testing::TestCase
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/fun_with/gems/test_case_extender.rb', line 15 def extend_test_case( gem_const, test_case_class = nil ) if test_case_class.nil? return false unless defined?( FunWith::Testing::TestCase ) test_case_class = FunWith::Testing::TestCase end if defined?( gem_const::Testing::TestCaseExtensions ) test_case_class.extend( gem_const::Testing::TestCaseExtensions ) end end |