Class: RSpectacles::RedisFormatter
- Inherits:
-
RSpec::Core::Formatters::BaseFormatter
- Object
- RSpec::Core::Formatters::BaseFormatter
- RSpectacles::RedisFormatter
- Defined in:
- lib/rspectacles/redis_formatter.rb
Instance Attribute Summary collapse
-
#redis ⇒ Object
Returns the value of attribute redis.
Class Method Summary collapse
Instance Method Summary collapse
- #close ⇒ Object
- #example_failed(example) ⇒ Object
- #example_passed(example) ⇒ Object
- #example_pending(example) ⇒ Object
- #example_started(example) ⇒ Object
-
#initialize(output) ⇒ RedisFormatter
constructor
A new instance of RedisFormatter.
- #message(message) ⇒ Object
- #start(example_count) ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(output) ⇒ RedisFormatter
Returns a new instance of RedisFormatter.
21 22 23 |
# File 'lib/rspectacles/redis_formatter.rb', line 21 def initialize(output) self.redis = Redis.new host: config.host, port: config.port end |
Instance Attribute Details
#redis ⇒ Object
Returns the value of attribute redis.
7 8 9 |
# File 'lib/rspectacles/redis_formatter.rb', line 7 def redis @redis end |
Class Method Details
.config ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/rspectacles/redis_formatter.rb', line 10 def config OpenStruct.new({ channel_name: 'redis-rspec-examples', last_run_key: 'redis-rspec-last-run', port: 6379, host: '127.0.0.1', password: '' }) end |
Instance Method Details
#close ⇒ Object
53 54 |
# File 'lib/rspectacles/redis_formatter.rb', line 53 def close end |
#example_failed(example) ⇒ Object
49 50 51 |
# File 'lib/rspectacles/redis_formatter.rb', line 49 def example_failed(example) log_formatted example end |
#example_passed(example) ⇒ Object
41 42 43 |
# File 'lib/rspectacles/redis_formatter.rb', line 41 def example_passed(example) log_formatted example end |
#example_pending(example) ⇒ Object
45 46 47 |
# File 'lib/rspectacles/redis_formatter.rb', line 45 def example_pending(example) log_formatted example end |
#example_started(example) ⇒ Object
38 39 |
# File 'lib/rspectacles/redis_formatter.rb', line 38 def example_started(example) end |
#message(message) ⇒ Object
25 26 27 |
# File 'lib/rspectacles/redis_formatter.rb', line 25 def () log "message:#{}" end |
#start(example_count) ⇒ Object
29 30 31 32 |
# File 'lib/rspectacles/redis_formatter.rb', line 29 def start(example_count) log 'status:start' redis.del config.last_run_key end |
#stop ⇒ Object
34 35 36 |
# File 'lib/rspectacles/redis_formatter.rb', line 34 def stop log 'status:stop' end |