Skip to content

Commit

Permalink
looking about right
Browse files Browse the repository at this point in the history
  • Loading branch information
maxdemarzi committed Mar 21, 2013
1 parent 8e36406 commit c3df2f3
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lib/neography/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def set_defaults
@authentication = nil
@username = nil
@password = nil
@parser = {:parser => MultiJsonParser}
@parser = MultiJsonParser
end

end
Expand Down
8 changes: 4 additions & 4 deletions lib/neography/connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def configuration
end

def merge_options(options)
merged_options = options.merge!(@authentication).merge!(@parser)
merged_options = options.merge!(@authentication)#.merge!(@parser)
merged_options[:headers].merge!(@user_agent) if merged_options[:headers]
merged_options
end
Expand Down Expand Up @@ -101,10 +101,10 @@ def evaluate_response(response)
case code
when 200
@logger.debug "OK" if @log_enabled
MultiJsonParser.json(body) #response.parsed_response
@parser.json(body) #response.parsed_response
when 201
@logger.debug "OK, created #{body}" if @log_enabled
MultiJsonParser.json(body) #response.parsed_response
@parser.json(body) #response.parsed_response
when 204
@logger.debug "OK, no content returned" if @log_enabled
nil
Expand All @@ -120,7 +120,7 @@ def handle_4xx_500_response(code, body)
message = "No error message returned from server."
stacktrace = ""
else
parsed_body = JSON.parse(body)
parsed_body = @parser.json(body)
message = parsed_body["message"]
stacktrace = parsed_body["stacktrace"]
end
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/rest_header_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
describe Neography::Connection do

it "should not add a content-type header if there's no existing headers" do
subject.merge_options({}).keys.should == [:parser]
subject.merge_options({}).keys.should == []
end

it "should add a content type if there's existing headers" do
Expand Down
4 changes: 2 additions & 2 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
Coveralls.wear!

# If you want to see more, uncomment the next few lines
require 'net-http-spy'
# require 'net-http-spy'
# Net::HTTP.http_logger_options = {:body => true} # just the body
Net::HTTP.http_logger_options = {:verbose => true} # see everything
# Net::HTTP.http_logger_options = {:verbose => true} # see everything

def generate_text(length=8)
chars = 'abcdefghjkmnpqrstuvwxyz'
Expand Down
4 changes: 2 additions & 2 deletions spec/unit/config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ module Neography
its(:authentication) { should == nil }
its(:username) { should == nil }
its(:password) { should == nil }
its(:parser) { should == { :parser => MultiJsonParser } }
its(:parser) { should == MultiJsonParser}

it "has a hash representation" do
expected_hash = {
Expand All @@ -35,7 +35,7 @@ module Neography
:authentication => nil,
:username => nil,
:password => nil,
:parser => { :parser => MultiJsonParser }
:parser => MultiJsonParser
}
config.to_hash.should == expected_hash
end
Expand Down

0 comments on commit c3df2f3

Please sign in to comment.