Sha256: c6901be9ac8d8062a8f15469909e24a52281c0f692f83fb241e92796b27136ba

Contents?: true

Size: 1.14 KB

Versions: 3

Compression:

Stored size: 1.14 KB

Contents

require "spec_helper"

describe Wasabi::Parser do
  context "with: multiple_namespaces.wsdl" do

    subject do
      parser = Wasabi::Parser.new Nokogiri::XML(xml)
      parser.parse
      parser
    end

    let(:xml) { fixture(:multiple_namespaces).read }

    it "lists the types" do
      expect(subject.types.keys.sort).to eq(["Article", "Save"])
    end

    it "records the namespace for each type" do
      expect(subject.types["Save"][:namespace]).to eq("http://example.com/actions")
    end

    it "records the fields under a type" do
      expect(subject.types["Save"].keys).to match_array(["article", :namespace, :order!])
    end

    it "records multiple fields when there are more than one" do
      expect(subject.types["Article"].keys).to match_array(["Title", "Author", :namespace, :order!])
    end

    it "records the type of a field" do
      expect(subject.types["Save"]["article"][:type]).to eq("article:Article")
      expect(subject.namespaces["article"]).to eq("http://example.com/article")
    end

    it "lists the order of the type elements" do
      expect(subject.types["Article"][:order!]).to eq(["Author", "Title"])
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
wasabi-3.5.0 spec/wasabi/parser/multiple_namespaces_spec.rb
wasabi-3.4.0 spec/wasabi/parser/multiple_namespaces_spec.rb
wasabi-3.3.1 spec/wasabi/parser/multiple_namespaces_spec.rb