pinglish 0.1.0 → 0.2.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.
data/README.md CHANGED
@@ -10,7 +10,7 @@ conforms to the spec below.
10
10
 
11
11
  0. The request handler __should__ check the health of all services the
12
12
  application depends on, answering questions like, "Can I query
13
- agains my MySQL database," "Can I create/read keys in Reds," or "How
13
+ agains my MySQL database," "Can I create/read keys in Redis," or "How
14
14
  many docs are in my ElasticSearch index?"
15
15
 
16
16
  0. The response __must__ return within 29 seconds. This is one second
@@ -107,9 +107,13 @@ use Pinglish do |ping|
107
107
  end
108
108
 
109
109
  # Signal check failure by raising an exception. Any exception will do.
110
-
111
110
  ping.check :fails do
112
111
  raise "Everything's ruined."
113
112
  end
113
+
114
+ # Additionally, any check that returns false is counted as a failure.
115
+ ping.check :false_fails do
116
+ false
117
+ end
114
118
  end
115
119
  ```
@@ -39,7 +39,7 @@ class Pinglish
39
39
  def call(env)
40
40
  request = Rack::Request.new env
41
41
 
42
- return @app.call env unless request.path == @path
42
+ return @app.call env unless request.path_info == @path
43
43
 
44
44
  groups = [].map(&:to_s) # FIX
45
45
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |gem|
4
4
  gem.name = "pinglish"
5
- gem.version = "0.1.0"
5
+ gem.version = "0.2.0"
6
6
  gem.authors = ["John Barnette", "Will Farrington"]
7
7
  gem.email = ["jbarnette@github.com", "wfarr@github.com"]
8
8
  gem.description = "A simple Rack middleware for checking app health."
@@ -138,6 +138,20 @@ class PinglishTest < MiniTest::Unit::TestCase
138
138
  assert_equal ["long"], json["timeouts"]
139
139
  end
140
140
 
141
+ def test_with_script_name
142
+ app = build_app
143
+
144
+ session = Rack::Test::Session.new(app)
145
+ session.get "/_ping", {}, "SCRIPT_NAME" => "/myapp"
146
+ assert_equal 200, session.last_response.status
147
+ assert_equal "application/json; charset=UTF-8",
148
+ session.last_response.content_type
149
+
150
+ json = JSON.load(session.last_response.body)
151
+ assert json.key?("now")
152
+ assert_equal "ok", json["status"]
153
+ end
154
+
141
155
  def test_with_custom_path
142
156
  app = build_app(:path => "/_piiiiing")
143
157
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pinglish
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-04-18 00:00:00.000000000 Z
13
+ date: 2013-06-26 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rack