Class: RSpectacles::Formatter::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/rspectacles/formatter/base.rb

Direct Known Subclasses

Batched

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(_) ⇒ Base

Returns a new instance of Base.



15
16
# File 'lib/rspectacles/formatter/base.rb', line 15

def initialize(_)
end

Instance Attribute Details

#outputObject (readonly)

Returns the value of attribute output.



13
14
15
# File 'lib/rspectacles/formatter/base.rb', line 13

def output
  @output
end

Instance Method Details

#configObject



49
50
51
# File 'lib/rspectacles/formatter/base.rb', line 49

def config
  RSpectacles.config
end

#current_run_keyObject



45
46
47
# File 'lib/rspectacles/formatter/base.rb', line 45

def current_run_key
  ENV['CURRENT_RSPEC_RUN'] || config.last_run_primary_key
end

#example_failed(notification) ⇒ Object



41
42
43
# File 'lib/rspectacles/formatter/base.rb', line 41

def example_failed(notification)
  logger.log notification.example
end

#example_passed(notification) ⇒ Object



33
34
35
# File 'lib/rspectacles/formatter/base.rb', line 33

def example_passed(notification)
  logger.log notification.example
end

#example_pending(notification) ⇒ Object



37
38
39
# File 'lib/rspectacles/formatter/base.rb', line 37

def example_pending(notification)
  logger.log notification.example
end

#loggerObject



18
19
20
# File 'lib/rspectacles/formatter/base.rb', line 18

def logger
  @logger ||= RSpectacles::Adapter::Logger.new(test_run_key: current_run_key)
end

#message(notification) ⇒ Object



22
23
# File 'lib/rspectacles/formatter/base.rb', line 22

def message(notification)
end

#start(_) ⇒ Object



25
26
27
# File 'lib/rspectacles/formatter/base.rb', line 25

def start(_)
  logger.start
end

#stop(_) ⇒ Object



29
30
31
# File 'lib/rspectacles/formatter/base.rb', line 29

def stop(_)
  logger.stop
end