Sha256: 2355147ea194910a6760ffcdc59cc51bb34820f44dcf0c7515d0b32767c028e9

Contents?: true

Size: 1.11 KB

Versions: 3

Compression:

Stored size: 1.11 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.0000000"
        Cell.new(10/3.0).text_rendering.should == "3.3333333"
        Cell.new([]).text_rendering.should == "[]"
        Cell.new([10/3.0, true]).text_rendering.should == "[3.3333333, true]"
      end

      specify "min_width" do
        Cell.new("").min_width.should == 0
        Cell.new(10/3.0).min_width.should == 9
        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.3333333"]
        Cell.new([10/3.0,true]).rendering_lines.should == ["[3.3333333, true]"]
        Cell.new("abc").rendering_lines(5).should == ["abc  "]
        Cell.new(12).rendering_lines(5).should == ["   12"]
      end

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
alf-0.9.2 spec/unit/renderer/text/test_cell.rb
alf-0.9.1 spec/unit/renderer/text/test_cell.rb
alf-0.9.0 spec/renderer/text/cell_spec.rb