Sha256: 85e20da0c3185055efc1e729952d0dbecd5c875173af7f8595e1926cef882a3a

Contents?: true

Size: 1.05 KB

Versions: 10

Compression:

Stored size: 1.05 KB

Contents

require "spec_helper"

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

  it_should_use tag: :tabs, name: "tabs"

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

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

  context "when there are no tabs" 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 tabs" do
    before(:each) do
      @instance = described_class.new
      instance << OpenXml::Docx::Properties::Tab.new(1234, :start)
      instance << OpenXml::Docx::Properties::Tab.new(5678, :end, :heavy)
    end

    it "should output the correct XML" do
      expect(xml(instance)).to eq("<w:tabs>\n    <w:tab w:pos=\"1234\" w:val=\"start\"/>\n    <w:tab w:pos=\"5678\" w:val=\"end\" w:leader=\"heavy\"/>\n  </w:tabs>")
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

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