Class: Test::Unit::TestCase

Inherits:
Object
  • Object
show all
Defined in:
lib/orb/drivers/test-unit.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.orb!Object



4
5
6
7
# File 'lib/orb/drivers/test-unit.rb', line 4

def self.orb!
  source_location = caller[0]
  define_method("test_orb_#{rand 100000}") { orb!(self, source_location) }
end

Instance Method Details

#orb!(ctx, source_location = caller[0]) ⇒ Object



9
10
11
# File 'lib/orb/drivers/test-unit.rb', line 9

def orb!(ctx, source_location = caller[0])
  with_immediate_asserts(ctx) { Orb::Runner.new(ctx, source_location).run }
end

#with_immediate_asserts(ctx) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/orb/drivers/test-unit.rb', line 13

def with_immediate_asserts(ctx)
  class << self
    alias_method :_original_wrap_assertion, :_wrap_assertion
    def _wrap_assertion ; yield ; end
  end

  yield

  class << self
    alias_method :_wrap_assertion, :_original_wrap_assertion
  end
end