system_health 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e78f51abf03cfdffbebd745cf917c4748067d004
4
- data.tar.gz: 737041933033b81696120104e36edb608810000d
3
+ metadata.gz: 61557da12d3434f06f3cc064725f5c3fb213a596
4
+ data.tar.gz: 9630711018c0dab370b11fe09fcb735ba533ab3f
5
5
  SHA512:
6
- metadata.gz: 48fa4de8e062792ea46fe321404d92a8bf3c9cc21b77171183f698334a53a7c8237808100b117ea0b90e0d054d725c923beb4fc6337418672f010947aa0f0f6c
7
- data.tar.gz: 18d115df03d603bda683eaa8cd97e0bd053a98843c15848a08583549376a391cf3a51a98a2985cf825c79be7136430a686dc5cc7b8dd4ccab0c0dca151d9ea80
6
+ metadata.gz: 35b4571bbd24f24c02929ae2506be6effe2b4349d1b5116549b0bc12605068512c643878fe170335f90cf965cd11d632d19882a46952ba52feaecbbff9e49e49
7
+ data.tar.gz: 4ca8cb67802d6e9327c2014940e01cc93a37e5184eb161fac3b837e3a15a1ee08a6ebbd8d192fe29440d356b826244dce67193cbe9e51397f8354635f1a8508a
@@ -1,9 +1,26 @@
1
1
  module SystemHealth
2
2
  module Monitors
3
3
  class Base
4
+ attr_reader :error_messages
5
+
6
+ def initialize
7
+ @error_messages = []
8
+ add_error_messages
9
+ end
10
+
4
11
  def error_count
5
12
  error_messages.count
6
13
  end
14
+
15
+ private
16
+
17
+ def add_error_messages
18
+ raise
19
+ end
20
+
21
+ def add_error_message(message)
22
+ error_messaages << message
23
+ end
7
24
  end
8
25
  end
9
26
  end
@@ -1,3 +1,3 @@
1
1
  module SystemHealth
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -5,16 +5,16 @@ require_relative '../../../lib/system_health/monitors/base'
5
5
  module SystemHealth
6
6
  describe Monitor do
7
7
 
8
- class MonitorDouble < Monitors::Base
9
- def error_messages
10
- []
8
+ context 'when errors' do
9
+ class MonitorDouble < Monitors::Base
10
+ def add_error_messages
11
+ add_error_message('hello')
12
+ end
11
13
  end
12
- end
13
14
 
14
- let(:monitor_classes) { [MonitorDouble] }
15
- let(:monitor) { described_class.new(monitor_classes) }
15
+ let(:monitor_classes) { [MonitorDouble] }
16
+ let(:monitor) { described_class.new(monitor_classes) }
16
17
 
17
- context 'when errors' do
18
18
  before do
19
19
  allow_any_instance_of(MonitorDouble).
20
20
  to receive(:error_messages).
@@ -35,6 +35,14 @@ module SystemHealth
35
35
  end
36
36
 
37
37
  context 'when no errors' do
38
+ class MonitorDouble < Monitors::Base
39
+ def add_error_messages
40
+ end
41
+ end
42
+
43
+ let(:monitor_classes) { [MonitorDouble] }
44
+ let(:monitor) { described_class.new(monitor_classes) }
45
+
38
46
  describe '#error_count' do
39
47
  it 'returns error count' do
40
48
  expect(monitor.error_count).to eq(0)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: system_health
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stirling Olson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-23 00:00:00.000000000 Z
11
+ date: 2016-12-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails