Sha256: c732661df9a0b08496cd3a297153ba58ec5a26a29bc3ddb34c4ed3057af997e8

Contents?: true

Size: 963 Bytes

Versions: 8

Compression:

Stored size: 963 Bytes

Contents

require "spec_helper"

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

  it_should_use tag: :headers, name: "headers"

  context "when trying to add headers, it" do
    before(:each) do
      @instance = described_class.new
    end

    it "should raise an exception if the header to be added isn't a header at all" do
      expect { instance << [] }.to raise_error(ArgumentError)
    end
  end

  context "when there are no headers" do
    before(:each) do
      @instance = described_class.new
    end

    it "should not output any XML" do
      expect(xml(instance)).to eq("")
    end
  end

  context "when there are borders" do
    before(:each) do
      @instance = described_class.new
      instance << OpenXml::Docx::Properties::Header.new("Something")
    end

    it "should output the correct XML" do
      expect(xml(instance)).to eq("<w:headers>\n    <w:header w:val=\"Something\"/>\n  </w:headers>")
    end
  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

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