Skip to content

Commit

Permalink
Add connection configuration to the blacklight config
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeer committed Mar 27, 2015
1 parent 5f7c0ca commit 20d2890
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/blacklight/abstract_repository.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def connection

protected
def connection_config
@connection_config ||= Blacklight.connection_config
blacklight_config.connection_config
end

def logger
Expand Down
6 changes: 6 additions & 0 deletions lib/blacklight/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ def default_values
document_model: nil,
# document presenter class used by helpers and views
document_presenter_class: nil,
# repository connection configuration
connection_config: nil,
##
# == Blacklight view configuration
##
Expand Down Expand Up @@ -211,6 +213,10 @@ def repository_class
super || Blacklight::SolrRepository
end

def connection_config
super || Blacklight.connection_config
end

def search_builder_class
super || locate_search_builder_class
end
Expand Down
12 changes: 12 additions & 0 deletions spec/lib/blacklight/configuration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,18 @@
expect(@config.search_fields).to be_a_kind_of ActiveSupport::OrderedHash
expect(@config.sort_fields).to be_a_kind_of ActiveSupport::OrderedHash
end

end

describe "#connection_config" do
let(:custom_config) { double }
it "should have the global blacklight configuration" do
expect(@config.connection_config).to eq Blacklight.connection_config
end
it "should be overridable with custom configuration" do
@config.connection_config = custom_config
expect(@config.connection_config).to eq custom_config
end
end

describe "config.index.respond_to" do
Expand Down

0 comments on commit 20d2890

Please sign in to comment.