Module CoreEx::EmbeddedTests
In: lib/core_ex/embedded_tests.rb

Methods

Public Instance methods

[Source]

# File lib/core_ex/embedded_tests.rb, line 15
    def embedded_test_mode ( aRegexp )
      raise 'No block needed' if block_given?
      require 'test/unit'
      @@embedded_test_mode = aRegexp
    end

[Source]

# File lib/core_ex/embedded_tests.rb, line 21
    def embedded_test_mode?
      !! @@embedded_test_mode
    end

[Source]

# File lib/core_ex/embedded_tests.rb, line 35
    def run_embedded_test_sections
      @@embedded_test_blocks.each do |block|
        Kernel.instance_eval(&block)
      end
    end

[Source]

# File lib/core_ex/embedded_tests.rb, line 25
    def test_section ( __file__, &block )
      __file__ = ::Pathname.new(__file__).expand_path
      if block_given? and __file__.to_s =~ @@embedded_test_mode
        unless @@embedded_test_files.include?(__file__)
          @@embedded_test_blocks << block
          @@embedded_test_files << __file__
        end
      end
    end

[Validate]