Sha256: 5c0fe0defe3cc07d01053de300c617104f93cda3a7952c73f87f2457dfabd282

Contents?: true

Size: 805 Bytes

Versions: 19

Compression:

Stored size: 805 Bytes

Contents

require File.join(File.dirname(__FILE__), 'test_helper')

describe "auto table" do
  it "converts nonarrays to arrays and renders" do
    require 'set'
    # rubinius sorts Set#to_a differently
    arr = RUBY_DESCRIPTION.include?('rubinius') ? Set.new([1,2,3]).to_a : [1,2,3]

    expected_table = <<-TABLE.unindent
    +-------+
    | value |
    +-------+
    | #{arr[0]}     |
    | #{arr[1]}     |
    | #{arr[2]}     |
    +-------+
    3 rows in set
    TABLE
    Helpers::AutoTable.render(::Set.new([1,2,3])).should == expected_table
  end

  it "renders hash" do
    expected_table = <<-TABLE.unindent
    +---+-------+
    | 0 | 1     |
    +---+-------+
    | a | 12345 |
    +---+-------+
    1 row in set
    TABLE
    Helpers::AutoTable.render({:a=>12345}).should == expected_table
  end
end

Version data entries

19 entries across 18 versions & 3 rubygems

Version Path
hirber-0.8.5 test/auto_table_test.rb
hirber-0.8.4 test/auto_table_test.rb
hirber-0.8.2 test/auto_table_test.rb
hirber-0.8.1 test/auto_table_test.rb
hirber-0.8.0 test/auto_table_test.rb
hirb-0.7.3 test/auto_table_test.rb
climine-0.0.7 vendor/bundle/ruby/2.0.0/gems/hirb-0.7.1/test/auto_table_test.rb
climine-0.0.7 vendor/bundle/ruby/2.1.0/gems/hirb-0.7.1/test/auto_table_test.rb
hirb-0.7.2 test/auto_table_test.rb
climine-0.0.6 vendor/bundle/ruby/2.0.0/gems/hirb-0.7.1/test/auto_table_test.rb
climine-0.0.5 vendor/bundle/ruby/2.0.0/gems/hirb-0.7.1/test/auto_table_test.rb
climine-0.0.4 vendor/bundle/ruby/2.0.0/gems/hirb-0.7.1/test/auto_table_test.rb
climine-0.0.3 vendor/bundle/ruby/2.0.0/gems/hirb-0.7.1/test/auto_table_test.rb
climine-0.0.2 vendor/bundle/ruby/2.0.0/gems/hirb-0.7.1/test/auto_table_test.rb
climine-0.0.1 vendor/bundle/ruby/2.0.0/gems/hirb-0.7.1/test/auto_table_test.rb
hirb-0.7.1 test/auto_table_test.rb
hirb-0.7.0 test/auto_table_test.rb
hirb-0.6.2 test/auto_table_test.rb
hirb-0.6.1 test/auto_table_test.rb