status_cat 0.1.1 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +15 -11
  3. data/app/controllers/status_cat/status_controller.rb +19 -18
  4. data/app/helpers/status_cat/status_helper.rb +69 -64
  5. data/app/mailers/status_cat/status_mailer.rb +9 -8
  6. data/app/views/status_cat/status/index.html.erb +1 -1
  7. data/app/views/status_cat/status_mailer/failure.html.erb +1 -1
  8. data/app/views/status_cat/status_mailer/failure.text.erb +1 -1
  9. data/lib/status_cat.rb +1 -1
  10. data/lib/status_cat/checkers/action_mailer.rb +33 -17
  11. data/lib/status_cat/checkers/active_record.rb +22 -7
  12. data/lib/status_cat/checkers/base.rb +16 -9
  13. data/lib/status_cat/checkers/delayed_job.rb +21 -16
  14. data/lib/status_cat/checkers/fitbit.rb +18 -9
  15. data/lib/status_cat/checkers/profilesio.rb +4 -1
  16. data/lib/status_cat/checkers/s3.rb +9 -10
  17. data/lib/status_cat/checkers/send_hub.rb +9 -3
  18. data/lib/status_cat/checkers/stripe.rb +15 -10
  19. data/lib/status_cat/checkers/twilio.rb +10 -4
  20. data/lib/status_cat/config.rb +3 -7
  21. data/lib/status_cat/status.rb +9 -11
  22. data/lib/status_cat/version.rb +1 -1
  23. data/lib/tasks/status_cat.rake +3 -4
  24. data/spec/controllers/status_cat/status_controller_spec.rb +9 -9
  25. data/spec/dummy/app/checkers/dummy.rb +2 -2
  26. data/spec/dummy/app/controllers/application_controller.rb +2 -1
  27. data/spec/dummy/app/controllers/root_controller.rb +6 -7
  28. data/spec/dummy/config.ru +1 -1
  29. data/spec/dummy/config/application.rb +2 -2
  30. data/spec/dummy/config/environments/production.rb +1 -1
  31. data/spec/dummy/config/initializers/action_mailer.rb +2 -2
  32. data/spec/dummy/config/initializers/inflections.rb +1 -1
  33. data/spec/dummy/config/passwords.yml +5 -0
  34. data/spec/dummy/config/routes.rb +2 -2
  35. data/spec/dummy/db/development.sqlite3 +0 -0
  36. data/spec/dummy/db/schema.rb +0 -1
  37. data/spec/dummy/db/test.sqlite3 +0 -0
  38. data/spec/dummy/log/development.log +36 -0
  39. data/spec/dummy/log/test.log +16588 -13366
  40. data/spec/helpers/status_cat/status_helper_spec.rb +33 -33
  41. data/spec/hygiene_spec.rb +14 -0
  42. data/spec/lib/status_cat/checkers/action_mailer_spec.rb +15 -18
  43. data/spec/lib/status_cat/checkers/active_record_spec.rb +10 -10
  44. data/spec/lib/status_cat/checkers/base_spec.rb +30 -14
  45. data/spec/lib/status_cat/checkers/delayed_job_spec.rb +14 -16
  46. data/spec/lib/status_cat/checkers/fitbit_spec.rb +14 -8
  47. data/spec/lib/status_cat/checkers/profilesio_spec.rb +12 -12
  48. data/spec/lib/status_cat/checkers/s3_spec.rb +17 -18
  49. data/spec/lib/status_cat/checkers/send_hub_spec.rb +14 -8
  50. data/spec/lib/status_cat/checkers/stripe_spec.rb +18 -24
  51. data/spec/lib/status_cat/checkers/twilio_spec.rb +14 -8
  52. data/spec/lib/status_cat/config_spec.rb +32 -33
  53. data/spec/lib/status_cat/engine_spec.rb +2 -2
  54. data/spec/lib/status_cat/status_spec.rb +31 -32
  55. data/spec/lib/status_cat/version_spec.rb +4 -4
  56. data/spec/lib/status_cat_spec.rb +3 -3
  57. data/spec/lib/tasks/status_cat.rake_spec.rb +6 -6
  58. data/spec/mailers/status_cat/status_mailer_spec.rb +11 -12
  59. data/spec/spec_helper.rb +35 -16
  60. data/spec/support/shared/checker.rb +5 -6
  61. data/spec/views/status_cat/status/index.html.erb_spec.rb +8 -9
  62. data/spec/views/status_cat/status_mailer/failure.html.erb_spec.rb +4 -6
  63. data/spec/views/status_cat/status_mailer/failure.text.erb_spec.rb +4 -4
  64. metadata +69 -117
  65. data/spec/coverage_spec.rb +0 -20
