Sha256: c5f67720a50911343ef59cd175fb96f4828205e388c33ee77be6716b1a43825b

Contents?: true

Size: 1.74 KB

Versions: 10

Compression:

Stored size: 1.74 KB

Contents

require "spec_helper"

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

  it_should_use tag: :pBdr, name: "borders"

  context "when setting values" do
    before(:each) do
      @instance = described_class.new
    end

    it "should allow modifying the left border" do
      expect { instance.left.color = :auto }.to_not raise_error
    end

    it "should allow modifying the right border" do
      expect { instance.right.size = 24 }.to_not raise_error
    end

    it "should allow modifying the top border" do
      expect { instance.top.space = 1 }.to_not raise_error
    end

    it "should allow modifying the bottom border" do
      expect { instance.bottom.type = :apples }.to_not raise_error
    end

    it "should allow modifying the between border" do
      expect { instance.between.shadow = true }.to_not raise_error
    end

    it "should allow modifying the bar border" do
      expect { instance.bar.theme_color = :accent2 }.to_not raise_error
    end

  end

  context "with no values set" do
    before(:each) do
      @instance = described_class.new
    end

    it_should_output "", assign: false
  end

  context "when one border has at least one property set" do
    before(:each) do
      @instance = described_class.new
      instance.left.type = :apples
    end

    it_should_output "<w:pBdr>\n    <w:left w:val=\"apples\"/>\n  </w:pBdr>", assign: false
  end

  context "when more than one border has at least one property set" do
    before(:each) do
      @instance = described_class.new
      instance.left.color = "FF0000"
      instance.right.type = :apples
    end

    it_should_output "<w:pBdr>\n    <w:left w:color=\"FF0000\"/>\n    <w:right w:val=\"apples\"/>\n  </w:pBdr>", assign: false
  end

end

Version data entries

10 entries across 10 versions & 1 rubygems

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