stoplight 0.5.0 → 0.5.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ad268d747b85be7b3a0d773d9aeec70b1b22c25a
4
- data.tar.gz: 56c5c8f88361a3c9d705212d9725251017097ddb
3
+ metadata.gz: 9619bee3f557017bc7b877349a5a2b5985e535ce
4
+ data.tar.gz: 5dec1f7bce5d8373cea3747e8dc587e0795e19c2
5
5
  SHA512:
6
- metadata.gz: 043418c2e767031b2a229ad2e22d378c52101d342cdec3bb600bec88c5c46238c345eadb558d779ccedb8f60122b81b5cddf969dfb7dbf475e7bfe3e0cb7b3c2
7
- data.tar.gz: 8a9952d663eb04f03e05736f3541ac09b69e69776c80265116d43a7c4c4e2e8d699691598ef8ae35d1c0018b5bc7880f73614894d79e194987961e857c2f7016
6
+ metadata.gz: 9f12b3bbf04f13f74c91ef78c3c85909a720e15003808609bb9d06e5886643a52d17a83e37263e1dc10666dd286f8e3fdb2784652b553b35eafc47f920368d76
7
+ data.tar.gz: 4437c4f2618ac10732bdccd600699590780d1d162d8f6523206115a283d0d616e389a58fbe7ea56c07010f087768ed9918fbd2f092177e9944ea33fc6b142bc0
data/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  This project uses [Semantic Versioning][1].
4
4
 
5
+ ## v0.5.1 (2014-11-19)
6
+
7
+ - Fixed a logic bug that incorrectly determined red lights to be yellow.
8
+
9
+ ## v0.5.0 (2014-11-19)
10
+
5
11
  - Data stores and notifiers can be configured on a per-stoplight basis. This
6
12
  allows stoplights to use stoplights internally.
7
13
  - Stoplights use stoplights internally to wrap calls to data stores and
data/README.md CHANGED
@@ -33,7 +33,7 @@ Check out [stoplight-admin][12] for controlling your stoplights.
33
33
  Add it to your Gemfile:
34
34
 
35
35
  ``` rb
36
- gem 'stoplight', '~> 0.5.0'
36
+ gem 'stoplight', '~> 0.5.1'
37
37
  ```
38
38
 
39
39
  Or install it manually:
@@ -5,13 +5,13 @@ module Stoplight
5
5
  module Runnable
6
6
  def color
7
7
  failures, state = failures_and_state
8
- now = Time.new
8
+ failure = failures.first
9
9
 
10
10
  case
11
11
  when state == State::LOCKED_GREEN then Color::GREEN
12
12
  when state == State::LOCKED_RED then Color::RED
13
13
  when failures.size < threshold then Color::GREEN
14
- when failures.any? { |f| now - f.time >= timeout } then Color::YELLOW
14
+ when failure && Time.new - failure.time >= timeout then Color::YELLOW
15
15
  else Color::RED
16
16
  end
17
17
  end
@@ -58,6 +58,16 @@ describe Stoplight::Light::Runnable do
58
58
  subject.data_store.record_failure(subject, other)
59
59
  expect(subject.color).to eql(Stoplight::Color::YELLOW)
60
60
  end
61
+
62
+ it 'is red when the least recent failure is old' do
63
+ other = Stoplight::Failure.new(
64
+ error.class.name, error.message, Time.new - subject.timeout)
65
+ subject.data_store.record_failure(subject, other)
66
+ (subject.threshold - 1).times do
67
+ subject.data_store.record_failure(subject, failure)
68
+ end
69
+ expect(subject.color).to eql(Stoplight::Color::RED)
70
+ end
61
71
  end
62
72
 
63
73
  describe '#run' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stoplight
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cameron Desautels
@@ -218,7 +218,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
218
218
  version: '0'
219
219
  requirements: []
220
220
  rubyforge_project:
221
- rubygems_version: 2.4.3
221
+ rubygems_version: 2.4.4
222
222
  signing_key:
223
223
  specification_version: 4
224
224
  summary: Traffic control for code.