Sha256: 5e07f60f10a5b361615592c4752df67b452069d8afcaea5da4eb4b5053c3edcf

Contents?: true

Size: 764 Bytes

Versions: 5

Compression:

Stored size: 764 Bytes

Contents

require 'test/unit'
require 'spec_id'
require 'ostruct'

class Bob
  include SpecIDXML
  def initialize(first, second)
    @first = first ; @second = second 
  end
end


class SpecIDXMLTest < Test::Unit::TestCase
  include SpecIDXML

  def initialize(*args)
    super(*args)
  end

  def test_short_element_xml_from_instance_vars
    obj = Bob.new(1, 2) 
    st = obj.short_element_xml_from_instance_vars("bob")
    assert_match(/second="2"/, st)
    assert_match(/first="1"/, st)
    assert_match(/^<bob /, st)
    assert_match(/>$/, st)
  end

  def test_escape_special_chars
    assert_equal("&amp;&gt;&lt;&quot;&apos;" , escape_special_chars("&><\"'"))
    assert_equal("PE&amp;PT&gt;I&lt;D&quot;E&apos;", escape_special_chars("PE&PT>I<D\"E'"))
  end

end
  

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
mspire-0.1.7 test/tc_spec_id_xml.rb
mspire-0.2.0 test/tc_spec_id_xml.rb
mspire-0.2.1 test/tc_spec_id_xml.rb
mspire-0.2.2 test/tc_spec_id_xml.rb
mspire-0.2.4 test/tc_spec_id_xml.rb