Skip to content
This repository has been archived by the owner on Jun 30, 2018. It is now read-only.

Pass the :refresh param through Index#store #913

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/tire/index.rb
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ def store(*args)
params[:routing] = options[:routing] if options[:routing]
params[:replication] = options[:replication] if options[:replication]
params[:version] = options[:version] if options[:version]
params[:refresh] = options[:refresh] if options[:refresh]

params_encoded = params.empty? ? '' : "?#{params.to_param}"

Expand Down
10 changes: 10 additions & 0 deletions test/unit/index_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,16 @@ class MyDocument;end; document = MyDocument.new
@index.store({:title => 'Test'}, {:replication => 'async'})
end

should "extract the refresh type from options" do
Configuration.client.expects(:post).
with do |url, payload|
assert_equal "#{Configuration.url}/dummy/document/?refresh=true", url
end.
returns(mock_response('{"ok":true,"_id":"test"}'))

@index.store({:title => 'Test'}, {:refresh => 'true'})
end

should "extract the version from options" do
Configuration.client.expects(:post).
with do |url, payload|
Expand Down