Sha256: 60942174015a1a6685504842e6a84dc99069dde053da813ae04db015be74ce0e

Contents?: true

Size: 1.11 KB

Versions: 2

Compression:

Stored size: 1.11 KB

Contents

require "spec_helper"

describe OpenXml::Docx::Properties::ManualWidth do
  include PropertyTestMacros

  it_should_use tag: :fitText, name: "manual_width"

  for_attribute(:id) do
    with_value(12) do
      it_should_assign_successfully
      it_should_output "<w:fitText w:id=\"12\"/>"
    end

    with_value(-134) do
      it_should_assign_successfully
      it_should_output "<w:fitText w:id=\"-134\"/>"
    end

    with_value(12.3) do
      it_should_raise_an_exception
    end

    with_value(:three) do
      it_should_raise_an_exception
    end
  end

  for_attribute(:width) do
    with_value(12) do
      it_should_assign_successfully
      it_should_output "<w:fitText w:val=\"12\"/>"
    end

    with_value(-134) do
      it_should_raise_an_exception
    end

    with_value(12.3) do
      it_should_raise_an_exception
    end

    with_value(:three) do
      it_should_raise_an_exception
    end
  end

  with_no_attributes_set do
    it_should_output "", assign: false
  end

  with_these_attributes_set(id: 50, width: 720) do
    it_should_output "<w:fitText w:id=\"50\" w:val=\"720\"/>", assign: false
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
openxml-docx-0.8.0 spec/properties/manual_width_spec.rb
openxml-docx-0.8.0.beta1 spec/properties/manual_width_spec.rb