Skip to content

Commit

Permalink
SearchBuilder should pass the blacklight params through to the scope …
Browse files Browse the repository at this point in the history
…method
  • Loading branch information
cbeer committed Feb 19, 2015
1 parent d63f059 commit 9dd65f0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/blacklight/search_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def processed_parameters
@processor_chain.each do |method_name|
if @scope.respond_to?(method_name, true)
Deprecation.warn Blacklight::SearchBuilder, "Building search parameters by calling #{method_name} on #{@scope.to_s}. This behavior will be deprecated in Blacklight 6.0"
@scope.send(method_name, request_parameters, @user_params)
@scope.send(method_name, request_parameters, blacklight_params)
else
send(method_name, request_parameters)
end
Expand Down
7 changes: 5 additions & 2 deletions spec/lib/blacklight/search_builder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,21 @@
allow(scope).to receive(:respond_to?).and_return(true)
allow(scope).to receive(:step_1) do |req_params, user_params|
req_params[:step_1] = 'scope'
req_params[:user_params] = user_params
end

Deprecation.silence(Blacklight::SearchBuilder) do
expect(subject.processed_parameters).to include step_1: 'scope'
subject.with(a: 1)
expect(subject.processed_parameters).to include step_1: 'scope', user_params: { a: 1 }
end
end

it "should try to run the processor method on the search builder" do
allow(subject).to receive(:step_1) do |req_params, user_params|
allow(subject).to receive(:step_1) do |req_params|
req_params[:step_1] = 'builder'
end

subject.with(a: 1)
expect(subject.processed_parameters).to include step_1: 'builder'
end
end
Expand Down

0 comments on commit 9dd65f0

Please sign in to comment.