app_status 1.1.2 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/app_status/application_controller.rb +3 -1
- data/app/controllers/app_status/status_controller.rb +8 -2
- data/app/views/app_status/status/index.html.erb +3 -1
- data/bin/nokogiri +16 -0
- data/config/routes.rb +2 -2
- data/lib/app_status/engine.rb +0 -3
- data/lib/app_status/version.rb +1 -1
- data/spec/dummy/app/controllers/widgets_controller.rb +83 -0
- data/spec/dummy/app/views/layouts/application.html.erb +4 -0
- data/spec/dummy/app/views/widgets/_form.html.erb +17 -0
- data/spec/dummy/app/views/widgets/edit.html.erb +6 -0
- data/spec/dummy/app/views/widgets/index.html.erb +21 -0
- data/spec/dummy/app/views/widgets/new.html.erb +5 -0
- data/spec/dummy/app/views/widgets/show.html.erb +5 -0
- data/spec/dummy/config/routes.rb +3 -1
- data/spec/dummy/log/development.log +150 -0
- data/spec/dummy/log/test.log +1554 -0
- data/spec/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953 +0 -0
- data/spec/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/spec/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/spec/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/spec/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/spec/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/spec/features/app_status_features_spec.rb +90 -0
- data/spec/spec_helper.rb +1 -4
- metadata +47 -7
- data/app/views/layouts/app_status/application.html.erb +0 -14
- data/spec/controllers/status_controller_spec.rb +0 -28
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,90 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec::Matchers.define :have_content_type do |expected|
|
4
|
+
|
5
|
+
def extract_content_type(actual)
|
6
|
+
actual.response_headers['Content-Type'].split(';')[0]
|
7
|
+
end
|
8
|
+
|
9
|
+
match do |actual|
|
10
|
+
extract_content_type(actual) == expected
|
11
|
+
end
|
12
|
+
|
13
|
+
failure_message_for_should do |actual|
|
14
|
+
"expected that page's content type would be '#{expected}', but was '#{extract_content_type(actual)}'"
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
describe "status" do
|
20
|
+
|
21
|
+
before(:each) do
|
22
|
+
AppStatus::CheckCollection.clear_checks!
|
23
|
+
AppStatus::CheckCollection.configure do |c|
|
24
|
+
c.add_check('some_service') {[:ok, 'foo']}
|
25
|
+
c.add_description('some_service', "more info")
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
it "renders json by default" do
|
30
|
+
visit "/status"
|
31
|
+
page.should have_content_type('application/json')
|
32
|
+
end
|
33
|
+
|
34
|
+
describe "html page" do
|
35
|
+
|
36
|
+
it "is available at status.html" do
|
37
|
+
visit '/status.html'
|
38
|
+
page.should have_content_type('text/html')
|
39
|
+
end
|
40
|
+
|
41
|
+
it "is available at /status/index.html" do
|
42
|
+
visit '/status/index.html'
|
43
|
+
page.should have_content_type('text/html')
|
44
|
+
end
|
45
|
+
|
46
|
+
it "renders in the main application's default layout" do
|
47
|
+
visit '/status.html'
|
48
|
+
page.title.should eq 'Dummy'
|
49
|
+
end
|
50
|
+
|
51
|
+
it "doesn't break route urls in main layout" do
|
52
|
+
visit '/status.html'
|
53
|
+
page.find('#widget_menu').should have_content('Widgets are at http://www.example.com/widgets.')
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
describe "json endpoint" do
|
59
|
+
|
60
|
+
it "is available at status.json" do
|
61
|
+
visit '/status.json'
|
62
|
+
page.should have_content_type('application/json')
|
63
|
+
end
|
64
|
+
|
65
|
+
it "is available at /status/index.json" do
|
66
|
+
visit '/status/index.json'
|
67
|
+
page.should have_content_type('application/json')
|
68
|
+
end
|
69
|
+
|
70
|
+
it "links to html status page" do
|
71
|
+
visit '/status.json'
|
72
|
+
page.should have_content_type('application/json')
|
73
|
+
data = JSON.parse(page.body)
|
74
|
+
|
75
|
+
data['more_info'].should eq 'http://www.example.com/status.html'
|
76
|
+
end
|
77
|
+
|
78
|
+
it "contains status information" do
|
79
|
+
visit '/status.json'
|
80
|
+
page.should have_content_type('application/json')
|
81
|
+
data = JSON.parse(page.body)
|
82
|
+
|
83
|
+
data['status'].should eq 'ok'
|
84
|
+
data['status_code'].should eq 0
|
85
|
+
data['checks']['some_service']['status'].should eq 'ok'
|
86
|
+
data['checks']['some_service']['details'].should eq 'foo'
|
87
|
+
end
|
88
|
+
|
89
|
+
end
|
90
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -4,15 +4,12 @@ require File.expand_path("../dummy/config/environment.rb", __FILE__)
|
|
4
4
|
require 'rspec/rails'
|
5
5
|
require 'rspec/autorun'
|
6
6
|
require 'timecop'
|
7
|
+
require 'capybara/rspec'
|
7
8
|
|
8
9
|
Rails.backtrace_cleaner.remove_silencers!
|
9
10
|
|
10
|
-
# Load support files
|
11
|
-
#Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
12
|
-
|
13
11
|
RSpec.configure do |config|
|
14
12
|
config.mock_with :rspec
|
15
|
-
#config.use_transactional_fixtures = true
|
16
13
|
config.infer_base_class_for_anonymous_controllers = false
|
17
14
|
config.order = "random"
|
18
15
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: app_status
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-10-
|
12
|
+
date: 2013-10-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -91,6 +91,22 @@ dependencies:
|
|
91
91
|
- - ! '>='
|
92
92
|
- !ruby/object:Gem::Version
|
93
93
|
version: '0'
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: capybara
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ! '>='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
type: :development
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
94
110
|
description: AppStatus provides a URL which is easily consumable by Nagios or other
|
95
111
|
monitoring tools.
|
96
112
|
email:
|
@@ -107,13 +123,13 @@ files:
|
|
107
123
|
- app/models/app_status/check_collection.rb
|
108
124
|
- app/models/app_status/check_item.rb
|
109
125
|
- app/views/app_status/status/index.html.erb
|
110
|
-
- app/views/layouts/app_status/application.html.erb
|
111
126
|
- bin/autospec
|
112
127
|
- bin/erubis
|
113
128
|
- bin/haml
|
114
129
|
- bin/htmldiff
|
115
130
|
- bin/kramdown
|
116
131
|
- bin/ldiff
|
132
|
+
- bin/nokogiri
|
117
133
|
- bin/rackup
|
118
134
|
- bin/rails
|
119
135
|
- bin/rake
|
@@ -132,12 +148,17 @@ files:
|
|
132
148
|
- MIT-LICENSE
|
133
149
|
- Rakefile
|
134
150
|
- README.md
|
135
|
-
- spec/controllers/status_controller_spec.rb
|
136
151
|
- spec/dummy/app/assets/javascripts/application.js
|
137
152
|
- spec/dummy/app/assets/stylesheets/application.css
|
138
153
|
- spec/dummy/app/controllers/application_controller.rb
|
154
|
+
- spec/dummy/app/controllers/widgets_controller.rb
|
139
155
|
- spec/dummy/app/helpers/application_helper.rb
|
140
156
|
- spec/dummy/app/views/layouts/application.html.erb
|
157
|
+
- spec/dummy/app/views/widgets/_form.html.erb
|
158
|
+
- spec/dummy/app/views/widgets/edit.html.erb
|
159
|
+
- spec/dummy/app/views/widgets/index.html.erb
|
160
|
+
- spec/dummy/app/views/widgets/new.html.erb
|
161
|
+
- spec/dummy/app/views/widgets/show.html.erb
|
141
162
|
- spec/dummy/config/application.rb
|
142
163
|
- spec/dummy/config/boot.rb
|
143
164
|
- spec/dummy/config/database.yml
|
@@ -167,13 +188,20 @@ files:
|
|
167
188
|
- spec/dummy/tmp/cache/assets/CA5/160/sprockets%2Fc4b6dd696758a9c186897a8c25615778
|
168
189
|
- spec/dummy/tmp/cache/assets/CB2/070/sprockets%2Fe1b30e44248fc0395505c899c0f2357e
|
169
190
|
- spec/dummy/tmp/cache/assets/CB2/5B0/sprockets%2Fc8e423e85d0a1cb22332859990909a3f
|
191
|
+
- spec/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953
|
170
192
|
- spec/dummy/tmp/cache/assets/CF2/9A0/sprockets%2Fb3eee5a6a87662f428f47c908157f606
|
171
193
|
- spec/dummy/tmp/cache/assets/D15/DA0/sprockets%2Fc7e74644f623ec92a443b53b8c1d19c8
|
194
|
+
- spec/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705
|
172
195
|
- spec/dummy/tmp/cache/assets/D3F/E00/sprockets%2Fa7629a6ce27d07753dbb05bd48098ce0
|
196
|
+
- spec/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655
|
173
197
|
- spec/dummy/tmp/cache/assets/D51/F30/sprockets%2Fbe466f3302fef7895aad76d05d93963d
|
198
|
+
- spec/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6
|
174
199
|
- spec/dummy/tmp/cache/assets/DB8/430/sprockets%2Ff731c6599577d8f741f3afd2d8ed2efb
|
200
|
+
- spec/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994
|
175
201
|
- spec/dummy/tmp/cache/assets/DDD/460/sprockets%2Fe5b8947c2a5caf5460fecdfd48c818d5
|
202
|
+
- spec/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af
|
176
203
|
- spec/dummy/tmp/cache/assets/E07/FD0/sprockets%2Fb3d7aafd7ce063e022cd29e7ccb898f9
|
204
|
+
- spec/features/app_status_features_spec.rb
|
177
205
|
- spec/models/check_collection_spec.rb
|
178
206
|
- spec/spec_helper.rb
|
179
207
|
homepage: http://github.com/alexdean/app_status
|
@@ -190,7 +218,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
190
218
|
version: '0'
|
191
219
|
segments:
|
192
220
|
- 0
|
193
|
-
hash:
|
221
|
+
hash: -3960571408936906561
|
194
222
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
195
223
|
none: false
|
196
224
|
requirements:
|
@@ -199,7 +227,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
199
227
|
version: '0'
|
200
228
|
segments:
|
201
229
|
- 0
|
202
|
-
hash:
|
230
|
+
hash: -3960571408936906561
|
203
231
|
requirements: []
|
204
232
|
rubyforge_project:
|
205
233
|
rubygems_version: 1.8.24
|
@@ -207,12 +235,17 @@ signing_key:
|
|
207
235
|
specification_version: 3
|
208
236
|
summary: AppStatus is a Rails engine for exposing app data to Nagios.
|
209
237
|
test_files:
|
210
|
-
- spec/controllers/status_controller_spec.rb
|
211
238
|
- spec/dummy/app/assets/javascripts/application.js
|
212
239
|
- spec/dummy/app/assets/stylesheets/application.css
|
213
240
|
- spec/dummy/app/controllers/application_controller.rb
|
241
|
+
- spec/dummy/app/controllers/widgets_controller.rb
|
214
242
|
- spec/dummy/app/helpers/application_helper.rb
|
215
243
|
- spec/dummy/app/views/layouts/application.html.erb
|
244
|
+
- spec/dummy/app/views/widgets/_form.html.erb
|
245
|
+
- spec/dummy/app/views/widgets/edit.html.erb
|
246
|
+
- spec/dummy/app/views/widgets/index.html.erb
|
247
|
+
- spec/dummy/app/views/widgets/new.html.erb
|
248
|
+
- spec/dummy/app/views/widgets/show.html.erb
|
216
249
|
- spec/dummy/config/application.rb
|
217
250
|
- spec/dummy/config/boot.rb
|
218
251
|
- spec/dummy/config/database.yml
|
@@ -242,12 +275,19 @@ test_files:
|
|
242
275
|
- spec/dummy/tmp/cache/assets/CA5/160/sprockets%2Fc4b6dd696758a9c186897a8c25615778
|
243
276
|
- spec/dummy/tmp/cache/assets/CB2/070/sprockets%2Fe1b30e44248fc0395505c899c0f2357e
|
244
277
|
- spec/dummy/tmp/cache/assets/CB2/5B0/sprockets%2Fc8e423e85d0a1cb22332859990909a3f
|
278
|
+
- spec/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953
|
245
279
|
- spec/dummy/tmp/cache/assets/CF2/9A0/sprockets%2Fb3eee5a6a87662f428f47c908157f606
|
246
280
|
- spec/dummy/tmp/cache/assets/D15/DA0/sprockets%2Fc7e74644f623ec92a443b53b8c1d19c8
|
281
|
+
- spec/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705
|
247
282
|
- spec/dummy/tmp/cache/assets/D3F/E00/sprockets%2Fa7629a6ce27d07753dbb05bd48098ce0
|
283
|
+
- spec/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655
|
248
284
|
- spec/dummy/tmp/cache/assets/D51/F30/sprockets%2Fbe466f3302fef7895aad76d05d93963d
|
285
|
+
- spec/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6
|
249
286
|
- spec/dummy/tmp/cache/assets/DB8/430/sprockets%2Ff731c6599577d8f741f3afd2d8ed2efb
|
287
|
+
- spec/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994
|
250
288
|
- spec/dummy/tmp/cache/assets/DDD/460/sprockets%2Fe5b8947c2a5caf5460fecdfd48c818d5
|
289
|
+
- spec/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af
|
251
290
|
- spec/dummy/tmp/cache/assets/E07/FD0/sprockets%2Fb3d7aafd7ce063e022cd29e7ccb898f9
|
291
|
+
- spec/features/app_status_features_spec.rb
|
252
292
|
- spec/models/check_collection_spec.rb
|
253
293
|
- spec/spec_helper.rb
|
@@ -1,14 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>App Status</title>
|
5
|
-
<%= stylesheet_link_tag "app_status/application", :media => "all" %>
|
6
|
-
<%= javascript_include_tag "app_status/application" %>
|
7
|
-
<%= csrf_meta_tags %>
|
8
|
-
</head>
|
9
|
-
<body>
|
10
|
-
|
11
|
-
<%= yield %>
|
12
|
-
|
13
|
-
</body>
|
14
|
-
</html>
|
@@ -1,28 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe AppStatus::StatusController do
|
4
|
-
|
5
|
-
describe "GET index" do
|
6
|
-
before(:each) do
|
7
|
-
AppStatus::CheckCollection.clear_checks!
|
8
|
-
AppStatus::CheckCollection.add_check('some_service') {[:ok, 'foo']}
|
9
|
-
end
|
10
|
-
|
11
|
-
it "should render json" do
|
12
|
-
get :index, format: 'json', use_route: :app_status
|
13
|
-
response.should be_success
|
14
|
-
|
15
|
-
data = JSON.parse(response.body)
|
16
|
-
data['status'].should eq 'ok'
|
17
|
-
data['status_code'].should eq 0
|
18
|
-
data['checks']['some_service']['status'].should eq 'ok'
|
19
|
-
data['checks']['some_service']['details'].should eq 'foo'
|
20
|
-
end
|
21
|
-
|
22
|
-
it "should render html" do
|
23
|
-
get :index, format: 'html', use_route: :app_status
|
24
|
-
response.should be_success
|
25
|
-
# FIXME: response.body == "". why?
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|