@@ -1,24 +1,24 @@
1
1
  describe StatusCat::Checkers::Profilesio do
2
2
 
3
- let( :checker ) { StatusCat::Checkers::Profilesio.new.freeze }
4
- let( :response ) { double( "response", :code => 200 ) }
5
- let( :key ) { 'env_profilesio_key' }
3
+ let(:checker) { StatusCat::Checkers::Profilesio.new.freeze }
4
+ let(:response) { double('response', code: 200) }
5
+ let(:key) { 'env_profilesio_key' }
6
6
 
7
- before( :each ) do
8
- allow( HTTParty ).to receive( :get ).and_return( response )
9
- ENV['PROFILESIO_KEY'] = key
7
+ before(:each) do
8
+ allow(HTTParty).to receive(:get).and_return(response)
9
+ StatusCat::Checkers::Profilesio.api_key = key
10
10
  end
11
11
 
12
12
  it_should_behave_like 'a status checker'
13
13
 
14
14
  it 'sets the value' do
15
- expect( checker.value ).to eql( key )
15
+ expect(checker.value).to eql(key)
16
16
  end
17
17
 
18
18
  context 'pass' do
19
19
 
20
20
  it 'passes on connection to Profilesio' do
21
- expect( checker.status ).to be_nil
21
+ expect(checker.status).to be_nil
22
22
  end
23
23
 
24
24
  end
@@ -26,13 +26,13 @@ describe StatusCat::Checkers::Profilesio do
26
26
  context 'fail' do
27
27
 
28
28
  it 'fails if it receives a non 200 code' do
29
- expect( response ).to receive( :code ).and_return( 404 )
30
- expect( checker.status ).to_not be_nil
29
+ expect(response).to receive(:code).and_return(404)
30
+ expect(checker.status).to_not be_nil
31
31
  end
32
32
 
33
33
  it 'fails if there is an exception' do
34
- expect( response ).to receive( :code ).and_raise( 'No code for you!' )
35
- expect( checker.status ).to_not be_nil
34
+ expect(response).to receive(:code).and_raise('No code for you!')
35
+ expect(checker.status).to_not be_nil
36
36
  end
37
37
  end
38
38
  end
@@ -1,37 +1,36 @@
1
- require 'aws-sdk'
2
-
3
1
  describe StatusCat::Checkers::S3 do
4
2
 
5
- let( :checker ) { StatusCat::Checkers::S3.new.freeze }
3
+ let(:checker) { StatusCat::Checkers::S3.new.freeze }
4
+
5
+ before(:each) do
6
6
 
7
- before( :each ) do
8
- allow( AWS::S3 ).to receive( :new ).and_return( @s3 = double( AWS::S3 ) )
7
+ allow(Aws::S3::Resource).to receive(:new).and_return(@s3 = double(Aws::S3::Resource))
9
8
  end
10
9
 
11
10
  it_should_behave_like 'a status checker'
12
11
 
13
- it 'tolerates AWS being undefined' do
14
- aws = Object.send(:remove_const, :AWS)
15
- expect( checker.status ).to_not be_nil
16
- Object.const_set( :AWS, aws )
12
+ it 'tolerates the gem misssing' do
13
+ gem = Object.send(:remove_const, :Aws)
14
+ expect(checker.status).to eql('aws-sdk gem is not installed')
15
+ Object.const_set(:Aws, gem)
17
16
  end
18
17
 
19
18
  it 'uses the aws access key as the value' do
20
- expect( checker.value ).to eql( AWS.config.access_key_id )
19
+ expect(checker.value).to eql(Aws.config[:credentials].access_key_id)
21
20
  end
22
21
 
23
22
  it 'fails if there is an exception talking to S3' do
