Class: RSpectacles::Formatter::Redis

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

Direct Known Subclasses

BatchedRedis

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(_) ⇒ Redis

Returns a new instance of Redis.



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

def initialize(_)
end

Instance Attribute Details

#outputObject (readonly)

Returns the value of attribute output.



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

def output
  @output
end

Instance Method Details

#configObject



50
51
52
# File 'lib/rspectacles/formatter/redis.rb', line 50

def config
  RSpectacles.config
end

#current_run_keyObject



46
47
48
# File 'lib/rspectacles/formatter/redis.rb', line 46

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

#example_failed(notification) ⇒ Object



42
43
44
# File 'lib/rspectacles/formatter/redis.rb', line 42

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

#example_passed(notification) ⇒ Object



34
35
36
# File 'lib/rspectacles/formatter/redis.rb', line 34

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

#example_pending(notification) ⇒ Object



38
39
40
# File 'lib/rspectacles/formatter/redis.rb', line 38

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

#loggerObject



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

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

#message(notification) ⇒ Object



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

def message(notification)
  logger.message notification.message
end

#start(_) ⇒ Object



26
27
28
# File 'lib/rspectacles/formatter/redis.rb', line 26

def start(_)
  logger.start
end

#stop(_) ⇒ Object



30
31
32
# File 'lib/rspectacles/formatter/redis.rb', line 30

def stop(_)
  logger.stop
end