Class: Everqueen::Runner
- Inherits:
-
Object
show all
- Defined in:
- lib/everqueen/runner.rb
Defined Under Namespace
Classes: Example, TestRunner
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(io = STDOUT) ⇒ Runner
Returns a new instance of Runner.
91
92
93
|
# File 'lib/everqueen/runner.rb', line 91
def initialize(io=STDOUT)
@io = io
end
|
Instance Attribute Details
#io ⇒ Object
Returns the value of attribute io.
89
90
91
|
# File 'lib/everqueen/runner.rb', line 89
def io
@io
end
|
#suite ⇒ Object
Returns the value of attribute suite.
89
90
91
|
# File 'lib/everqueen/runner.rb', line 89
def suite
@suite
end
|
Instance Method Details
#dots ⇒ Object
128
129
130
|
# File 'lib/everqueen/runner.rb', line 128
def dots
test_runners.map { |test_runner| test_runner.dots }.join
end
|
#examples ⇒ Object
116
117
118
|
# File 'lib/everqueen/runner.rb', line 116
def examples
test_runners.map { |test_runner| test_runner.examples }.flatten
end
|
#failed_examples ⇒ Object
120
121
122
|
# File 'lib/everqueen/runner.rb', line 120
def failed_examples
examples.select { |example| not example.passed? }
end
|
#failure_messages ⇒ Object
132
133
134
135
136
|
# File 'lib/everqueen/runner.rb', line 132
def failure_messages
unless passed?
test_runners.map { |test_runner| test_runner.failure_messages }.compact.join("\n\n")
end
end
|
#passed? ⇒ Boolean
124
125
126
|
# File 'lib/everqueen/runner.rb', line 124
def passed?
test_runners.all? { |test_runner| test_runner.passed? }
end
|
#run ⇒ Object
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
# File 'lib/everqueen/runner.rb', line 99
def run
before = Time.now
io.puts ""
io.puts dots.to_s
io.puts ""
if failure_messages
io.puts failure_messages
io.puts ""
end
seconds = "%.2f" % (Time.now - before)
io.puts "Finished in #{seconds} seconds"
io.puts "#{examples.size} assertions, #{failed_examples.size} failures"
passed?
end
|
#test_runner(test) ⇒ Object
95
96
97
|
# File 'lib/everqueen/runner.rb', line 95
def test_runner(test)
TestRunner.new(self, test)
end
|