24
- expect( @s3 ).to receive( :buckets ).and_raise( 'error' )
25
- expect( checker.status ).to_not be_nil
23
+ expect(@s3).to receive(:buckets).and_raise('error')
24
+ expect(checker.status).to_not be_nil
26
25
  end
27
26
 
28
27
  it 'fails if there are no S3 buckets' do
29
- expect( @s3 ).to receive( :buckets ).and_return( [] )
30
- expect( checker.status ).to_not be_nil
31
- end
28
+ expect(@s3).to receive(:buckets).and_return([])
29
+ expect(checker.status).to_not be_nil
30
+ end
32
31
 
33
32
  it 'passes if it finds S3 buckets' do
34
- expect( @s3 ).to receive( :buckets ).and_return( [ 1 ] )
35
- expect( checker.status ).to be_nil
33
+ expect(@s3).to receive(:buckets).and_return([1])
34
+ expect(checker.status).to be_nil
36
35
  end
37
- end
36
+ end
@@ -1,33 +1,39 @@
1
1
  describe StatusCat::Checkers::SendHub do
2
2
 
3
- let( :checker ) { StatusCat::Checkers::SendHub.new.freeze }
3
+ let(:checker) { StatusCat::Checkers::SendHub.new.freeze }
4
4
 
5
5
  it_should_behave_like 'a status checker'
6
6
 
7
7
  describe '#initialize' do
8
8
 
9
+ it 'tolerates the gem misssing' do
10
+ gem = Object.send(:remove_const, :SendHub)
11
+ expect(checker.status).to eql('ruby-sendhub gem is not installed')
12
+ Object.const_set(:SendHub, gem)
13
+ end
14
+
9
15
  it 'sets the value' do
10
- expect( checker.value ).to eql( ENV[ 'SEND_HUB_NUMBER' ] )
16
+ expect(checker.value).to eql(StatusCat::Checkers::SendHub.number)
11
17
  end
12
18
 
13
19
  context 'pass' do
14
20
 
15
21
  it 'passes if it can connect to SendHub' do
16
- expect( checker.status ).to be_nil
22
+ expect(checker.status).to be_nil
17
23
  end
18
24
  end
19
25
 
20
26
  context 'fail' do
21
27
 
22
28
  it 'fails if it receives nil' do
23
- expect( @send_hub ).to receive( :get_contacts ).and_return( nil )
24
- expect( checker.status ).to_not be_nil
29
+ expect(@send_hub).to receive(:get_contacts).and_return(nil)
30
+ expect(checker.status).to_not be_nil
25
31
  end
26
32
 
27
33
  it 'fails if there is an exception' do
28
- expect( @send_hub ).to receive( :get_contacts ).and_raise( 'This is only a test' )
29
- expect( checker.status ).to_not be_nil
34
+ expect(@send_hub).to receive(:get_contacts).and_raise('This is only a test')
35
+ expect(checker.status).to_not be_nil
30
36
  end
31
37
  end
32
38
  end
33
- end
39
+ end
@@ -1,42 +1,36 @@
1
- require 'stripe'
2
-
3
1
  describe StatusCat::Checkers::Stripe do
4
2
 
5
- let( :checker ) { StatusCat::Checkers::Stripe.new.freeze }
6
- let( :email ) { 'foo@bar.com' }
7
-
8
- before( :each ) do
9
- allow( Stripe::Account ).to receive( :retrieve ).and_return( @stripe = double( Stripe::Account ) )
10
- end
3
+ let(:checker) { StatusCat::Checkers::Stripe.new.freeze }
4
+ let(:email) { 'foo@bar.com' }
11
5
 
12
6
  it_should_behave_like 'a status checker'
13
7
 
14
- it 'tolerates Stripe being undefined' do
15
- stripe = Object.send(:remove_const, :Stripe)
16
- expect( checker.status ).to_not be_nil
17
- Object.const_set( :Stripe, stripe )
8
+ it 'tolerates the gem misssing' do
9
+ gem = Object.send(:remove_const, :Stripe)
10
+ expect(checker.status).to eql('stripe gem is not installed')
11
+ Object.const_set(:Stripe, gem)
18
12
  end
19
13
 
20
14
  it 'fails if there is an exception talking to Stripe' do
