Sha256: 977fb8a9a50387613efe5133c1e83c3e6035254c77e8c78369083425189b0c33

Contents?: true

Size: 864 Bytes

Versions: 6

Compression:

Stored size: 864 Bytes

Contents

# frozen_string_literal: true
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::File
  end

  context 'with a custom minter' do
    let(:minter) { double('minter') }
    let(:identifier) { 'abc123' }
    let(:new_service) { described_class.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

6 entries across 6 versions & 1 rubygems

Version Path
active_fedora-noid-2.2.0 spec/unit/service_spec.rb
active_fedora-noid-2.1.0 spec/unit/service_spec.rb
active_fedora-noid-2.0.2 spec/unit/service_spec.rb
active_fedora-noid-2.0.1 spec/unit/service_spec.rb
active_fedora-noid-2.0.0 spec/unit/service_spec.rb
active_fedora-noid-2.0.0.beta6 spec/unit/service_spec.rb