Sha256: c5b6861216a9447c94c07b215fd2f6e3409829fe88031e478a21ea9474a9f745

Contents?: true

Size: 700 Bytes

Versions: 4

Compression:

Stored size: 700 Bytes

Contents

require 'ezid/proxy_identifier'

module Ezid
  RSpec.describe ProxyIdentifier do

    describe "initialization" do
      it "should not load the real identifier" do
        expect(Identifier).not_to receive(:find)
        described_class.new("ark:/99999/fk4fn19h88")
      end
    end

    describe "lazy loading" do
      subject { described_class.new(id) }

      let(:id) { "ark:/99999/fk4fn19h88" }
      let(:real) { double(id: id, target: "http://ezid.cdlib.org/id/#{id}") }

      it "should load the real identifier when calling a missing method" do
        expect(Identifier).to receive(:find).with(id) { real }
        expect(subject.target).to eq(real.target)
      end
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ezid-client-1.4.1 spec/unit/proxy_identifier_spec.rb
ezid-client-1.4.0 spec/unit/proxy_identifier_spec.rb
ezid-client-1.3.0 spec/unit/proxy_identifier_spec.rb
ezid-client-1.2.0 spec/unit/proxy_identifier_spec.rb