diff --git a/lib/pact_broker/matrix/latest_row.rb b/lib/pact_broker/matrix/latest_row.rb index acd31b2c7..b9434816f 100644 --- a/lib/pact_broker/matrix/latest_row.rb +++ b/lib/pact_broker/matrix/latest_row.rb @@ -5,20 +5,6 @@ module Matrix # Latest pact revision for each consumer version => latest verification for each provider version class LatestRow < Row set_dataset(:latest_matrix_for_consumer_version_and_provider_version) - - # For some reason, with MySQL, the success column value - # comes back as an integer rather than a boolean - # for the latest_matrix view (but not the matrix view!) - # Maybe something to do with the union? - # Haven't investigated as this is an easy enough fix. - def success - value = super - value.nil? ? nil : value == true || value == 1 - end - - def values - super.merge(success: success) - end end end end diff --git a/lib/pact_broker/matrix/repository.rb b/lib/pact_broker/matrix/repository.rb index d2bd98879..53a7257db 100644 --- a/lib/pact_broker/matrix/repository.rb +++ b/lib/pact_broker/matrix/repository.rb @@ -61,7 +61,7 @@ def find_for_consumer_and_provider pacticipant_1_name, pacticipant_2_name end def find_compatible_pacticipant_versions selectors - find(selectors, latestby: 'cvpv').select{|line| line[:success] } + find(selectors, latestby: 'cvpv').select{|line| line.success } end def query_matrix selectors, options diff --git a/lib/pact_broker/matrix/row.rb b/lib/pact_broker/matrix/row.rb index 13a0a3dc2..6bf004854 100644 --- a/lib/pact_broker/matrix/row.rb +++ b/lib/pact_broker/matrix/row.rb @@ -209,6 +209,14 @@ def success def values super.merge(success: success) end + + # Need to overwrite eql? from lib/sequel/model/base.rb + # because it uses @values instead of self.values + # so the success boolean/integer problem mentioned above + # screws things up + def eql?(obj) + (obj.class == model) && (obj.values == values) + end end end end