Sha256: 3d715f8833b201993b8741619e8a5515e8c319c927a204fc323d9ddfb57f3cf7

Contents?: true

Size: 1.62 KB

Versions: 7

Compression:

Stored size: 1.62 KB

Contents

module Ezid
  RSpec.describe Identifier, ezid: true do

    before {
      @identifier = described_class.mint(TEST_ARK_SHOULDER, target: "http://example.com")
    }

    describe "CRUD operations" do
      describe "mint" do
        subject { @identifier }
        it { is_expected.to be_a(described_class) }
      end
      describe "create" do
        subject { described_class.create("#{@identifier}/123") }
        it "should create the identifier" do
          expect(subject).to be_a(described_class)
          expect(subject.id).to eq("#{@identifier}/123")
        end
      end
      describe "retrieve" do
        subject { described_class.find(@identifier.id) }
        it "instantiates the identifier" do
          expect(subject).to be_a(described_class)
          expect(subject.id).to eq(@identifier.id)
          expect(subject.target).to eq("http://example.com")
        end
      end
      describe "update" do
        specify {
          subject.target = "http://google.com"
          subject.save
          expect(subject.target).to eq("http://google.com")
        }
        specify {
          subject.update(target: "http://www.microsoft.com")
          expect(subject.target).to eq("http://www.microsoft.com")
        }
      end
      describe "delete" do
        subject { described_class.mint(TEST_ARK_SHOULDER, status: "reserved") }
        # Getting 400 Bad Request response - DCS 3/22/21
        xit "deletes the identifier" do
          subject.delete
          expect(subject).to be_deleted
          expect { described_class.find(subject.id) }.to raise_error(IdentifierNotFoundError)
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ezid-client-1.10.0 spec/integration/identifier_spec.rb
ezid-client-1.9.4 spec/integration/identifier_spec.rb
ezid-client-1.9.3 spec/integration/identifier_spec.rb
ezid-client-1.9.2 spec/integration/identifier_spec.rb
ezid-client-1.9.1 spec/integration/identifier_spec.rb
ezid-client-1.9.0 spec/integration/identifier_spec.rb
ezid-client-1.9.0.rc1 spec/integration/identifier_spec.rb