spec/attribute_spec.rb in xsd-reader-0.0.1 vs spec/attribute_spec.rb in xsd-reader-0.1.0

- old
+ new

@@ -1,34 +1,34 @@ 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 + 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 - before :each do - @attribute = @reader['NewReleaseMessage']['@MessageSchemaVersionId'] - end + let(:attribute){ + reader['NewReleaseMessage']['@MessageSchemaVersionId'] + } it "gives a name" do - expect(@attribute.name).to eq 'MessageSchemaVersionId' + 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' + 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 + 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'] + attribute = reader['NewReleaseMessage']['MessageHeader']['@LanguageAndScriptCode'] expect(attribute.type).to eq 'xs:string' expect(attribute.required?).to eq false end end end # describe XsdReader \ No newline at end of file