Skip to content

Commit

Permalink
Silence SolrQueryBuilder deprecation warnings when running tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeer committed Mar 16, 2016
1 parent 558d424 commit 7cbde2f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions lib/active_fedora/solr_query_builder.rb
@@ -1,5 +1,7 @@
module ActiveFedora
module SolrQueryBuilder
extend Deprecation

class << self
# Construct a solr query for a list of ids
# This is used to get a solr response based on the list of ids in an object's RELS-EXT relationhsips
Expand All @@ -15,13 +17,13 @@ def construct_query_for_ids(id_array)
# @param [String] key
# @param [String] value
def raw_query(key, value)
Deprecation.warn(ActiveFedora::Base, 'ActiveFedora::SolrQueryBuilder.raw_query is deprecated and will be removed in ActiveFedora 10.0. Use .construct_query instead.')
Deprecation.warn(ActiveFedora::SolrQueryBuilder, 'ActiveFedora::SolrQueryBuilder.raw_query is deprecated and will be removed in ActiveFedora 10.0. Use .construct_query instead.')
"_query_:\"{!raw f=#{key}}#{value.gsub('"', '\"')}\""
end

# @deprecated
def solr_name(*args)
Deprecation.warn(ActiveFedora::Base, 'ActiveFedora::SolrQueryBuilder.solr_name is deprecated and will be removed in ActiveFedora 10.0. Use ActiveFedora.index_field_mapper.solr_name instead.')
Deprecation.warn(ActiveFedora::SolrQueryBuilder, 'ActiveFedora::SolrQueryBuilder.solr_name is deprecated and will be removed in ActiveFedora 10.0. Use ActiveFedora.index_field_mapper.solr_name instead.')
ActiveFedora.index_field_mapper.solr_name(*args)
end

Expand Down
2 changes: 1 addition & 1 deletion spec/unit/solr_query_builder_spec.rb
Expand Up @@ -3,7 +3,7 @@
describe ActiveFedora::SolrQueryBuilder do
describe "raw_query" do
it "generates a raw query clause" do
Deprecation.silence(ActiveFedora::Base) do
Deprecation.silence(described_class) do
expect(described_class.raw_query('id', "my:_ID1_")).to eq '_query_:"{!raw f=id}my:_ID1_"'
end
end
Expand Down

0 comments on commit 7cbde2f

Please sign in to comment.