spec/integration/client_spec.rb in ezid-client-0.12.0 vs spec/integration/client_spec.rb in ezid-client-0.13.0
- old
+ new
@@ -1,5 +1,7 @@
+require "time"
+
module Ezid
RSpec.describe Client do
shared_examples "an EZID client" do |client|
it "should mint and modify" do
@@ -7,11 +9,10 @@
expect(minted).to be_success
@id = minted.id
modified = client.modify_identifier(@id, "dc.title" => "Test")
expect(modified).to be_success
retrieved = client.get_identifier_metadata(@id)
- puts retrieved.class.to_s
expect(retrieved).to be_success
expect(retrieved.metadata).to match(/dc.title: Test/)
deleted = client.delete_identifier(@id)
expect(deleted).to be_success
expect { client.get_identifier_metadata(@id) }.to raise_error
@@ -58,9 +59,23 @@
it_behaves_like "an EZID client", client
end
end
describe "without a session" do
it_behaves_like "an EZID client", Client.new
+ end
+ end
+
+ describe "batch download" do
+ before do
+ r = subject.mint_identifier
+ r = subject.get_identifier_metadata(r.id)
+ metadata = Metadata.new(r.metadata)
+ @created = metadata.created.iso8601
+ end
+ it "should return a valid URL" do
+ response = subject.batch_download(format: "anvl", createdAfter: @created, permanence: "test")
+ expect(response).to be_success
+ expect(response.download_url).to match(/^http:\/\/ezid.cdlib.org\/download\/[^\/]+.gz$/)
end
end
end
end