Sha256: c8fd168ce9500e14b394151e9f7588138d32b4627f721ebadc196b98027babe5

Contents?: true

Size: 1.05 KB

Versions: 7

Compression:

Stored size: 1.05 KB

Contents

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

      describe "on an empty table" do

        let(:records){ [ ] }

        specify "render" do
          table.render.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 "render" do
          table.render.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

7 entries across 7 versions & 1 rubygems

Version Path
alf-0.12.2 spec/unit/alf-core/text/test_table.rb
alf-0.12.1 spec/unit/alf-core/text/test_table.rb
alf-0.12.0 spec/unit/alf-core/text/test_table.rb
alf-0.11.1 spec/unit/alf-core/text/test_table.rb
alf-0.11.0 spec/unit/alf-core/text/test_table.rb
alf-0.10.1 spec/unit/text/test_table.rb
alf-0.10.0 spec/unit/text/test_table.rb