Class: Guard::RSpectacle::Notifier

Inherits:
RSpec::Core::Formatters::BaseFormatter
  • Object
show all
Defined in:
lib/guard/rspectacle/notifier.rb

Overview

Simple RSpec formatter that just stores the last spec run result at class level.

Class Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(output) ⇒ Notifier

Returns a new instance of Notifier.



20
21
22
23
# File 'lib/guard/rspectacle/notifier.rb', line 20

def initialize(output)
  super
  @passed_examples = []
end

Class Attribute Details

.durationObject

Returns the value of attribute duration.



12
13
14
# File 'lib/guard/rspectacle/notifier.rb', line 12

def duration
  @duration
end

.example_countObject

Returns the value of attribute example_count.



13
14
15
# File 'lib/guard/rspectacle/notifier.rb', line 13

def example_count
  @example_count
end

.failed_specsObject

Returns the value of attribute failed_specs.



16
17
18
# File 'lib/guard/rspectacle/notifier.rb', line 16

def failed_specs
  @failed_specs
end

.failure_countObject

Returns the value of attribute failure_count.



14
15
16
# File 'lib/guard/rspectacle/notifier.rb', line 14

def failure_count
  @failure_count
end

.passed_specsObject

Returns the value of attribute passed_specs.



17
18
19
# File 'lib/guard/rspectacle/notifier.rb', line 17

def passed_specs
  @passed_specs
end

.pending_countObject

Returns the value of attribute pending_count.



15
16
17
# File 'lib/guard/rspectacle/notifier.rb', line 15

def pending_count
  @pending_count
end

Instance Method Details

#dump_summary(duration, example_count, failure_count, pending_count) ⇒ Object



29
30
31
32
33
34
35
36
# File 'lib/guard/rspectacle/notifier.rb', line 29

def dump_summary(duration, example_count, failure_count, pending_count)
  ::Guard::RSpectacle::Notifier.duration      = duration
  ::Guard::RSpectacle::Notifier.example_count = example_count
  ::Guard::RSpectacle::Notifier.failure_count = failure_count
  ::Guard::RSpectacle::Notifier.pending_count = pending_count
  ::Guard::RSpectacle::Notifier.failed_specs  = @failed_examples.map { |example| example.file_path }.uniq
  ::Guard::RSpectacle::Notifier.passed_specs  = @passed_examples.map { |example| example.file_path }.uniq
end

#example_passed(example) ⇒ Object



25
26
27
# File 'lib/guard/rspectacle/notifier.rb', line 25

def example_passed(example)
  @passed_examples << example
end