Sha256: cd29d9cd2a5bc3052a990f2812e46a980628f4ce7be09dade9fdcb9a477392f2

Contents?: true

Size: 1.04 KB

Versions: 4

Compression:

Stored size: 1.04 KB

Contents

require File.dirname(__FILE__) + '/spec_helper'

describe XsdReader do
  let(:reader){
    XsdReader::XML.new(:xsd_file => File.expand_path(File.join(File.dirname(__FILE__), 'examples', 'ddex-v36', 'ddex-ern-v36.xsd')))
  }

  describe XsdReader::Attribute do
    let(:attribute){
      reader['NewReleaseMessage']['@MessageSchemaVersionId']
    }

    it "gives a name" do
      expect(attribute.name).to eq 'MessageSchemaVersionId'
    end

    it "gives a type information" do
      expect(attribute.type).to eq 'xs:string'
      expect(attribute.type_name).to eq 'string'
      expect(attribute.type_namespace).to eq 'xs'
    end

    it "gives a boolean required indication" do
      expect(attribute.required?).to eq true
    end
  end

  describe "[] operator" do
    it "gives attribute objects through the square brackets ([]) operator" do
      attribute = reader['NewReleaseMessage']['MessageHeader']['@LanguageAndScriptCode']
      expect(attribute.type).to eq 'xs:string'
      expect(attribute.required?).to eq false
    end
  end
end # describe XsdReader

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
xsd-reader-0.4.0 spec/attribute_spec.rb
xsd-reader-0.3.0 spec/attribute_spec.rb
xsd-reader-0.2.0 spec/attribute_spec.rb
xsd-reader-0.1.0 spec/attribute_spec.rb