Sha256: cc136b200763ef724de1234a1739b2923c49b62125d5352bd6aaa05daa6ffe11

Contents?: true

Size: 1.57 KB

Versions: 7

Compression:

Stored size: 1.57 KB

Contents

module Ezid
  RSpec.describe Identifier, integration: 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") }
        it "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.8.0 spec/integration/identifier_spec.rb
ezid-client-1.7.1 spec/integration/identifier_spec.rb
ezid-client-1.7.0 spec/integration/identifier_spec.rb
ezid-client-1.6.0 spec/integration/identifier_spec.rb
ezid-client-1.5.0 spec/integration/identifier_spec.rb
ezid-client-1.4.3 spec/integration/identifier_spec.rb
ezid-client-1.4.2 spec/integration/identifier_spec.rb