Skip to content

Commit

Permalink
feat: sort can-i-deploy table by consumer name, then provider name
Browse files Browse the repository at this point in the history
  • Loading branch information
bethesque committed Aug 29, 2023
1 parent a72a529 commit 83412e7
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/pact_broker/client/matrix/text_formatter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ class Matrix
class TextFormatter
using PactBroker::Client::HashRefinements

Line = Struct.new(:consumer, :consumer_version, :provider, :provider_version, :success, :ref, :ignored)
Line = Struct.new(:consumer, :consumer_version, :provider, :provider_version, :success, :ref, :ignored) do
def <=>(other)
[consumer&.downcase, provider&.downcase ] <=> [other.consumer&.downcase, other.provider&.downcase]
end
end

def self.call(matrix)
matrix_rows = matrix[:matrix]
Expand All @@ -35,7 +39,7 @@ def self.prepare_data(matrix_rows)
has_verification_result_url ? verification_result_number : "",
lookup(line, nil, :ignored)
)
end
end.sort
end

def self.tp_options(data)
Expand Down

0 comments on commit 83412e7

Please sign in to comment.