Class: RSpec::Core::Reporter
Instance Method Summary collapse
- #conclude ⇒ Object (also: #abort)
- #example_failed(example) ⇒ Object
- #example_group_finished(group) ⇒ Object
- #example_group_started(group) ⇒ Object
- #example_passed(example) ⇒ Object
- #example_pending(example) ⇒ Object
- #example_started(example) ⇒ Object
-
#initialize(*formatters) ⇒ Reporter
constructor
A new instance of Reporter.
- #message(message) ⇒ Object
- #notify(method, *args, &block) ⇒ Object
- #report(count) ⇒ Object
- #start(expected_example_count) ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(*formatters) ⇒ Reporter
Returns a new instance of Reporter.
3 4 5 6 |
# File 'lib/rspec/core/reporter.rb', line 3 def initialize(*formatters) @formatters = formatters @example_count = @failure_count = @pending_count = 0 end |
Instance Method Details
#conclude ⇒ Object Also known as: abort
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/rspec/core/reporter.rb', line 17 def conclude begin stop notify :start_dump notify :dump_pending notify :dump_failures notify :dump_summary, @duration, @example_count, @failure_count, @pending_count ensure notify :close end end |
#example_failed(example) ⇒ Object
57 58 59 60 |
# File 'lib/rspec/core/reporter.rb', line 57 def example_failed(example) @failure_count += 1 notify :example_failed, example end |
#example_group_finished(group) ⇒ Object
44 45 46 |
# File 'lib/rspec/core/reporter.rb', line 44 def example_group_finished(group) notify :example_group_finished, group end |
#example_group_started(group) ⇒ Object
40 41 42 |
# File 'lib/rspec/core/reporter.rb', line 40 def example_group_started(group) notify :example_group_started, group end |
#example_passed(example) ⇒ Object
53 54 55 |
# File 'lib/rspec/core/reporter.rb', line 53 def example_passed(example) notify :example_passed, example end |
#example_pending(example) ⇒ Object
62 63 64 65 |
# File 'lib/rspec/core/reporter.rb', line 62 def example_pending(example) @pending_count += 1 notify :example_pending, example end |
#example_started(example) ⇒ Object
48 49 50 51 |
# File 'lib/rspec/core/reporter.rb', line 48 def example_started(example) @example_count += 1 notify :example_started, example end |
#message(message) ⇒ Object
36 37 38 |
# File 'lib/rspec/core/reporter.rb', line 36 def () notify :message, end |
#notify(method, *args, &block) ⇒ Object
72 73 74 75 76 |
# File 'lib/rspec/core/reporter.rb', line 72 def notify(method, *args, &block) @formatters.each do |formatter| formatter.send method, *args, &block end end |
#report(count) ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/rspec/core/reporter.rb', line 8 def report(count) start(count) begin yield self ensure conclude end end |
#start(expected_example_count) ⇒ Object
31 32 33 34 |
# File 'lib/rspec/core/reporter.rb', line 31 def start(expected_example_count) @start = Time.now notify :start, expected_example_count end |
#stop ⇒ Object
67 68 69 70 |
# File 'lib/rspec/core/reporter.rb', line 67 def stop @duration = Time.now - @start if @start notify :stop end |