Sha256: 35946badcc8393d087a0ed5c1529859b896c1d6ab97b36b1ecc922f9d7ea7647

Contents?: true

Size: 844 Bytes

Versions: 1

Compression:

Stored size: 844 Bytes

Contents

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::Minter::Db
  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

1 entries across 1 versions & 1 rubygems

Version Path
active_fedora-noid-2.0.0.beta4 spec/unit/service_spec.rb