-
-
Notifications
You must be signed in to change notification settings - Fork 21
Fix for piotrmurach/issues/35 #40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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'] } | ||
|
pgorgita marked this conversation as resolved.
|
||
| let(:rows) { [['a1', 'a2', 'a3', 'a4', 'a5'], ['b1', 'b2', 'b3', 'b4', 'b5']] } | ||
|
pgorgita marked this conversation as resolved.
|
||
|
|
||
| subject(:table) { described_class.new(header, rows) } | ||
|
|
||
|
|
@@ -34,9 +34,13 @@ | |
| ['1', 'a1'], | ||
| ['2', 'a2'], | ||
| ['3', 'a3'], | ||
| ['4', 'a4'], | ||
|
pgorgita marked this conversation as resolved.
|
||
| ['5', 'a5'], | ||
|
pgorgita marked this conversation as resolved.
|
||
| ['1', 'b1'], | ||
| ['2', 'b2'], | ||
| ['3', 'b3'], | ||
| ['4', 'b4'], | ||
|
pgorgita marked this conversation as resolved.
|
||
| ['5', 'b5'] | ||
|
pgorgita marked this conversation as resolved.
|
||
| ] | ||
| expect(table.header).to be_nil | ||
| end | ||
|
|
@@ -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 | ||
|
pgorgita marked this conversation as resolved.
|
||
| 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") | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Metrics/LineLength: Line is too long. [92/80] |
||
| end | ||
| end | ||
|
|
||
|
|
@@ -64,9 +68,13 @@ | |
| ['h1', 'a1'], | ||
| ['h2', 'a2'], | ||
| ['h3', 'a3'], | ||
| ['h4', 'a4'], | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Style/WordArray: Use %w or %W for an array of words. |
||
| ['h5', 'a5'], | ||
|
pgorgita marked this conversation as resolved.
|
||
| ['h1', 'b1'], | ||
| ['h2', 'b2'], | ||
| ['h3', 'b3'], | ||
| ['h4', 'b4'], | ||
|
pgorgita marked this conversation as resolved.
|
||
| ['h5', 'b5'] | ||
|
pgorgita marked this conversation as resolved.
|
||
| ] | ||
| expect(table.header).to be_empty | ||
| end | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.