Sha256: 787cbb135633e26fb805bf4d0a26d5b8b7d43a68aefca2117947704867761897

Contents?: true

Size: 1.18 KB

Versions: 4

Compression:

Stored size: 1.18 KB

Contents

require 'spec_helper'
module Alf
  class Renderer::Text
    describe Cell do
     
      let(:f){ Cell.new }

      specify "text_rendering" do
        Cell.new(100).text_rendering.should == "100"
        Cell.new(:hello).text_rendering.should == ":hello"
        Cell.new("hello").text_rendering.should == "hello"
        Cell.new(10.0).text_rendering.should == "10.000"
        Cell.new(10/3.0).text_rendering.should == "3.333"
        Cell.new([]).text_rendering.should == "[]"
        Cell.new([10/3.0, true]).text_rendering.should == "[3.333, true]"
        Cell.new(10/3.0, {:float_format => "%.6f"}).text_rendering.should == "3.333333"
      end

      specify "min_width" do
        Cell.new("").min_width.should == 0
        Cell.new(10/3.0).min_width.should == 5
        Cell.new("12\n5345").min_width.should == 4
      end

      specify "rendering_lines" do
        Cell.new("").rendering_lines.should == []
        Cell.new(10/3.0).rendering_lines.should == ["3.333"]
        Cell.new([10/3.0,true]).rendering_lines.should == ["[3.333, true]"]
        Cell.new("abc").rendering_lines(5).should == ["abc  "]
        Cell.new(12).rendering_lines(5).should == ["   12"]
      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_cell.rb
alf-core-0.14.0 spec/unit/alf-io/renderer/text/test_cell.rb
alf-core-0.13.1 spec/unit/alf-io/renderer/text/test_cell.rb
alf-core-0.13.0 spec/unit/alf-io/renderer/text/test_cell.rb