Sha256: 8693efb0133769a08d035ce764b09a351a71db4dac383b52e8bceb5526f56d14

Contents?: true

Size: 1.1 KB

Versions: 1

Compression:

Stored size: 1.1 KB

Contents

RSpec.describe Oasis::Etm::Thead do
  let(:xml) do
    <<~XML
      <thead valign="middle">
        <row>
          <entry>Header 1</entry>
          <entry>Header 2</entry>
          <entry>Header 3</entry>
        </row>
      </thead>
    XML
  end

  describe ".from_xml" do
    subject(:thead) { described_class.from_xml(xml) }

    it "parses valign attribute" do
      expect(thead.valign).to eq("middle")
    end

    it "parses rows" do
      expect(thead.rows.size).to eq(1)
      expect(thead.rows.first.entries.size).to eq(3)
      expect(thead.rows.first.entries.first.content).to eq("Header 1")
    end
  end

  describe "#to_xml" do
    subject(:thead) do
      described_class.new(
        valign: "middle",
        rows: [
          Oasis::Etm::Row.new(
            entries: [
              Oasis::Etm::Entry.new(content: "Header 1"),
              Oasis::Etm::Entry.new(content: "Header 2"),
              Oasis::Etm::Entry.new(content: "Header 3"),
            ],
          ),
        ],
      )
    end

    it "generates valid XML" do
      expect(thead.to_xml).to be_analogous_with(xml)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
oasis-etm-0.1.0 spec/oasis/etm/thead_spec.rb