Skip to content

Commit

Permalink
specs updated with more columns to replicate piotrmurach/issues/35
Browse files Browse the repository at this point in the history
  • Loading branch information
Paulo Gorgita committed Mar 19, 2021
1 parent b2af2ab commit 9f694a5
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions spec/unit/rotate_spec.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# frozen_string_literal: true

RSpec.describe TTY::Table, '#rotate' do
let(:header) { ['h1', 'h2', 'h3'] }
let(:rows) { [['a1', 'a2', 'a3'], ['b1', 'b2', 'b3']] }
let(:header) { ['h1', 'h2', 'h3', 'h4', 'h5'] }
let(:rows) { [['a1', 'a2', 'a3', 'a4', 'a5'], ['b1', 'b2', 'b3', 'b4', 'b5']] }

subject(:table) { described_class.new(header, rows) }

Expand Down Expand Up @@ -34,9 +34,13 @@
['1', 'a1'],
['2', 'a2'],
['3', 'a3'],
['4', 'a4'],
['5', 'a5'],
['1', 'b1'],
['2', 'b2'],
['3', 'b3'],
['4', 'b4'],
['5', 'b5']
]
expect(table.header).to be_nil
end
Expand All @@ -49,11 +53,11 @@
expect(table.header).to eql header
end

it 'roates the output' do
expect(table.to_s).to eq("a1 a2 a3\nb1 b2 b3")
it 'rotates the output' do
expect(table.to_s).to eq("a1 a2 a3 a4 a5\nb1 b2 b3 b4 b5")
table.orientation = :vertical
table.rotate
expect(table.to_s).to eq("1 a1\n2 a2\n3 a3\n1 b1\n2 b2\n3 b3")
expect(table.to_s).to eq("1 a1\n2 a2\n3 a3\n4 a4\n5 a5\n1 b1\n2 b2\n3 b3\n4 b4\n5 b5")
end
end

Expand All @@ -64,9 +68,13 @@
['h1', 'a1'],
['h2', 'a2'],
['h3', 'a3'],
['h4', 'a4'],
['h5', 'a5'],
['h1', 'b1'],
['h2', 'b2'],
['h3', 'b3'],
['h4', 'b4'],
['h5', 'b5']
]
expect(table.header).to be_empty
end
Expand Down

0 comments on commit 9f694a5

Please sign in to comment.