Sha256: 0294fccd2c40593b0a2cf98ca021c89db95592899508198d38ea44d71a6665ec

Contents?: true

Size: 875 Bytes

Versions: 8

Compression:

Stored size: 875 Bytes

Contents

require 'spec_helper'

describe ActiveFedora::Noid::Service do
  describe 'public API' do
    it { is_expected.to respond_to(:valid?) }
    it { is_expected.to respond_to(:mint) }
  end

  it 'has a default minter' do
    expect(subject.minter).to be_instance_of ActiveFedora::Noid::SynchronizedMinter
  end

  context 'with a custom minter' do
    let(:minter) { double('minter') }
    let(:identifier) { 'abc123' }
    let(:new_service) { ActiveFedora::Noid::Service.new(minter) }

    it 'allows injecting a custom minter' do
      expect(new_service.minter).to eq minter
    end

    it 'delegates validity checking to the minter' do
      expect(minter).to receive(:valid?).with(identifier).once
      new_service.valid? identifier
    end

    it 'delegates minting to the minter' do
      expect(minter).to receive(:mint).once
      new_service.mint
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
active_fedora-noid-1.1.3 spec/unit/service_spec.rb
active_fedora-noid-1.1.2 spec/unit/service_spec.rb
active_fedora-noid-1.1.1 spec/unit/service_spec.rb
active_fedora-noid-1.1.0 spec/unit/service_spec.rb
active_fedora-noid-1.0.3 spec/unit/service_spec.rb
active_fedora-noid-1.0.2 spec/unit/service_spec.rb
active_fedora-noid-1.0.1 spec/unit/service_spec.rb
active_fedora-noid-0.3.0 spec/unit/service_spec.rb