Sha256: 8875d9975f1f74e8ed6bff5c99771dca882fabda7f6f733c459e7761fe85e151

Contents?: true

Size: 1.27 KB

Versions: 3

Compression:

Stored size: 1.27 KB

Contents

require "spec_helper"

describe Rocx::Properties::Tab do
  include PropertyTestMacros

  it_should_use tag: :tab, name: "tab", value: [1234, :start]

  context "when assigning bad position values, it" do
    it "should raise an exception" do
      expect { @instance = described_class.new(:bad, :start) }.to raise_error(ArgumentError)
    end
  end

  context "when assigning bad type values, it" do
    it "should raise an exception" do
      expect { @instance = described_class.new(1234, :bad) }.to raise_error(ArgumentError)
    end
  end

  context "when assigniing bad leader values, it" do
    it "should raise an exception" do
      expect { @instance = described_class.new(1234, :clear, :bad) }.to raise_error(ArgumentError)
    end
  end

  context "with valid values, it" do
    before(:each) do
      @instance = described_class.new(1234, :start)
    end

    it "should return the right XML" do
      expect(xml(instance)).to eq("<w:tab w:pos=\"1234\" w:val=\"start\"/>")
    end
  end

  context "with valid values and a specified leader, it" do
    before(:each) do
      @instance = described_class.new(1234, :start, :dot)
    end

    it "should Return the right XML" do
      expect(xml(instance)).to eq("<w:tab w:pos=\"1234\" w:val=\"start\" w:leader=\"dot\"/>")
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rocx-0.7.0 spec/properties/tab_spec.rb
rocx-0.6.0 spec/properties/tab_spec.rb
rocx-0.5.8 spec/properties/tab_spec.rb