21
- expect( @stripe ).to receive( :email ).and_raise( 'error' )
22
- expect( checker.status ).to_not be_nil
15
+ expect(@stripe).to receive(:email).and_raise('test error')
16
+ expect(checker.status).to_not be_nil
23
17
  end
24
18
 
25
19
  it 'fails if charging is not enabled' do
26
- expect( @stripe ).to receive( :charge_enabled ).and_return( false )
27
- expect( @stripe ).to receive( :email ).and_return( email )
28
- expect( checker.status ).to_not be_nil
20
+ expect(@stripe).to receive(:charge_enabled).and_return(false)
21
+ expect(@stripe).to receive(:email).and_return(email)
22
+ expect(checker.status).to_not be_nil
29
23
  end
30
24
 
31
25
  it 'passes if charging is enabled' do
32
- expect( @stripe ).to receive( :charge_enabled ).and_return( true )
33
- expect( @stripe ).to receive( :email ).and_return( email )
34
- expect( checker.status ).to be_nil
26
+ expect(@stripe).to receive(:charge_enabled).and_return(true)
27
+ expect(@stripe).to receive(:email).and_return(email)
28
+ expect(checker.status).to be_nil
35
29
  end
36
30
 
37
31
  it 'uses the account email as the value' do
38
- expect( @stripe ).to receive( :charge_enabled ).and_return( true )
39
- expect( @stripe ).to receive( :email ).and_return( email )
40
- expect( checker.value ).to eql( email )
32
+ expect(@stripe).to receive(:charge_enabled).and_return(true)
33
+ expect(@stripe).to receive(:email).and_return(email)
34
+ expect(checker.value).to eql(email)
41
35
  end
42
- end
36
+ end
@@ -1,33 +1,39 @@
1
1
  describe StatusCat::Checkers::Twilio do
2
2
 
3
- let( :checker ) { StatusCat::Checkers::Twilio.new.freeze }
3
+ let(:checker) { StatusCat::Checkers::Twilio.new.freeze }
4
4
 
5
5
  it_should_behave_like 'a status checker'
6
6
 
7
7
  describe '#initialize' do
8
8
 
9
+ it 'tolerates the gem misssing' do
10
+ gem = Object.send(:remove_const, :Twilio)
11
+ expect(checker.status).to eql('twilio-ruby gem is not installed')
12
+ Object.const_set(:Twilio, gem)
13
+ end
14
+
9
15
  it 'sets the value' do
10
- expect( checker.value ).to eql( ENV[ 'TWILIO_SID' ] )
16
+ expect(checker.value).to eql(StatusCat::Checkers::Twilio.sid)
11
17
  end
12
18
 
13
19
  context 'pass' do
14
20
 
15
21
  it 'passes if it can connect to Twilio' do
16
- expect( checker.status ).to be_nil
22
+ expect(checker.status).to be_nil
17
23
  end
18
24
  end
19
25
 
20
26
  context 'fail' do
21
27
 
22
28
  it 'fails if it receives nil' do
23
- expect( @twilio_messages ).to receive( :total ).and_return( nil )
24
- expect( checker.status ).to_not be_nil
29
+ expect(@twilio_messages).to receive(:total).and_return(nil)
30
+ expect(checker.status).to_not be_nil
25
31
  end
26
32
 
27
33
  it 'fails if there is an exception' do
28
- expect( @twilio_messages ).to receive( :total ).and_raise( 'This is only a test' )
29
- expect( checker.status ).to_not be_nil
34
+ expect(@twilio_messages).to receive(:total).and_raise('This is only a test')
35
+ expect(checker.status).to_not be_nil
30
36
  end
31
37
  end
32
38
  end
33
- end
39
+ end
@@ -1,57 +1,57 @@
1
1
  describe StatusCat::Config do
2
2
 
3
- let( :config ) { StatusCat::Config.instance }
3
+ let(:config) { StatusCat::Config.instance }
4
4
 
5
5
  it 'is a singleton' do
6
- expect( config ).to be( StatusCat::Config.instance )
6
+ expect(config).to be(StatusCat::Config.instance)
7
7
  end
8
8
 
9
9
  describe 'attributes' do
10
10
 
11
11
  it 'has an #authenticate accessor' do
