Skip to content

Commit

Permalink
feat(can-i-deploy): shorten header names in text output
Browse files Browse the repository at this point in the history
  • Loading branch information
bethesque committed Nov 6, 2017
1 parent 3d799cc commit 89d5a04
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
10 changes: 9 additions & 1 deletion lib/pact_broker/client/matrix/text_formatter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ class TextFormatter

Line = Struct.new(:consumer, :consumer_version, :provider, :provider_version, :success)

OPTIONS = [
{ consumer: {} },
{ consumer_version: {display_name: 'C.VERSION'} },
{ provider: {} },
{ provider_version: {display_name: 'P.VERSION'} },
{ success: {display_name: 'SUCCESS?'} }
]

def self.call(matrix)
data = matrix[:matrix].collect do | line |
Line.new(
Expand All @@ -18,7 +26,7 @@ def self.call(matrix)
)
end

printer = TablePrint::Printer.new(data)
printer = TablePrint::Printer.new(data, OPTIONS)
printer.table_print
end

Expand Down
6 changes: 3 additions & 3 deletions spec/support/matrix.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
CONSUMER | CONSUMER_VERSION | PROVIDER | PROVIDER_VERSION | SUCCESS
---------|------------------|----------|------------------|--------
Foo | 4 | Bar | 5 | true
CONSUMER | C.VERSION | PROVIDER | P.VERSION | SUCCESS?
---------|-----------|----------|-----------|---------
Foo | 4 | Bar | 5 | true
6 changes: 3 additions & 3 deletions spec/support/matrix_error.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
CONSUMER | CONSUMER_VERSION | PROVIDER | PROVIDER_VERSION | SUCCESS
---------|------------------|----------|------------------|--------
??? | ??? | ??? | ??? | ???
CONSUMER | C.VERSION | PROVIDER | P.VERSION | SUCCESS?
---------|-----------|----------|-----------|---------
??? | ??? | ??? | ??? | ???

0 comments on commit 89d5a04

Please sign in to comment.