Sha256: 87da44841fabf0a49aefafdb10f14dd4170dd1e29fac0ed6da7c353661b0def0
Contents?: true
Size: 1.04 KB
Versions: 6
Compression:
Stored size: 1.04 KB
Contents
# frozen_string_literal: true shared_examples 'a minter' do describe '#mint' do subject { minter.mint } it { is_expected.not_to be_empty } it 'does not mint the same ID twice in a row' do expect(subject).not_to eq described_class.new.mint end it 'is valid' do expect(minter.valid?(subject)).to be true expect(described_class.new.valid?(subject)).to be true end context 'with a different template' do it 'is invalid' do expect(described_class.new('.reedddk').valid?(subject)).to be false end end end context 'when the id already exists' do let(:existing_id) { 'ef12ef12f' } let(:unique_id) { 'bb22bb22b' } before do expect(subject).to receive(:next_id).and_return(existing_id, unique_id) allow(subject).to receive(:identifier_in_use?).with(existing_id).and_return(true) allow(subject).to receive(:identifier_in_use?).with(unique_id).and_return(false) end it 'skips the existing id' do expect(subject.mint).to eq unique_id end end end
Version data entries
6 entries across 6 versions & 1 rubygems