Skip to content

Commit

Permalink
Merge pull request #1083 from projectblacklight/release-5.9-backports
Browse files Browse the repository at this point in the history
Release 5.9 backports
  • Loading branch information
cbeer committed Feb 18, 2015
2 parents 884d23a + 56c72cf commit 51172f0
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
12 changes: 10 additions & 2 deletions lib/blacklight/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,16 @@ def deep_copy
end
alias_method :inheritable_copy, :deep_copy
else
alias_method :deep_copy, :deep_dup
alias_method :inheritable_copy, :deep_dup
##
# Rails 4.x provides `#deep_dup`, but it aggressively `#dup`'s class names
# too. These model names should not be `#dup`'ed or we might break ActiveModel::Naming.
def deep_copy
deep_dup.tap do |copy|
copy.solr_response_model = self.solr_response_model
copy.solr_document_model = self.solr_document_model
end
end
alias_method :inheritable_copy, :deep_copy
end

##
Expand Down
5 changes: 4 additions & 1 deletion lib/blacklight/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@ def bookmarks(_)
get "bookmarks/sms", :as => "sms_bookmarks"
post "bookmarks/sms"
get "bookmarks/citation", :as => "citation_bookmarks"
resources :bookmarks

args = {}
args[:constraints] = options[:constraints] if options[:constraints]
resources :bookmarks, args
end
end

Expand Down
10 changes: 10 additions & 0 deletions spec/lib/blacklight/configuration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,16 @@
expect(@config.facet_fields).to_not include(@mock_facet)
end

it "should not dup solr_response_model or solr_document_model" do
@config.solr_response_model = Blacklight::SolrResponse
@config.solr_document_model = SolrDocument

config_copy = @config.inheritable_copy

expect(config_copy.solr_response_model).to eq Blacklight::SolrResponse
expect(config_copy.solr_document_model).to eq SolrDocument
end

it "should provide cloned copies of mutable data structures" do
@config.a = { value: 1 }
@config.b = [1,2,3]
Expand Down

0 comments on commit 51172f0

Please sign in to comment.