lib/pact_broker/pacts/selector.rb in pact_broker-2.93.3 vs lib/pact_broker/pacts/selector.rb in pact_broker-2.93.4
- old
+ new
@@ -281,12 +281,10 @@
other.class == self.class && super
end
# rubocop: disable Metrics/CyclomaticComplexity
def <=> other
- # elsif consumer || other.consumer
- # consumer_comparison(other)
if overall_latest? || other.overall_latest?
overall_latest_comparison(other)
elsif latest_for_branch? || other.latest_for_branch?
branch_comparison(other)
elsif latest_for_tag? || other.latest_for_tag?
@@ -295,10 +293,12 @@
tag_comparison(other)
elsif currently_deployed? || other.currently_deployed?
currently_deployed_comparison(other)
elsif currently_supported? || other.currently_supported?
currently_supported_comparison(other)
+ elsif consumer || other.consumer
+ consumer_comparison(other)
else
0
end
end
# rubocop: enable Metrics/CyclomaticComplexity
@@ -356,11 +356,11 @@
tag ? -1 : 1
end
end
def consumer_comparison(other)
- if consumer == other.consumer
- 0
+ if consumer && other.consumer
+ consumer <=> other.consumer
else
consumer ? -1 : 1
end
end