spec/unit/border/unicode/rendering_spec.rb in tty-table-0.1.0 vs spec/unit/border/unicode/rendering_spec.rb in tty-table-0.2.0
- old
+ new
@@ -2,59 +2,59 @@
require 'spec_helper'
RSpec.describe TTY::Table::Border::Unicode, '#rendering' do
- subject { described_class.new(column_widths) }
+ subject(:border) { described_class.new(column_widths, [0,0,0,0]) }
context 'with empty row' do
let(:row) { TTY::Table::Row.new([]) }
let(:column_widths) { [] }
it 'draws top line' do
- expect(subject.top_line).to eq("┌┐")
+ expect(border.top_line).to eq("┌┐")
end
it 'draws middle line' do
- expect(subject.separator).to eq("├┤")
+ expect(border.separator).to eq("├┤")
end
it 'draw bottom line' do
- expect(subject.bottom_line).to eq("└┘")
+ expect(border.bottom_line).to eq("└┘")
end
it 'draws row line' do
- expect(subject.row_line(row)).to eq("││")
+ expect(border.row_line(row)).to eq("││")
end
end
context 'with row' do
let(:row) { TTY::Table::Row.new(['a1', 'a2', 'a3']) }
let(:column_widths) { [2,2,2] }
it 'draws top line' do
- expect(subject.top_line).to eq("┌──┬──┬──┐")
+ expect(border.top_line).to eq("┌──┬──┬──┐")
end
it 'draw middle line' do
- expect(subject.separator).to eq("├──┼──┼──┤")
+ expect(border.separator).to eq("├──┼──┼──┤")
end
it 'draw bottom line' do
- expect(subject.bottom_line).to eq("└──┴──┴──┘")
+ expect(border.bottom_line).to eq("└──┴──┴──┘")
end
it 'draws row line' do
- expect(subject.row_line(row)).to eq("│a1│a2│a3│")
+ expect(border.row_line(row)).to eq("│a1│a2│a3│")
end
end
context 'with multiline row' do
let(:row) { TTY::Table::Row.new(["a1\nb1\nc1", 'a2', 'a3']) }
let(:column_widths) { [2,2,2] }
it 'draws row line' do
- expect(subject.row_line(row)).to eq <<-EOS.normalize
+ expect(border.row_line(row)).to eq unindent(<<-EOS)
│a1│a2│a3│
│b1│ │ │
│c1│ │ │
EOS
end