diff --git a/lib/tire/index.rb b/lib/tire/index.rb index a3ac3a51..22aa38b4 100644 --- a/lib/tire/index.rb +++ b/lib/tire/index.rb @@ -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}" diff --git a/test/unit/index_test.rb b/test/unit/index_test.rb index 6440c97d..cc50f60d 100644 --- a/test/unit/index_test.rb +++ b/test/unit/index_test.rb @@ -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|