Sha256: 5bbf0dfc45023393c0fb3f3776e45cf77f5a274a7067d4637e6d08a85698e1c6

Contents?: true

Size: 967 Bytes

Versions: 3

Compression:

Stored size: 967 Bytes

Contents

require "spec_helper"

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

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

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

    it "lists the types" do
      subject.types.keys.sort.should == ["Article", "Save"]
    end

    it "records the namespace for each type" do
      subject.types["Save"][:namespace].should == "http://example.com/actions"
    end

    it "records the fields under a type" do
      subject.types["Save"].keys.should =~ ["article", :namespace]
    end

    it "records multiple fields when there are more than one" do
      subject.types["Article"].keys.should =~ ["Title", "Author", :namespace]
    end

    it "records the type of a field" do
      subject.types["Save"]["article"][:type].should == "article:Article"
      subject.namespaces["article"].should == "http://example.com/article"
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
wasabi-2.1.1 spec/wasabi/parser/multiple_namespaces_spec.rb
wasabi-2.1.0 spec/wasabi/parser/multiple_namespaces_spec.rb
wasabi-2.0.0 spec/wasabi/parser/multiple_namespaces_spec.rb