Class: Buildr::TestFramework::TestResult::RSpecResultHandler
- Inherits:
-
Object
- Object
- Buildr::TestFramework::TestResult::RSpecResultHandler
show all
- Defined in:
- lib/buildr/java/test_result.rb
Overview
A JtestR ResultHandler Using this handler we can use RSpec formatters, like html/ci_reporter with JtestR Created for YamlFormatter
Defined Under Namespace
Modules: ExampleMethods, TestNGResultHandlerMixin
Classes: BacktraceTweaker
Class Attribute Summary collapse
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of RSpecResultHandler.
182
183
184
185
186
187
188
189
190
191
192
|
# File 'lib/buildr/java/test_result.rb', line 182
def initialize(name, desc, *args)
self.example_group = ::Spec::Example::ExampleGroup.new(desc)
example_group.extend ExampleMethods
example_group.name = name.to_s
if example_group.name[/Spec/]
example_group.description = desc.to_s
else
example_group.description = name.to_s
end
reporter.example_group_started(example_group)
end
|
Class Attribute Details
an rspec reporter used to proxy events to rspec formatters
150
151
152
|
# File 'lib/buildr/java/test_result.rb', line 150
def reporter
@reporter
end
|
.test_files ⇒ Object
Returns the value of attribute test_files.
151
152
153
|
# File 'lib/buildr/java/test_result.rb', line 151
def test_files
@test_files
end
|
Instance Attribute Details
#current_example ⇒ Object
Returns the value of attribute current_example.
180
181
182
|
# File 'lib/buildr/java/test_result.rb', line 180
def current_example
@current_example
end
|
#current_failure ⇒ Object
Returns the value of attribute current_failure.
180
181
182
|
# File 'lib/buildr/java/test_result.rb', line 180
def current_failure
@current_failure
end
|
#example_group ⇒ Object
Returns the value of attribute example_group.
180
181
182
|
# File 'lib/buildr/java/test_result.rb', line 180
def example_group
@example_group
end
|
Class Method Details
165
166
167
168
|
# File 'lib/buildr/java/test_result.rb', line 165
def after
reporter.end
reporter.dump
end
|
161
162
163
|
# File 'lib/buildr/java/test_result.rb', line 161
def before
reporter.start(reporter.options.files.size)
end
|
.init(argv = [], out = STDOUT, err = STDERR) ⇒ Object
153
154
155
156
157
158
159
|
# File 'lib/buildr/java/test_result.rb', line 153
def init(argv = [], out = STDOUT, err = STDERR)
::JtestR::TestNGResultHandler.module_eval { include TestNGResultHandlerMixin }
rspec_parser = ::Spec::Runner::OptionParser.new(err, out)
rspec_parser.order!(argv)
rspec_parser.options.backtrace_tweaker = BacktraceTweaker.new
@reporter = Spec::Runner::Reporter.new(rspec_parser.options)
end
|
Instance Method Details
#add_fault(fault) ⇒ Object
201
202
203
|
# File 'lib/buildr/java/test_result.rb', line 201
def add_fault(fault)
self.current_failure = fault
end
|
#add_pending(pending) ⇒ Object
205
206
|
# File 'lib/buildr/java/test_result.rb', line 205
def add_pending(pending)
end
|
198
199
|
# File 'lib/buildr/java/test_result.rb', line 198
def ending
end
|
#error_single(name = nil) ⇒ Object
234
235
236
237
|
# File 'lib/buildr/java/test_result.rb', line 234
def error_single(name = nil)
current_example.name = current_name
reporter.example_finished(current_example, current_error)
end
|
#fail_single(name = nil) ⇒ Object
229
230
231
232
|
# File 'lib/buildr/java/test_result.rb', line 229
def fail_single(name = nil)
current_example.name = current_name
reporter.example_finished(current_example, current_error)
end
|
#pending_single(name = nil) ⇒ Object
239
240
241
242
|
# File 'lib/buildr/java/test_result.rb', line 239
def pending_single(name = nil)
error = ::Spec::Example::ExamplePendingError.new(name)
reporter.example_finished(current_example, error)
end
|
176
177
178
|
# File 'lib/buildr/java/test_result.rb', line 176
def reporter
self.class.reporter
end
|
195
196
|
# File 'lib/buildr/java/test_result.rb', line 195
def starting
end
|
#starting_single(name = nil) ⇒ Object
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
|
# File 'lib/buildr/java/test_result.rb', line 208
def starting_single(name = nil)
self.current_failure = nil
self.current_example = Object.new
current_example.extend ::Spec::Example::ExampleMethods
current_example.extend ExampleMethods
name = name.to_s
current_example.location = name.to_s
current_example.name = name.gsub(/(.*)\((.+)\)/, '\2')
current_example.description = name
if example_group.name[/Spec/]
current_example.__full_description = "#{example_group.description} #{name}"
else
current_example.__full_description = "#{example_group.name}: #{name}"
end
reporter.example_started(current_example)
end
|
#succeed_single(name = nil) ⇒ Object
225
226
227
|
# File 'lib/buildr/java/test_result.rb', line 225
def succeed_single(name = nil)
reporter.example_finished(current_example, nil)
end
|