Sha256: 98d8f7b6389b666f11ce6bbc2e37676288d5d7649d725ae3e4cf740a610d9f3f

Contents?: true

Size: 1.32 KB

Versions: 2

Compression:

Stored size: 1.32 KB

Contents

require "assert"
require 'xmlss/element/row'

class Xmlss::Element::Row

  class UnitTests < Assert::Context
    desc "Xmlss::Element::Row"
    before { @row = Xmlss::Element::Row.new }
    subject { @row }

    should be_styled
    should have_class_method :writer
    should have_accessors :height, :auto_fit_height, :autofit, :hidden
    should have_readers   :autofit?, :hidden?

    should "know its writer hook" do
      assert_equal :row, subject.class.writer
    end

    should "set it's defaults" do
      assert_nil subject.height
      assert_equal false, subject.auto_fit_height
      assert_equal false, subject.hidden
    end

    should "bark when setting non Numeric height" do
      assert_raises ArgumentError do
        Xmlss::Element::Row.new({:height => "do it"})
      end

      assert_nothing_raised do
        Xmlss::Element::Row.new({:height => 2})
      end

      assert_nothing_raised do
        Xmlss::Element::Row.new({:height => 3.5})
      end
    end

    should "nil out height values that are < 0" do
      assert_equal nil, Xmlss::Element::Row.new({:height => -1.2}).height
      assert_equal nil, Xmlss::Element::Row.new({:height => -1}).height
      assert_equal 0,   Xmlss::Element::Row.new({:height => 0}).height
      assert_equal 1.2, Xmlss::Element::Row.new({:height => 1.2}).height
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
xmlss-1.0.1 test/unit/element/row_tests.rb
xmlss-1.0.0 test/unit/element/row_tests.rb