Sha256: 25286bed1f6b2ab599c967f54d8515974a09368bcb858a3a8c902d3e69e4858e

Contents?: true

Size: 1.42 KB

Versions: 31

Compression:

Stored size: 1.42 KB

Contents

require 'test/unit'
require 'soap/marshal'
require 'rbconfig'
require File.join(File.dirname(File.expand_path(__FILE__)), '..', '..', '..', '..', 'testutil.rb')


module WSDL; module SOAP


class TestSection < Test::Unit::TestCase
  DIR = File.dirname(File.expand_path(__FILE__))
  RUBY = Config::CONFIG['RUBY_INSTALL_NAME']

  def setup
    system("cd #{DIR} && #{RUBY} #{pathname("../../../../../bin/xsd2ruby.rb")} --xsd #{pathname("section.xsd")} --classdef --force --quiet")
  end

  def teardown
    File.unlink(pathname("mysample.rb")) unless $DEBUG
  end

  def test_classdef
    compare("expectedClassdef.rb", "mysample.rb")
  end

  def test_marshal
    # avoid name crash (<item> => an Item when a class Item is defined)
    if ::Object.constants.include?("Item")
      ::Object.instance_eval { remove_const("Item") }
    end
    TestUtil.require(DIR, 'mysample.rb')
    s1 = Section.new(1, "section1", "section 1", 1001, Question.new("q1"))
    s2 = Section.new(2, "section2", "section 2", 1002, Question.new("q2"))
    org = SectionArray[s1, s2]
    obj = ::SOAP::Marshal.unmarshal(::SOAP::Marshal.marshal(org))
    assert_equal(SectionArray, obj.class)
    assert_equal(Section, obj[0].class)
    assert_equal(Question, obj[0].firstQuestion.class)
  end

private

  def pathname(filename)
    File.join(DIR, filename)
  end

  def compare(expected, actual)
    TestUtil.filecompare(pathname(expected), pathname(actual))
  end
end


end; end

Version data entries

31 entries across 31 versions & 13 rubygems

Version Path
mumboe-soap4r-1.6.0.pre.beta test/wsdl/soap/wsdl2ruby/section/test_section.rb
DefV-soap4r-1.5.8.2 test/wsdl/soap/wsdl2ruby/section/test_section.rb
mumboe-soap4r-1.5.8.7 test/wsdl/soap/wsdl2ruby/section/test_section.rb
teo-soap4r-1.5.9b test/wsdl/soap/wsdl2ruby/section/test_section.rb
mumboe-soap4r-1.5.8.6 test/wsdl/soap/wsdl2ruby/section/test_section.rb
soap4r-spox-1.6.0 test/wsdl/soap/wsdl2ruby/section/test_section.rb
soap4r-r19-1.5.9 test/wsdl/soap/wsdl2ruby/section/test_section.rb
mumboe-soap4r-1.5.8.5 test/wsdl/soap/wsdl2ruby/section/test_section.rb
soap4r-ruby1.9-2.0.5 test/wsdl/soap/wsdl2ruby/section/test_section.rb
soap4r-sgonyea-1.6.0 test/wsdl/soap/wsdl2ruby/section/test_section.rb
soap4r-straightjacket-1.5.9 test/wsdl/soap/wsdl2ruby/section/test_section.rb
soap4r-straightjacket-1.5.8 test/wsdl/soap/wsdl2ruby/section/test_section.rb
soap4r-ruby1.9-2.0.3 test/wsdl/soap/wsdl2ruby/section/test_section.rb
soap4r-ruby1.9-2.0.2 test/wsdl/soap/wsdl2ruby/section/test_section.rb
soap4r-ruby1.9-2.0.1 test/wsdl/soap/wsdl2ruby/section/test_section.rb
mumboe-soap4r-1.5.8.4 test/wsdl/soap/wsdl2ruby/section/test_section.rb
soap4r-ruby1.9-2.0.0 test/wsdl/soap/wsdl2ruby/section/test_section.rb
hands-soap4r-1.5.8.4 test/wsdl/soap/wsdl2ruby/section/test_section.rb
soap4r-ruby1.9-1.0.0 test/wsdl/soap/wsdl2ruby/section/test_section.rb
snaury-soap4r-1.5.8.1 test/wsdl/soap/wsdl2ruby/section/test_section.rb