Module: Ruptr

Defined in:
lib/ruptr/tap.rb,
lib/ruptr/main.rb,
lib/ruptr/sink.rb,
lib/ruptr/plain.rb,
lib/ruptr/rspec.rb,
lib/ruptr/suite.rb,
lib/ruptr/utils.rb,
lib/ruptr/compat.rb,
lib/ruptr/report.rb,
lib/ruptr/result.rb,
lib/ruptr/runner.rb,
lib/ruptr/autorun.rb,
lib/ruptr/tabular.rb,
lib/ruptr/adapters.rb,
lib/ruptr/instance.rb,
lib/ruptr/minitest.rb,
lib/ruptr/progress.rb,
lib/ruptr/testunit.rb,
lib/ruptr/formatter.rb,
lib/ruptr/rake_task.rb,
lib/ruptr/assertions.rb,
lib/ruptr/exceptions.rb,
lib/ruptr/tty_colors.rb,
lib/ruptr/adapters/rr.rb,
lib/ruptr/stringified.rb,
lib/ruptr/timing_cache.rb,
lib/ruptr/golden_master.rb,
lib/ruptr/capture_output.rb,
lib/ruptr/adapters/assertions.rb,
lib/ruptr/rspec/configuration.rb,
lib/ruptr/rspec/example_group.rb,
lib/ruptr/surrogate_exception.rb,
lib/ruptr/adapters/rspec_mocks.rb,
lib/ruptr/adapters/rspec_expect.rb

Defined Under Namespace

Modules: Adapters, AssertionErrorMixin, Assertions, PendingPassedMixin, PendingSkippedMixin, SaveMessageAsReason, Sink, SkippedExceptionMixin, TestInstance Classes: AssertionError, CaptureOutput, Compat, Context, Formatter, GoldenMaster, Main, PendingPassedError, PendingSkippedException, Progress, RakeTask, Report, Runner, SkippedException, Stringified, SurrogateException, TTYColors, TestCase, TestElement, TestGroup, TestResult, TestSuite, TimingCache

Constant Summary collapse

PASSTHROUGH_EXCEPTIONS =
[NoMemoryError, SignalException, SystemExit].freeze

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.passthrough_exceptionsObject

Returns the value of attribute passthrough_exceptions.



42
43
44
# File 'lib/ruptr/exceptions.rb', line 42

def passthrough_exceptions
  @passthrough_exceptions
end

Class Method Details

.at_normal_exitObject



26
27
28
# File 'lib/ruptr/utils.rb', line 26

def at_normal_exit
  at_exit { yield if $!.nil? || ($!.is_a?(SystemExit) && $!.success?) }
end

.fork_piped_workerObject



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/ruptr/utils.rb', line 30

def fork_piped_worker
  child_read_io, parent_write_io = IO.pipe
  begin
    parent_read_io, child_write_io = IO.pipe
  rescue
    child_read_io.close
    parent_write_io.close
    raise
  end
  begin
    begin
      pid = Process.fork do
        parent_read_io.close
        parent_write_io.close
        yield child_read_io, child_write_io
      end
    ensure
      child_read_io.close
      child_write_io.close
    end
  rescue
    parent_read_io.close
    parent_write_io.close
    raise
  end
  [pid, parent_read_io, parent_write_io]
end

.measure_processor_and_real_timeObject



20
21
22
23
24
# File 'lib/ruptr/utils.rb', line 20

def measure_processor_and_real_time(&)
  p = nil
  t = measure_real_time { p = measure_processor_time(&) }
  p << t
end

.measure_processor_timeObject



12
13
14
15
16
17
18
# File 'lib/ruptr/utils.rb', line 12

def measure_processor_time
  t = Process.times
  yield
  tt = Process.times
  [(tt.utime + tt.cutime) - (t.utime + t.cutime),
   (tt.stime + tt.cstime) - (t.stime + t.cstime)]
end

.measure_real_timeObject



6
7
8
9
10
# File 'lib/ruptr/utils.rb', line 6

def measure_real_time
  t = Time.now
  yield
  Time.now - t
end