Skip to content

Commit

Permalink
fix tests: streaming is not only for batches
Browse files Browse the repository at this point in the history
  • Loading branch information
Radu Kopetz committed Apr 28, 2014
1 parent e2f8b7a commit 05bc713
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
6 changes: 4 additions & 2 deletions lib/neography/connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,14 @@ def evaluate_chunk_response(response, result)
end

def evaluate_response(response, path, query_body, streaming, batching, stream = nil)
code = response.status
parsed = false
if streaming && batching
code, body, parsed = handle_batch(stream)
elsif streaming
body = (stream || '').force_encoding("UTF-8")
else
code = response.status
body = response.body.force_encoding("UTF-8")
parsed = false
end
return_result(response, code, body, parsed, path, query_body)
end
Expand Down
8 changes: 5 additions & 3 deletions spec/unit/connection_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,11 @@ module Neography

it "adds the User-Agent to the headers" do
connection.client.should_receive(:request).with(
:method => :get, :path => "/db/data/node/bar", :body => nil,
:headers => { "User-Agent" => "Neography/#{Neography::VERSION}", "X-Stream"=>true, "max-execution-time" => 6000}
) { double.as_null_object }
hash_including(
{:method => :get, :path => "/db/data/node/bar", :body => nil,
:headers => {"User-Agent" => "Neography/#{Neography::VERSION}", "X-Stream"=>true, "max-execution-time" => 6000}}
)
) { double.as_null_object }

connection.get("/node/bar", :headers => {})
end
Expand Down

0 comments on commit 05bc713

Please sign in to comment.