12
- config.authenticate = config.authenticate
13
- expect( config.authenticate ).to eql( config.authenticate )
12
+ config.authenticate = config.authenticate
13
+ expect(config.authenticate).to eql(config.authenticate)
14
14
  end
15
15
 
16
16
  it 'has an #authorize accessor' do
17
17
  config.authorize = config.authorize
18
- expect( config.authorize ).to eql( config.authorize )
18
+ expect(config.authorize).to eql(config.authorize)
19
19
  end
20
20
 
21
21
  it 'has an #enabled accessor' do
22
- expect( config.enabled ).to_not be_nil
22
+ expect(config.enabled).to_not be_nil
23
23
  config.enabled = config.enabled
24
- expect( config.enabled ).to eql( config.enabled )
24
+ expect(config.enabled).to eql(config.enabled)
25
25
  end
26
26
 
27
27
  it 'has a #from accessor' do
28
- expect( config.from ).to_not be_nil
28
+ expect(config.from).to_not be_nil
29
29
  config.from = config.from
30
- expect( config.from ).to eql( config.from )
30
+ expect(config.from).to eql(config.from)
31
31
  end
32
32
 
33
33
  it 'has a #layout accessor' do
34
- expect( config.layout ).to_not be_nil
34
+ expect(config.layout).to_not be_nil
35
35
  config.layout = config.layout
36
- expect( config.layout ).to eql( config.layout )
36
+ expect(config.layout).to eql(config.layout)
37
37
  end
38
38
 
39
39
  it 'has a #noreply accessor' do
40
- expect( config.noreply ).to_not be_nil
40
+ expect(config.noreply).to_not be_nil
41
41
  config.noreply = config.noreply
42
- expect( config.noreply ).to eql( config.noreply )
42
+ expect(config.noreply).to eql(config.noreply)
43
43
  end
44
44
 
45
45
  it 'has a #to accessor' do
46
- expect( config.to ).to_not be_nil
46
+ expect(config.to).to_not be_nil
47
47
  config.to = config.to
48
- expect( config.to ).to eql( config.to )
48
+ expect(config.to).to eql(config.to)
49
49
  end
50
50
 
51
51
  it 'has an #subject accessor' do
52
- expect( config.subject ).to_not be_nil
52
+ expect(config.subject).to_not be_nil
53
53
  config.subject = config.subject
54
- expect( config.subject ).to eql( config.subject )
54
+ expect(config.subject).to eql(config.subject)
55
55
  end
56
56
  end
57
57
 
@@ -59,21 +59,21 @@ describe StatusCat::Config do
59
59
 
60
60
  it 'defaults the #enabled list to all StatusCat::Checkers::Base subclasses' do
61
61
  descendants = StatusCat::Checkers::Base.descendants
62
- expect( StatusCat::Checkers::Base ).to receive( :descendants ).and_return( descendants )
62
+ expect(StatusCat::Checkers::Base).to receive(:descendants).and_return(descendants)
63
63
 
64
64
  config.enabled = nil
65
- config.send( :initialize )
66
- expect( config.enabled ).to_not be_nil
65
+ config.send(:initialize)
66
+ expect(config.enabled).to_not be_nil
67
67
  end
68
68
  end
69
69
 
70
70
  describe '#authenticate_with' do
71
71
 
72
- before( :each ) do
72
+ before(:each) do
73
73
  @authenticate = config.authenticate
74
74
  end
75
75
 
76
- after( :each ) do
76
+ after(:each) do
77
77
  config.authenticate = @authenticate
78
78
  end
79
79
 
@@ -83,7 +83,7 @@ describe StatusCat::Config do
83
83
  true
84
84
  end
85
85
 
86
- expect( config.authenticate ).to_not be_nil
86
+ expect(config.authenticate).to_not be_nil
87
87
  end
88
88
 
89
89
  it 'returns a block' do
@@ -92,23 +92,23 @@ describe StatusCat::Config do
92
92
  @test = true
93
93
  end
94
94
 
95
- instance_eval( &config.authenticate_with )
96
- expect( @test ).to be( true )
95
+ instance_eval(&config.authenticate_with)
96
+ expect(@test).to be(true)
97
97
  end
98
98
 
99
99
  it 'returns a nil proc if none has been set' do
100
100
  config.authenticate = nil
101
- instance_eval( &config.authenticate_with )
101
+ instance_eval(&config.authenticate_with)
102
102
  end
