Sha256: 0319d564422731dab6836919b9d713eea47eaa7e516eea932287f9fa065cf8b7

Contents?: true

Size: 1.07 KB

Versions: 1

Compression:

Stored size: 1.07 KB

Contents

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

describe XsdReader do
  before :all do
    @reader ||= XsdReader::XML.new(:xsd_file => File.expand_path(File.join(File.dirname(__FILE__), 'examples', 'ddex-ern-v36.xsd')))
  end

  describe XsdReader::Attribute do
    before :each do
      @attribute = @reader['NewReleaseMessage']['@MessageSchemaVersionId']
    end

    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

1 entries across 1 versions & 1 rubygems

Version Path
xsd-reader-0.0.1 spec/attribute_spec.rb