Sha256: 8762206f23feac0e33f98f6b1e9e5980f0068d74816c3ce2b4bb50e647eb25ae

Contents?: true

Size: 1.03 KB

Versions: 4

Compression:

Stored size: 1.03 KB

Contents

require 'spec_helper'
module Alf
  class Renderer::Text
    describe Table do
     
      let(:columns){ [ :method, :total ] }
      let(:table){ Table.new(records, columns) }

      describe "on an empty table" do

        let(:records){ [ ] }

        specify "to_s" do
          table.to_s.should == "+---------+--------+\n" +
                               "| :method | :total |\n" +
                               "+---------+--------+\n" +
                               "+---------+--------+\n"
        end

      end

      describe "when single values are used only" do

        let(:records){ [ [:by_x, 10.0], [:by_y, 2.0] ] }

        specify "to_s" do
          table.to_s.should == "+---------+--------+\n" +
                               "| :method | :total |\n" +
                               "+---------+--------+\n" +
                               "| :by_x   | 10.000 |\n" +
                               "| :by_y   |  2.000 |\n" +
                               "+---------+--------+\n"
        end

      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
alf-core-0.15.0 spec/unit/alf-io/renderer/text/test_table.rb
alf-core-0.14.0 spec/unit/alf-io/renderer/text/test_table.rb
alf-core-0.13.1 spec/unit/alf-io/renderer/text/test_table.rb
alf-core-0.13.0 spec/unit/alf-io/renderer/text/test_table.rb