spec/tty/table/to_s_spec.rb in tty-0.0.11 vs spec/tty/table/to_s_spec.rb in tty-0.1.0
- old
+ new
@@ -1,31 +1,31 @@
-# -*- encoding: utf-8 -*-
+# encoding: utf-8
require 'spec_helper'
describe TTY::Table, '#to_s' do
- let(:header) { ['h1', 'h2', 'h3'] }
- let(:rows) { [['a1', 'a2', 'a3'], ['b1', 'b2', 'b3']] }
+ let(:header) { ['h1', 'h2', 'h3'] }
+ let(:rows) { [['a1', 'a2', 'a3'], ['b1', 'b2', 'b3']] }
let(:renderer) { :basic }
- subject { described_class.new(header, rows) }
+ subject(:table) { described_class.new(header, rows) }
context 'without renderer' do
let(:renderer) { nil }
it 'displayes basic table' do
- subject.to_s.should == <<-EOS.normalize
+ expect(table.to_s).to eq <<-EOS.normalize
h1 h2 h3
a1 a2 a3
b1 b2 b3
EOS
end
end
context 'without border' do
it 'displays table' do
- subject.to_s.should == <<-EOS.normalize
+ expect(table.to_s).to eq <<-EOS.normalize
h1 h2 h3
a1 a2 a3
b1 b2 b3
EOS
end
@@ -33,11 +33,11 @@
context 'with ascii border' do
let(:renderer) { :ascii }
it 'displays table' do
- subject.render(renderer).should == <<-EOS.normalize
+ expect(table.render(renderer)).to eq <<-EOS.normalize
+--+--+--+
|h1|h2|h3|
+--+--+--+
|a1|a2|a3|
|b1|b2|b3|
@@ -48,10 +48,10 @@
context 'with unicode border' do
let(:renderer) { :unicode}
it 'displays table' do
- subject.render(renderer).should == <<-EOS.normalize
+ expect(table.render(renderer)).to eq <<-EOS.normalize
┌──┬──┬──┐
│h1│h2│h3│
├──┼──┼──┤
│a1│a2│a3│
│b1│b2│b3│