Sha256: 88b120ce1f7519d93d185a6e1ed76e932d09247fff057ae7596e4da50d35e7ac

Contents?: true

Size: 1.31 KB

Versions: 1

Compression:

Stored size: 1.31 KB

Contents

require "spec_helper"

describe Rocx::Elements::Break do
  include ElementTestMacros

  context "when creating a new break" do
    it "should not accept invalid values for the clear property" do
      expect { described_class.new(clear: :obviouslyInvalid) }.to raise_error(ArgumentError)
    end

    it "should not accept invalid values for the break_type property" do
      expect { described_class.new(break_type: :invalidType) }.to raise_error(ArgumentError)
    end
  end

  context "after initial creation" do
    before(:each) do
      @node = described_class.new
    end

    it "should still not accept invalid values for the clear property" do
      node = described_class.new
      expect { node.clear = :invalid }.to raise_error(ArgumentError)
    end

    it "should still not accept invalid values for the break_type property" do
      node = described_class.new
      expect { node.break_type = :weird }.to raise_error(ArgumentError)
    end
  end

  context "when both properties are nil" do
    before(:each) do
      @node = described_class.new
    end

    it_should_output_correct_xml
  end

  context "when either of the properties isn't nil" do
    before(:each) do
      @node = described_class.new(break_type: :page, clear: :left)
    end

    it_should_output_correct_xml node_xml: "break_with_attributes"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rocx-0.5.8 spec/elements/break_spec.rb