lib/pact_broker/pacts/selector.rb in pact_broker-2.81.0 vs lib/pact_broker/pacts/selector.rb in pact_broker-2.82.0

- old
+ new

@@ -99,11 +99,11 @@ def currently_deployed self[:currently_deployed] end def currently_deployed? - currently_deployed + !!currently_deployed end def currently_supported= currently_supported self[:currently_supported] = currently_supported end @@ -111,11 +111,11 @@ def currently_supported self[:currently_supported] end def currently_supported? - currently_supported + !!currently_supported end def environment_name= environment_name self[:environment_name] = environment_name end @@ -202,10 +202,14 @@ def self.from_hash hash Selector.new(hash) end + def for_consumer(consumer) + Selector.new(to_h.merge(consumer: consumer)) + end + def latest_for_main_branch? !!main_branch end def fallback_tag? @@ -331,9 +335,18 @@ self[:environment] end def == other super && consumer_version == other.consumer_version + end + + def <=> other + comparison = super + if comparison == 0 + consumer_version.order <=> other.consumer_version.order + else + comparison + end end end end end