Sha256: 341c6364c67a0662e2982d7e0543d3ac3532fc97aab40ac2e42fb5f15eeaefa9

Contents?: true

Size: 1.42 KB

Versions: 5

Compression:

Stored size: 1.42 KB

Contents

require "spec_helper"

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

  it_should_use tag: :docPr, name: "word_processing_drawing_object_nv_properties"

  with_no_attributes_set do
    it_should_output "<wp:docPr/>", assign: false
  end

  for_attribute(:description) do
    with_value("valid value")do
      it_should_assign_successfully
      it_should_output "<wp:docPr descr=\"valid value\"/>"
    end

    with_value(1234) do
      it_should_raise_an_exception
    end
  end

  for_attribute(:hidden) do
    with_value(true)do
      it_should_assign_successfully
      it_should_output "<wp:docPr hidden=\"true\"/>"
    end

    with_value(1234) do
      it_should_raise_an_exception
    end
  end

  for_attribute(:id) do
    with_value(1)do
      it_should_assign_successfully
      it_should_output "<wp:docPr id=\"1\"/>"
    end

    with_value("invalid") do
      it_should_raise_an_exception
    end
  end

  for_attribute(:object_name, displays_as: :name) do
    with_value("valid")do
      it_should_assign_successfully
      it_should_output "<wp:docPr name=\"valid\"/>"
    end

    with_value(1234) do
      it_should_raise_an_exception
    end
  end

  for_attribute(:title) do
    with_value("valid")do
      it_should_assign_successfully
      it_should_output "<wp:docPr title=\"valid\"/>"
    end

    with_value(1234) do
      it_should_raise_an_exception
    end
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

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