Sha256: b8542bf81ff44416d5edb815838cd4cb23347a25ddebee1f61e427db0cc1e9c3

Contents?: true

Size: 1.43 KB

Versions: 6

Compression:

Stored size: 1.43 KB

Contents

require "spec_helper"

describe OpenXml::Docx::Elements::WordProcessingDrawingWrapSquare do
  include ElementTestMacros

  it_should_use tag: :wrapSquare, name: "word_processing_drawing_wrap_square"

  for_attribute(:distance_from_bottom) do
    with_value(1) do
      it_should_assign_successfully
      it_should_output "<wp:wrapSquare distB=\"1\"/>"
    end

    with_value(-1) do
      it_should_raise_an_exception
    end
  end

  for_attribute(:distance_from_left) do
    with_value(1) do
      it_should_assign_successfully
      it_should_output "<wp:wrapSquare distL=\"1\"/>"
    end

    with_value(-1) do
      it_should_raise_an_exception
    end
  end

  for_attribute(:distance_from_right) do
    with_value(1) do
      it_should_assign_successfully
      it_should_output "<wp:wrapSquare distR=\"1\"/>"
    end

    with_value(-1) do
      it_should_raise_an_exception
    end
  end

  for_attribute(:distance_from_top) do
    with_value(1) do
      it_should_assign_successfully
      it_should_output "<wp:wrapSquare distT=\"1\"/>"
    end

    with_value(-1) do
      it_should_raise_an_exception
    end
  end

  for_attribute(:wrap_text) do
    %i(bothSides largest left right).each do |good_value|
      with_value(good_value) do
        it_should_assign_successfully
        it_should_output "<wp:wrapSquare wrapText=\"#{good_value}\"/>"
      end

      with_value(:bad_value) do
        it_should_raise_an_exception
      end
    end
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
openxml-docx-0.10.6 spec/elements/word_processing_drawing_wrap_square_spec.rb
openxml-docx-0.10.5 spec/elements/word_processing_drawing_wrap_square_spec.rb
openxml-docx-0.10.4 spec/elements/word_processing_drawing_wrap_square_spec.rb
openxml-docx-0.10.3 spec/elements/word_processing_drawing_wrap_square_spec.rb
openxml-docx-0.10.2 spec/elements/word_processing_drawing_wrap_square_spec.rb
openxml-docx-0.10.1 spec/elements/word_processing_drawing_wrap_square_spec.rb