Skip to content

Commit

Permalink
Mitigates Style/SpaceAfterComma
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Nys committed Apr 18, 2015
1 parent 2a9683c commit 2637caa
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions bin/httparty
Expand Up @@ -73,15 +73,15 @@ end
def dump_headers(response)
resp_type = Net::HTTPResponse::CODE_TO_OBJ[response.code.to_s]
puts "#{response.code} #{resp_type.to_s.sub(/^Net::HTTP/, '')}"
response.headers.each do |n,v|
response.headers.each do |n, v|
puts "#{n}: #{v}"
end
puts
end

if opts[:verbose]
puts "#{opts[:action].to_s.upcase} #{ARGV.first}"
opts[:headers].each do |n,v|
opts[:headers].each do |n, v|
puts "#{n}: #{v}"
end
puts
Expand Down
2 changes: 1 addition & 1 deletion features/steps/mongrel_helper.rb
Expand Up @@ -17,7 +17,7 @@ def process(request, response)
def reply_with(response, code, response_body)
response.start(code) do |head, body|
head["Content-Type"] = content_type
custom_headers.each { |k,v| head[k] = v }
custom_headers.each { |k, v| head[k] = v }
body.write(response_body)
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/httparty/cookie_hash.rb
Expand Up @@ -8,7 +8,7 @@ def add_cookies(value)
merge!(value)
when String
value.split('; ').each do |cookie|
array = cookie.split('=',2)
array = cookie.split('=', 2)
self[array[0].to_sym] = array[1]
end
else
Expand Down
4 changes: 2 additions & 2 deletions lib/httparty/hash_conversions.rb
Expand Up @@ -12,7 +12,7 @@ module HashConversions
# }.to_params
# #=> "name=Bob&address[city]=Ruby Central&address[phones][]=111-111-1111&address[phones][]=222-222-2222&address[street]=111 Ruby Ave."
def self.to_params(hash)
hash.to_hash.map { |k,v| normalize_param(k,v) }.join.chop
hash.to_hash.map { |k, v| normalize_param(k, v) }.join.chop
end

# @param key<Object> The key for the param.
Expand All @@ -28,7 +28,7 @@ def self.normalize_param(key, value)
if value.respond_to?(:to_ary)
param << value.to_ary.map { |element| normalize_param("#{key}[]", element) }.join
elsif value.respond_to?(:to_hash)
stack << [key,value.to_hash]
stack << [key, value.to_hash]
else
param << "#{key}=#{ERB::Util.url_encode(value.to_s)}&"
end
Expand Down
2 changes: 1 addition & 1 deletion lib/httparty/response.rb
@@ -1,7 +1,7 @@
module HTTParty
class Response < BasicObject
def self.underscore(string)
string.gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').gsub(/([a-z])([A-Z])/,'\1_\2').downcase
string.gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2').gsub(/([a-z])([A-Z])/, '\1_\2').downcase
end

attr_reader :request, :response, :body, :headers
Expand Down
4 changes: 2 additions & 2 deletions spec/httparty/request_spec.rb
Expand Up @@ -338,9 +338,9 @@
end

it 'should handle csv automatically' do
csv = ['"id","Name"','"1234","Foo Bar!"'].join("\n")
csv = ['"id","Name"', '"1234","Foo Bar!"'].join("\n")
@request.options[:format] = :csv
expect(@request.send(:parse_response, csv)).to eq([%w(id Name),["1234","Foo Bar!"]])
expect(@request.send(:parse_response, csv)).to eq([%w(id Name), ["1234", "Foo Bar!"]])
end

it 'should handle json automatically' do
Expand Down
6 changes: 3 additions & 3 deletions spec/httparty_spec.rb
Expand Up @@ -373,9 +373,9 @@ class MyParser < HTTParty::Parser

it "should process a request with a connection from the adapter" do
connection_adapter_options = {foo: :bar}
expect(connection_adapter).to receive(:call) { |u,o|
expect(connection_adapter).to receive(:call) { |u, o|
expect(o[:connection_adapter_options]).to eq(connection_adapter_options)
HTTParty::ConnectionAdapter.call(u,o)
HTTParty::ConnectionAdapter.call(u, o)
}.with(URI.parse(uri), kind_of(Hash))
FakeWeb.register_uri(:get, uri, body: 'stuff')
@klass.connection_adapter connection_adapter, connection_adapter_options
Expand Down Expand Up @@ -737,7 +737,7 @@ def self.inherited(subclass)
profile = HTTParty.get('http://twitter.com/statuses/profile.csv')
expect(profile.size).to eq(2)
expect(profile[0]).to eq(%w(name url id description protected screen_name followers_count profile_image_url location))
expect(profile[1]).to eq(["Magic 8 Bot",nil,"17656026","ask me a question","false","magic8bot","90","http://s3.amazonaws.com/twitter_production/profile_images/65565851/8ball_large_normal.jpg",nil])
expect(profile[1]).to eq(["Magic 8 Bot", nil, "17656026", "ask me a question", "false", "magic8bot", "90", "http://s3.amazonaws.com/twitter_production/profile_images/65565851/8ball_large_normal.jpg", nil])
end

it "should not get undefined method add_node for nil class for the following xml" do
Expand Down
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Expand Up @@ -9,7 +9,7 @@ def file_fixture(filename)
open(File.join(File.dirname(__FILE__), 'fixtures', "#{filename.to_s}")).read
end

Dir[File.expand_path(File.join(File.dirname(__FILE__),'support','**','*.rb'))].each {|f| require f}
Dir[File.expand_path(File.join(File.dirname(__FILE__), 'support', '**', '*.rb'))].each {|f| require f}

RSpec.configure do |config|
config.include HTTParty::StubResponse
Expand Down
2 changes: 1 addition & 1 deletion spec/support/ssl_test_server.rb
Expand Up @@ -49,7 +49,7 @@ def stop

def thread_main
until @stopping_mutex.synchronize { @stopping }
(rr,_,_) = select([@ssl_server.to_io], nil, nil, 0.1)
(rr, _, _) = select([@ssl_server.to_io], nil, nil, 0.1)

next unless rr && rr.include?(@ssl_server.to_io)

Expand Down

0 comments on commit 2637caa

Please sign in to comment.