/
testrunner.rb
53 lines (45 loc) · 1.16 KB
/
testrunner.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
require 'test/unit/ui/testrunnerutilities'
module Test
module Unit
module UI
class TestRunner
extend TestRunnerUtilities
attr_reader :listeners
def initialize(suite, options={})
if suite.respond_to?(:suite)
@suite = suite.suite
else
@suite = suite
end
@options = options
@listeners = @options[:listeners] || []
end
# Begins the test run.
def start
setup_mediator
attach_to_mediator
attach_listeners
start_mediator
end
private
def setup_mediator
@mediator = TestRunnerMediator.new(@suite)
end
def attach_listeners
@listeners.each do |listener|
listener.attach_to_mediator(@mediator)
end
end
def start_mediator
@mediator.run
end
def diff_target_string?(string)
Assertions::AssertionMessage.diff_target_string?(string)
end
def prepare_for_diff(from, to)
Assertions::AssertionMessage.prepare_for_diff(from, to)
end
end
end
end
end