103
103
  end
104
104
 
105
105
  describe '#authorize_with' do
106
106
 
107
- before( :each ) do
107
+ before(:each) do
108
108
  @authorize = config.authorize
109
109
  end
110
110
 
111
- after( :each ) do
111
+ after(:each) do
112
112
  config.authorize = @authorize
113
113
  end
114
114
 
@@ -118,7 +118,7 @@ describe StatusCat::Config do
118
118
  true
119
119
  end
120
120
 
121
- expect( config.authorize ).to_not be_nil
121
+ expect(config.authorize).to_not be_nil
122
122
  end
123
123
 
124
124
  it 'returns a block' do
@@ -127,14 +127,13 @@ describe StatusCat::Config do
127
127
  @test = true
128
128
  end
129
129
 
130
- instance_eval( &config.authorize_with )
131
- expect( @test ).to be( true )
130
+ instance_eval(&config.authorize_with)
131
+ expect(@test).to be(true)
132
132
  end
133
133
 
134
134
  it 'returns a nil proc if none has been set' do
135
135
  config.authorize = nil
136
- instance_eval( &config.authorize_with )
136
+ instance_eval(&config.authorize_with)
137
137
  end
138
138
  end
139
139
  end
140
-
@@ -1,6 +1,6 @@
1
1
  describe StatusCat::Engine do
2
2
 
3
3
  it 'isolates the StatusCat namespace' do
4
- expect( StatusCat::Engine.isolated ).to be( true )
4
+ expect(StatusCat::Engine.isolated).to be(true)
5
5
  end
6
- end
6
+ end
@@ -8,12 +8,12 @@ describe StatusCat::Status do
8
8
 
9
9
  it 'returns an array of enabled checkers' do
10
10
  enabled = StatusCat::Config.instance.enabled
11
- expect( StatusCat::Config.instance ).to receive( :enabled ).and_return( enabled )
11
+ expect(StatusCat::Config.instance).to receive(:enabled).and_return(enabled)
12
12
 
13
13
  all = StatusCat::Status.all
14
- expect( all ).to be_an_instance_of( Array )
15
- expect( all.length ).to eql( StatusCat::Checkers::Base.descendants.length )
16
- all.each { |checker| expect( checker ).to be_a_kind_of( StatusCat::Checkers::Base ) }
14
+ expect(all).to be_an_instance_of(Array)
15
+ expect(all.length).to eql(StatusCat::Checkers::Base.descendants.length)
16
+ all.each { |checker| expect(checker).to be_a_kind_of(StatusCat::Checkers::Base) }
17
17
  end
18
18
  end
19
19
 
@@ -23,32 +23,32 @@ describe StatusCat::Status do
23
23
 
24
24
  describe '::check' do
25
25
 
26
- def checker_array_should_have_names( actual, expected )
27
- expect( actual ).to be_a_kind_of( Array )
28
- expect( actual.length ).to eql( expected.length )
29
- actual.each_index { |i| expect( actual[ i ].name ).to be( expected[ i ] ) }
26
+ def checker_array_should_have_names(actual, expected)
27
+ expect(actual).to be_a_kind_of(Array)
28
+ expect(actual.length).to eql(expected.length)
29
+ actual.each_index { |i| expect(actual[i].name).to be(expected[i]) }
30
30
  end
31
31
 
32
32
  it 'defaults to all checkers' do
33
- names = StatusCat::Status.all.map { |checker| checker.name }
33
+ names = StatusCat::Status.all.map(&:name)
34
34
  checkers = StatusCat::Status.check
35
- checker_array_should_have_names( checkers, names )
35
+ checker_array_should_have_names(checkers, names)
36
36
  end
37
37
 
38
38
  it 'returns all checkers when :all is specified' do
39
- names = StatusCat::Status.all.map { |checker| checker.name }
40
- checkers = StatusCat::Status.check( :all )
41
- checker_array_should_have_names( checkers, names )
39
+ names = StatusCat::Status.all.map(&:name)
40
+ checkers = StatusCat::Status.check(:all)
41
+ checker_array_should_have_names(checkers, names)
42
42
  end
43
43
 
44
44
  it 'returns a single checker when given a single symbolic name' do
