spec/unit/metadata_spec.rb in ezid-client-0.7.0 vs spec/unit/metadata_spec.rb in ezid-client-0.8.0

- old
+ new

@@ -1,11 +1,11 @@ module Ezid RSpec.describe Metadata do - + describe "reserved elements" do describe "readers" do - Metadata::RESERVED_ELEMENTS.each do |element| + Metadata::RESERVED_ELEMENTS.each do |element| it "should have a reader for '#{element}'" do expect(subject).to receive(:reader).with(element) reader = (element == "_crossref") ? element : element.sub("_", "") subject.send(reader) end @@ -27,27 +27,27 @@ next if element == "_crossref" it "should have a writer for '#{element}'" do expect(subject).to receive(:writer).with(element, "value") writer = ((element == "_crossref") ? element : element.sub("_", "")).concat("=") subject.send(writer, "value") - end + end end end end describe "metadata profiles" do Metadata::PROFILES.each do |profile, elements| describe "the '#{profile}' metadata profile" do describe "readers" do - elements.each do |element| + elements.each do |element| it "should have a reader for '#{profile}.#{element}'" do expect(subject).to receive(:reader).with("#{profile}.#{element}") subject.send("#{profile}_#{element}") end end end describe "writers" do - elements.each do |element| + elements.each do |element| it "should have a writer for '#{profile}.#{element}'" do expect(subject).to receive(:writer).with("#{profile}.#{element}", "value") subject.send("#{profile}_#{element}=", "value") end end @@ -64,11 +64,11 @@ end end end describe "ANVL output" do - let(:elements) do + let(:elements) do { "_target" => "http://example.com/path%20with%20spaces", "_erc" => "who: Proust, Marcel\nwhat: Remembrance of Things Past", "_status" => "public" } end subject { described_class.new(elements) } @@ -120,10 +120,10 @@ "_created" => "1416507086", "_status" => "public" }) end end context "of a hash-like object" do - let(:hsh) do + let(:hsh) do { "_updated" => "1416507086", "_target" => "http://ezid.cdlib.org/id/ark:/99999/fk4fn19h87", "_profile" => "erc", "_ownergroup" => "apitest", "_owner" => "apitest",