Module: RunningMan
- Defined in:
- lib/running_man.rb,
lib/running_man/block.rb,
lib/running_man/active_record_block.rb
Defined Under Namespace
Classes: ActiveRecordBlock, Block
Constant Summary collapse
- VERSION =
'0.4.0'
Class Method Summary collapse
-
.setup_on(source, *klasses) ⇒ Object
Public: Sets up any helper class methods in TestClassMethods on the specified test case class.
Class Method Details
.setup_on(source, *klasses) ⇒ Object
Public: Sets up any helper class methods in TestClassMethods on the specified test case class.
Examples
# extends test/unit with RunningMan::Block::TestClassMethods
RunningMan::Block.setup_on Test::Unit::TestCase
# extends ActiveSupport::TestCase
RunningMan::Block.setup_on ActiveSupport::TestCase
# extends test/unit with RunningMan::Block::TestClassMethods and
# RunningMan::FooBlock::TestClassMethods
RunningMan::Block.setup_on Test::Unit::TestCase, :FooBlock
# extends test/unit with RunningMan::Block::TestClassMethods and
# MyBlock::TestClassMethods
RunningMan::Block.setup_on Test::Unit::TestCase, MyBlock
source - The class to extend. Usually Test::Unit::TestCase. *klasses - Optional Array of RunningMan::Block subclasses or Symbols.
Returns nothing.
29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/running_man.rb', line 29 def self.setup_on(source, *klasses) klasses.unshift(Block) klasses.uniq! klasses.each do |klass| if klass.is_a?(Symbol) klass = RunningMan.const_get(klass) end if klass.const_defined?(:TestClassMethods) source.extend klass.const_get(:TestClassMethods) end end end |