Sha256: 0f3b699717a0090a3cb10dbd2efc2f900cdd2c3372064b99e12cb13fa6e178c9

Contents?: true

Size: 1.28 KB

Versions: 2

Compression:

Stored size: 1.28 KB

Contents

require "spec_helper"

describe OpenXml::DrawingML::Elements::ShapeGuide do
  include ElementTestMacros

  it_should_use tag: :gd, name: "shape_guide"

  formulae = [ "*/ h 10 -100",
               "+- h 10 -100",
               "+/ h 10 -100",
               "?: h 10 -100",
               "abs -100",
               "at2 h w",
               "cat2 h w 100",
               "cos h w",
               "max 100 200",
               "min 100 200",
               "mod h w 10",
               "pin h 10 -100",
               "sat2 h 10 -100",
               "sin h w",
               "sqrt 4",
               "tan h w",
               "val 100" ] # Arguments to formulae can be a variable, a positive integer, or a negative integer

  for_attribute(:guide_name, displays_as: :name) do
    with_value("Some String") do
      it_should_assign_successfully
      it_should_output_regular_xml
    end

    with_values([1, :not_a_string]) do
      it_should_raise_an_exception
    end
  end

  for_attribute(:formula, displays_as: :fmla) do
    with_values(formulae) do
      it_should_assign_successfully
      it_should_output_regular_xml
    end

    not_allowed = ["a^2 + b^2 = c^2", "Not a formula", 2 ]
    with_values(not_allowed) do # Not a valid formula
      it_should_raise_an_exception
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
openxml-docx-0.10.1 spec/elements/drawingml/shape_guide_spec.rb
openxml-docx-0.10.0 spec/elements/drawingml/shape_guide_spec.rb