spec/tty/table/border/null/rendering_spec.rb in tty-0.0.7 vs spec/tty/table/border/null/rendering_spec.rb in tty-0.0.8
- old
+ new
@@ -1,12 +1,13 @@
# -*- encoding: utf-8 -*-
require 'spec_helper'
describe TTY::Table::Border::Null, '#rendering' do
+ let(:border) { nil }
- subject { described_class.new row }
+ subject { described_class.new row, border }
context 'with empty row' do
let(:row) { [] }
it 'draws top line' do
@@ -41,9 +42,46 @@
subject.bottom_line.should be_nil
end
it 'draws row line' do
subject.row_line.should == 'a1 a2 a3'
+ end
+ end
+
+ context 'with border' do
+ let(:row) { ['a1', 'a2', 'a3'] }
+ let(:border) { { :characters => {
+ 'top' => '=',
+ 'top_mid' => '=',
+ 'top_left' => '=',
+ 'top_right' => '=',
+ 'bottom' => '=',
+ 'bottom_mid' => '=',
+ 'bottom_left' => '=',
+ 'bottom_right' => '=',
+ 'mid' => '=',
+ 'mid_mid' => '=',
+ 'mid_left' => '=',
+ 'mid_right' => '=',
+ 'left' => '=',
+ 'center' => '=',
+ 'right' => '='
+ } } }
+
+ it 'draws top line' do
+ expect(subject.top_line).to eql '=========='
+ end
+
+ it 'draws separator line' do
+ expect(subject.separator).to eql '=========='
+ end
+
+ it 'draws bottom line' do
+ expect(subject.bottom_line).to eql '=========='
+ end
+
+ it 'draws row line' do
+ expect(subject.row_line).to eql '=a1=a2=a3='
end
end
end