spec/lib/xml_reader_spec.rb in dwc-archive-0.9.11 vs spec/lib/xml_reader_spec.rb in dwc-archive-1.0.1

- old
+ new

@@ -1,18 +1,15 @@ -require_relative '../spec_helper' +# frozen_string_literal: true -describe DarwinCore::XmlReader do - - describe '.from_xml' do +describe DarwinCore::XmlReader do + describe ".from_xml" do + let(:file) { File.expand_path("../files/meta.xml", __dir__) } + subject { DarwinCore::XmlReader.from_xml(File.read(file)) } it "reads xml to hash" do - file = File.expand_path('../../files/meta.xml', __FILE__) - meta = subject.from_xml(File.read(file)) - expect(meta.is_a? Hash).to be_true - expect(meta[:archive].keys.sort).to eq [:core, :extension] - expect(meta[:archive][:core].keys.sort). - to eq [:attributes, :field, :files, :id] + expect(subject).to be_kind_of Hash + expect(subject[:archive].keys.sort).to eq %i[core extension] + expect(subject[:archive][:core].keys.sort). + to eq %i[attributes field files id] end - end - end