diff --git a/model/lantern/lantern_resource.rb b/model/lantern/lantern_resource.rb index d12753374..a9eae65d5 100644 --- a/model/lantern/lantern_resource.rb +++ b/model/lantern/lantern_resource.rb @@ -51,7 +51,7 @@ def label end def display_state - return "failover" if servers.find { _1.strand.label == "take_over" } + return "failover" if servers.find { _1.display_state == "failover" } super || representative_server&.display_state || "unavailable" end diff --git a/spec/model/lantern/lantern_resource_spec.rb b/spec/model/lantern/lantern_resource_spec.rb index db141d770..496ec839f 100644 --- a/spec/model/lantern/lantern_resource_spec.rb +++ b/spec/model/lantern/lantern_resource_spec.rb @@ -35,7 +35,7 @@ end it "returns failover" do - expect(lantern_resource).to receive(:servers).and_return([instance_double(LanternServer, strand: instance_double(Strand, label: "take_over"))]) + expect(lantern_resource).to receive(:servers).and_return([instance_double(LanternServer, display_state: "running", strand: instance_double(Strand, label: "wait")), instance_double(LanternServer, display_state: "failover", strand: instance_double(Strand, label: "take_over"))]) expect(lantern_resource.display_state).to eq("failover") end