45
- expect( StatusCat::Status.check( :active_record ) ).to be_an_instance_of( StatusCat::Checkers::ActiveRecord )
45
+ expect(StatusCat::Status.check(:active_record)).to be_an_instance_of(StatusCat::Checkers::ActiveRecord)
46
46
  end
47
47
 
48
48
  it 'returns an array of checkers when given an array of symbolic name' do
49
- names = [ :active_record, :action_mailer ]
50
- checkers = StatusCat::Status.check( names )
51
- checker_array_should_have_names( checkers, names )
49
+ names = [:active_record, :action_mailer]
50
+ checkers = StatusCat::Status.check(names)
51
+ checker_array_should_have_names(checkers, names)
52
52
  end
53
53
  end
54
54
 
@@ -59,16 +59,16 @@ describe StatusCat::Status do
59
59
  describe '::cron' do
60
60
 
61
61
  it 'delivers email if ::failed is not empty' do
62
- failed = [ StatusCat::Checkers::Base.new ]
63
- mail = StatusCat::StatusMailer.failure( failed )
64
- expect( StatusCat::Status ).to receive( :failed ).and_return( failed )
65
- expect( StatusCat::StatusMailer ).to receive( :failure ).with( failed ).and_return( mail )
62
+ failed = [StatusCat::Checkers::Base.new]
63
+ mail = StatusCat::StatusMailer.failure(failed)
64
+ expect(StatusCat::Status).to receive(:failed).and_return(failed)
65
+ expect(StatusCat::StatusMailer).to receive(:failure).with(failed).and_return(mail)
66
66
  StatusCat::Status.cron
67
67
  end
68
68
 
69
69
  it 'does not email when ::failed is empty' do
70
- expect( StatusCat::Status ).to receive( :failed ).and_return( [] )
71
- expect( StatusCat::StatusMailer ).to_not receive( :failure )
70
+ expect(StatusCat::Status).to receive(:failed).and_return([])
71
+ expect(StatusCat::StatusMailer).to_not receive(:failure)
72
72
  StatusCat::Status.cron
73
73
  end
74
74
  end
@@ -80,8 +80,8 @@ describe StatusCat::Status do
80
80
  describe '::factory' do
81
81
 
82
82
  it 'constructs a checker given its symbolic name' do
83
- expect( StatusCat::Status.factory( :action_mailer ) ).to be_an_instance_of( StatusCat::Checkers::ActionMailer )
84
- expect( StatusCat::Status.factory( :active_record ) ).to be_an_instance_of( StatusCat::Checkers::ActiveRecord )
83
+ expect(StatusCat::Status.factory(:action_mailer)).to be_an_instance_of(StatusCat::Checkers::ActionMailer)
84
+ expect(StatusCat::Status.factory(:active_record)).to be_an_instance_of(StatusCat::Checkers::ActiveRecord)
85
85
  end
86
86
  end
87
87
 
@@ -91,22 +91,21 @@ describe StatusCat::Status do
91
91
 
92
92
  describe '::failed' do
93
93
 
94
- before( :each ) do
94
+ before(:each) do
95
95
  @pass = StatusCat::Checkers::Base.new
96
96
 
97
97
  @fail = StatusCat::Checkers::Base.new
98
- allow( @fail ).to receive( :status ).and_return( :fail )
98
+ allow(@fail).to receive(:status).and_return(:fail)
99
99
  end
100
100
 
101
101
  it 'returns only failed checkers from ::all' do
102
- expect( StatusCat::Status ).to receive( :all ).and_return( [ @pass, @fail ] )
103
- expect( StatusCat::Status.failed ).to eql( [ @fail ] )
102
+ expect(StatusCat::Status).to receive(:all).and_return([@pass, @fail])
103
+ expect(StatusCat::Status.failed).to eql([@fail])
104
104
  end
105
105
 
106
106
  it 'returns an empty list if all checkers pass' do
107
- expect( StatusCat::Status ).to receive( :all ).and_return( [ @pass ] )
108
- expect( StatusCat::Status.failed ).to eql( [] )
107
+ expect(StatusCat::Status).to receive(:all).and_return([@pass])
108
+ expect(StatusCat::Status.failed).to eql([])
109
109
  end
110
110
  end
111
111
  end
112
-