Sha256: c413454573ebb3717e86cd58e14f9ac3ff378376fafd25f95516e34b991b6553

Contents?: true

Size: 1.07 KB

Versions: 1

Compression:

Stored size: 1.07 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.0000000 |\n" +
                                 "| :by_y   |  2.0000000 |\n" +
                                 "+---------+------------+\n"
        end

      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
alf-0.9.3 spec/unit/text/test_table.rb