From bc16c4698376eae348a9d1222bfc1294a44b86b4 Mon Sep 17 00:00:00 2001 From: Tom Johnson Date: Tue, 21 Feb 2017 19:45:28 -0800 Subject: [PATCH] Alias authority name to `Qa::Authorities` namespace Authority registration is a hard coded constantize within this namespace. Pending work on a registry, this aliases `Qa::LDF::Authority` classes to the namespace to expose them to Questioning Authority. See: https://github.com/projecthydra-labs/questioning_authority/issues/137 --- lib/qa/ldf/authorities/lc_names.rb | 8 ++++++++ lib/qa/ldf/spec/authority.rb | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/lib/qa/ldf/authorities/lc_names.rb b/lib/qa/ldf/authorities/lc_names.rb index 65b1a60..37c39b1 100644 --- a/lib/qa/ldf/authorities/lc_names.rb +++ b/lib/qa/ldf/authorities/lc_names.rb @@ -20,4 +20,12 @@ def search_service end end end + + ## + # Alias to hack Qa's namespaced authority logic. + # + # @see https://github.com/projecthydra-labs/questioning_authority/issues/137 + module Authorities + Lcnames = LDF::LCNames + end end diff --git a/lib/qa/ldf/spec/authority.rb b/lib/qa/ldf/spec/authority.rb index b1acf01..2d3b21f 100644 --- a/lib/qa/ldf/spec/authority.rb +++ b/lib/qa/ldf/spec/authority.rb @@ -18,6 +18,13 @@ end end + it 'is aliased to Qa::Authorities' do + unless described_class.eql?(Qa::LDF::Authority) + name = described_class.to_s.split('::').last.downcase.camelize + expect("Qa::Authorities::#{name}".constantize).to eql described_class + end + end + describe '#all' do it 'is enumerable' do expect(authority.all).to respond_to :each