spec/array_table_spec.rb in tablesmith-0.5.0 vs spec/array_table_spec.rb in tablesmith-0.6.0
- old
+ new
@@ -12,11 +12,11 @@
+---+---+---+
TABLE
[%w[a b c], %w[d e f]].to_table.to_s.should == expected
end
- def do_just_works_test(_expected, meth_id)
+ def do_just_works_test(meth_id)
orig_stdout = $stdout
sio = StringIO.new
$stdout = sio
send(meth_id, [%w[a b c], %w[d e f]].to_table)
sio.string
@@ -31,24 +31,32 @@
+---+---+---+
| d | e | f |
+---+---+---+
TABLE
- actual = do_just_works_test(expected, meth_id)
+ actual = do_just_works_test(meth_id)
actual.should == expected
end
it 'just works with print' do
just_works(:print)
end
it 'just works with puts' do
- pending
-
- # Kernel.puts has special behavior for puts with Array,
- # which Table subclasses, so this isn't going to work,
- # unless we can stop subclassing Array.
just_works(:puts)
+ end
+
+ it 'just works with p' do
+ expected = <<~TABLE
+ +---+---+---+
+ | a | b | c |
+ +---+---+---+
+ | d | e | f |
+ +---+---+---+
+ TABLE
+
+ actual = do_just_works_test(:p)
+ actual.should == "#{expected}\n"
end
it 'just works with inspect' do
expected = <<~TABLE
+---+---+---+