Sha256: 9c371751ed69b80b6a32b8ff86f1e5c5906c86ceae27484af71edcbf529c3857

Contents?: true

Size: 953 Bytes

Versions: 1

Compression:

Stored size: 953 Bytes

Contents

require 'spec_helper'

describe ActiveFedora::Noid::Config do
  it { is_expected.to respond_to(:template) }
  it { is_expected.to respond_to(:statefile) }
  it { is_expected.to respond_to(:translate_id_to_uri) }
  it { is_expected.to respond_to(:translate_uri_to_id) }

  describe '#template' do
    let(:default) { '.reeddeeddk' }

    it 'has a default' do
      expect(subject.template).to eq default
    end

    describe 'overriding' do
      before { subject.template = custom_template }

      let(:custom_template) { '.dddddd' }

      it 'allows setting a custom template' do
        expect(subject.template).to eq custom_template
      end
    end
  end

  describe '#translate_uri_to_id' do
    let(:translator) { described_class.new.translate_uri_to_id }
    let(:uri) { "http://localhost:8983/fedora/rest/test/hh/63/vz/22/hh63vz22q/members" }
    subject { translator.call(uri) }

    it { is_expected.to eq 'hh63vz22q/members' }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
active_fedora-noid-0.3.0 spec/unit/config_spec.rb