Sha256: 47eaf9c111c7b65d10173a69d03d3293e75a87f09863652ef7218aa718d68b63

Contents?: true

Size: 1.9 KB

Versions: 8

Compression:

Stored size: 1.9 KB

Contents

require "spec_helper"

describe OpenXml::Docx::Properties::Border do
  include PropertyTestMacros

  context "always" do
    before(:each) do
      @instance = described_class.new(:left)
    end

    it "should have the right name" do
      expect(instance.name).to eq("border")
    end

    it "should have its tag be equal to the argument passed on initialize" do
      expect(instance.tag).to eq(:left)
    end
  end

  context "when no tag is specified" do
    before(:each) do
      @instance = described_class.new
      instance.color = "FF00FF"
      instance.type = :crazyMaze
    end

    it "should have its tag be :bdr" do
      expect(instance.tag).to eq(:bdr)
    end

    it_should_output "<w:bdr w:color=\"FF00FF\" w:val=\"crazyMaze\"/>", assign: false
  end

  for_attribute(:color) do
    values = ["4581BD", :auto]
    it_should_assign_and_output_xml values
    it_should_not_allow_invalid_value
  end

  for_attribute(:frame) do
    it_should_behave_like_a_boolean_attribute
    it_should_not_allow_invalid_value
  end

  for_attribute(:shadow) do
    it_should_behave_like_a_boolean_attribute
    it_should_not_allow_invalid_value
  end

  for_attribute(:size) do
    it_should_assign_and_output_xml 24
    it_should_not_allow_negative_numbers
    it_should_not_allow_invalid_value
  end

  for_attribute(:space) do
    it_should_assign_and_output_xml 24
    it_should_not_allow_negative_numbers
    it_should_not_allow_invalid_value
  end

  for_attribute(:theme_color) do
    it_should_assign_and_output_xml :hyperlink
    it_should_not_allow_invalid_value
  end

  for_attribute(:theme_shade) do
    it_should_assign_and_output_xml "BF"
    it_should_not_allow_invalid_value
  end

  for_attribute(:theme_tint) do
    it_should_assign_and_output_xml "BF"
    it_should_not_allow_invalid_value
  end

  for_attribute(:type) do
    it_should_assign_and_output_xml :single
    it_should_not_allow_invalid_value
  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
openxml-docx-0.10.6 spec/properties/border_spec.rb
openxml-docx-0.10.5 spec/properties/border_spec.rb
openxml-docx-0.10.4 spec/properties/border_spec.rb
openxml-docx-0.10.3 spec/properties/border_spec.rb
openxml-docx-0.10.2 spec/properties/border_spec.rb
openxml-docx-0.10.1 spec/properties/border_spec.rb
openxml-docx-0.10.0 spec/properties/border_spec.rb
openxml-docx-0.9.0 spec/properties/border_spec.rb