Skip to content
This repository has been archived by the owner on May 11, 2022. It is now read-only.

Commit

Permalink
Merge fb7d349 into a1a8207
Browse files Browse the repository at this point in the history
  • Loading branch information
jcoyne committed Jun 3, 2019
2 parents a1a8207 + fb7d349 commit b06c175
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/dor/static_config/fedora_config.rb
Expand Up @@ -10,6 +10,10 @@ def initialize(hash)
@url = hash.fetch(:url)
end

def configure(&block)
instance_eval(&block)
end

def client
CertificateAuthenticatedRestResourceFactory.create(:fedora)
end
Expand Down
4 changes: 4 additions & 0 deletions lib/dor/static_config/solr_config.rb
Expand Up @@ -8,6 +8,10 @@ def initialize(hash)
@url = hash.fetch(:url)
end

def configure(&block)
instance_eval(&block)
end

def url(new_value = nil)
@url = new_value if new_value
@url
Expand Down
4 changes: 4 additions & 0 deletions lib/dor/static_config/workflow_config.rb
Expand Up @@ -11,6 +11,10 @@ def initialize(hash)
@shift_age = hash.fetch(:shift_age)
end

def configure(&block)
instance_eval(&block)
end

def client
@client ||= Dor::Workflow::Client.new(url: url, logger: client_logger, timeout: timeout)
end
Expand Down
24 changes: 24 additions & 0 deletions spec/static_config_spec.rb
Expand Up @@ -21,4 +21,28 @@
it { is_expected.to eq URI('http://mynewurl.edu/workflow') }
end
end

describe 'nested config' do
before do
config.configure do
fedora do
url 'my-fedora'
end

solr do
url 'my-solr'
end

workflow do
url 'my-workflow'
end
end
end

it 'configures the items' do
expect(config.fedora.url).to eq 'my-fedora'
expect(config.solr.url).to eq 'my-solr'
expect(config.workflow.url).to eq 'my-workflow'
end
end
end

0 comments on commit b06c175

Please sign in to comment.