diff --git a/lib/stoplight/domain/state_snapshot.rb b/lib/stoplight/domain/state_snapshot.rb index dc7da71d..e0a76fdb 100644 --- a/lib/stoplight/domain/state_snapshot.rb +++ b/lib/stoplight/domain/state_snapshot.rb @@ -29,7 +29,7 @@ def color Color::GREEN elsif locked_state == State::LOCKED_RED Color::RED - elsif (recovery_scheduled_after && recovery_scheduled_after! < time) || recovery_started_at + elsif (recovery_scheduled_after && recovery_scheduled_after! < time) || recovery_started? Color::YELLOW elsif breached_at Color::RED diff --git a/spec/unit/stoplight/domain/state_snapshot_spec.rb b/spec/unit/stoplight/domain/state_snapshot_spec.rb index e41aac81..45b6f189 100644 --- a/spec/unit/stoplight/domain/state_snapshot_spec.rb +++ b/spec/unit/stoplight/domain/state_snapshot_spec.rb @@ -46,10 +46,17 @@ it { is_expected.to be(Stoplight::Color::YELLOW) } end + context "when threshold breached" do let(:breached_at) { time - 3 } it { is_expected.to be(Stoplight::Color::RED) } + + context "when recovery is in the future" do + let(:recovery_started_at) { time + 3 } + + it { is_expected.to be(Stoplight::Color::RED) } + end end end end