Sha256: 93468709ea0c33209cb50c87e092d7d04d98fd8f4d227bb38f186220efaae993

Contents?: true

Size: 1.22 KB

Versions: 1

Compression:

Stored size: 1.22 KB

Contents

require "test_helper"

class ConditionalFormattingTest < PropertyTest
  attr_reader :cnf_style

  context "always" do
    setup do
      @cnf_style = Rocx::Properties::ConditionalFormatting.new
    end

    should "have the correct tag" do
      assert_equal :cnfStyle, cnf_style.tag
    end

    should "have the correct name" do
      assert_equal "conditional_formatting", cnf_style.name
    end
  end

  context "trying to set an invalid property" do
    should "raise an error" do
      assert_raises ArgumentError do
        @cnf_style = Rocx::Properties::ConditionalFormatting.new(bad: true)
      end
    end
  end

  context "trying to set an invalid value to a valid property" do
    should "raise an error" do
      assert_raises ArgumentError do
        @cnf_style = Rocx::Properties::ConditionalFormatting.new(even_v: :bad)
      end
    end
  end

  context "with valid properties and values, it" do
    setup do
      @cnf_style = Rocx::Properties::ConditionalFormatting.new(first_row: true, first_column: true, first_row_first_column: true)
    end

    should "render the correct XML" do
      assert_equal "<w:cnfStyle w:first_column=\"true\" w:first_row=\"true\" w:first_row_first_column=\"true\"/>", xml(cnf_style)
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rocx-0.5.6 test/properties/conditional_formatting_test.rb