Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Ruby 1.9 fixes #65

Closed
wants to merge 6 commits into from

2 participants

@cap10morgan

I'm working on getting the test suite to pass in Ruby 1.9.2-p136. With these changes, all but 4 tests pass. Here are the remaining failures:

HTTParty::Request ::NON_RAILS_QUERY_STRING_NORMALIZER
- doesn't modify strings (FAILED - 1)

HTTParty::Request SSL certificate verification
- should work with when no trusted CA list is specified (FAILED - 2)
- should work with when no trusted CA list is specified, even with a bogus hostname (FAILED - 3)

HTTParty#get
- should be able parse response type json automatically (FAILED - 4)

Here are the traces:

1)
NoMethodError in 'HTTParty::Request ::NON_RAILS_QUERY_STRING_NORMALIZER doesn't modify strings'
undefined method `map' for "foo=bar&foo=baz":String
/Users/morganw/Projects/httpotato/lib/httparty/request.rb:15:in `block in <class:Request>'
spec/httparty/request_spec.rb:12:in `[]'
spec/httparty/request_spec.rb:12:in `block (3 levels) in <top (required)>'
/Users/morganw/.rvm/gems/ruby-1.9.2-p136@httparty/gems/rspec-1.3.1/lib/spec/example/example_methods.rb:40:in `instance_eval'
/Users/morganw/.rvm/gems/ruby-1.9.2-p136@httparty/gems/rspec-1.3.1/lib/spec/example/example_methods.rb:40:in `block in execute'
/Users/morganw/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/timeout.rb:44:in `timeout'
/Users/morganw/.rvm/gems/ruby-1.9.2-p136@httparty/gems/rspec-1.3.1/lib/spec/example/example_methods.rb:37:in `execute'
/Users/morganw/.rvm/gems/ruby-1.9.2-p136@httparty/gems/rspec-1.3.1/lib/spec/example/example_group_methods.rb:219:in `block in run_examples'
/Users/morganw/.rvm/gems/ruby-1.9.2-p136@httparty/gems/rspec-1.3.1/lib/spec/example/example_group_methods.rb:217:in `each'
/Users/morganw/.rvm/gems/ruby-1.9.2-p136@httparty/gems/rspec-1.3.1/lib/spec/example/example_group_methods.rb:217:in `run_examples'
/Users/morganw/.rvm/gems/ruby-1.9.2-p136@httparty/gems/rspec-1.3.1/lib/spec/example/example_group_methods.rb:103:in `run'
/Users/morganw/.rvm/gems/ruby-1.9.2-p136@httparty/gems/rspec-1.3.1/lib/spec/runner/example_group_runner.rb:23:in `block in run'
/Users/morganw/.rvm/gems/ruby-1.9.2-p136@httparty/gems/rspec-1.3.1/lib/spec/runner/example_group_runner.rb:22:in `each'
/Users/morganw/.rvm/gems/ruby-1.9.2-p136@httparty/gems/rspec-1.3.1/lib/spec/runner/example_group_runner.rb:22:in `run'
/Users/morganw/.rvm/gems/ruby-1.9.2-p136@httparty/gems/rspec-1.3.1/lib/spec/runner/options.rb:153:in `run_examples'
/Users/morganw/.rvm/gems/ruby-1.9.2-p136@httparty/gems/rspec-1.3.1/lib/spec/runner/command_line.rb:9:in `run'
/Users/morganw/.rvm/gems/ruby-1.9.2-p136@httparty/gems/rspec-1.3.1/bin/spec:5:in `<main>'

2)
OpenSSL::SSL::SSLError in 'HTTParty::Request SSL certificate verification should work with when no trusted CA list is specified'
SSL_accept returned=1 errno=0 state=SSLv3 read client certificate A: tlsv1 alert unknown ca
/Users/morganw/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/openssl/ssl-internal.rb:164:in `accept'
/Users/morganw/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/openssl/ssl-internal.rb:164:in `accept'
/Users/morganw/Projects/httpotato/spec/support/ssl_test_server.rb:50:in `thread_main'
/Users/morganw/Projects/httpotato/spec/support/ssl_test_server.rb:31:in `block (2 levels) in start'

3)
OpenSSL::SSL::SSLError in 'HTTParty::Request SSL certificate verification should work with when no trusted CA list is specified, even with a bogus hostname'
SSL_accept returned=1 errno=0 state=SSLv3 read client certificate A: tlsv1 alert unknown ca
/Users/morganw/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/openssl/ssl-internal.rb:164:in `accept'
/Users/morganw/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/openssl/ssl-internal.rb:164:in `accept'
/Users/morganw/Projects/httpotato/spec/support/ssl_test_server.rb:50:in `thread_main'
/Users/morganw/Projects/httpotato/spec/support/ssl_test_server.rb:31:in `block (2 levels) in start'

4)
Crack::ParseError in 'HTTParty#get should be able parse response type json automatically'
Invalid JSON string
/Users/morganw/.rvm/gems/ruby-1.9.2-p136@httparty/gems/crack-0.1.8/lib/crack/json.rb:14:in `rescue in parse'
/Users/morganw/.rvm/gems/ruby-1.9.2-p136@httparty/gems/crack-0.1.8/lib/crack/json.rb:12:in `parse'
/Users/morganw/Projects/httpotato/lib/httparty/parser.rb:116:in `json'
/Users/morganw/Projects/httpotato/lib/httparty/parser.rb:136:in `parse_supported_format'
/Users/morganw/Projects/httpotato/lib/httparty/parser.rb:103:in `parse'
/Users/morganw/Projects/httpotato/lib/httparty/parser.rb:66:in `call'
/Users/morganw/Projects/httpotato/lib/httparty/request.rb:214:in `parse_response'
/Users/morganw/Projects/httpotato/lib/httparty/request.rb:186:in `handle_response'
/Users/morganw/Projects/httpotato/lib/httparty/request.rb:71:in `perform'
/Users/morganw/Projects/httpotato/lib/httparty.rb:394:in `perform_request'
/Users/morganw/Projects/httpotato/lib/httparty.rb:346:in `get'
/Users/morganw/Projects/httpotato/lib/httparty.rb:426:in `get'
spec/httparty_spec.rb:546:in `block (3 levels) in <top (required)>'
/Users/morganw/.rvm/gems/ruby-1.9.2-p136@httparty/gems/rspec-1.3.1/lib/spec/example/example_methods.rb:40:in `instance_eval'
/Users/morganw/.rvm/gems/ruby-1.9.2-p136@httparty/gems/rspec-1.3.1/lib/spec/example/example_methods.rb:40:in `block in execute'
/Users/morganw/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/timeout.rb:44:in `timeout'
/Users/morganw/.rvm/gems/ruby-1.9.2-p136@httparty/gems/rspec-1.3.1/lib/spec/example/example_methods.rb:37:in `execute'
/Users/morganw/.rvm/gems/ruby-1.9.2-p136@httparty/gems/rspec-1.3.1/lib/spec/example/example_group_methods.rb:219:in `block in run_examples'
/Users/morganw/.rvm/gems/ruby-1.9.2-p136@httparty/gems/rspec-1.3.1/lib/spec/example/example_group_methods.rb:217:in `each'
/Users/morganw/.rvm/gems/ruby-1.9.2-p136@httparty/gems/rspec-1.3.1/lib/spec/example/example_group_methods.rb:217:in `run_examples'
/Users/morganw/.rvm/gems/ruby-1.9.2-p136@httparty/gems/rspec-1.3.1/lib/spec/example/example_group_methods.rb:103:in `run'
/Users/morganw/.rvm/gems/ruby-1.9.2-p136@httparty/gems/rspec-1.3.1/lib/spec/runner/example_group_runner.rb:23:in `block in run'
/Users/morganw/.rvm/gems/ruby-1.9.2-p136@httparty/gems/rspec-1.3.1/lib/spec/runner/example_group_runner.rb:22:in `each'
/Users/morganw/.rvm/gems/ruby-1.9.2-p136@httparty/gems/rspec-1.3.1/lib/spec/runner/example_group_runner.rb:22:in `run'
/Users/morganw/.rvm/gems/ruby-1.9.2-p136@httparty/gems/rspec-1.3.1/lib/spec/runner/options.rb:153:in `run_examples'
/Users/morganw/.rvm/gems/ruby-1.9.2-p136@httparty/gems/rspec-1.3.1/lib/spec/runner/command_line.rb:9:in `run'
/Users/morganw/.rvm/gems/ruby-1.9.2-p136@httparty/gems/rspec-1.3.1/bin/spec:5:in `<main>'
@sandro
Collaborator

Think that line 62 would still work? Did you run the tests?

Not sure. It seems like it should work for the specific changes above. But if there are other elements in that array that are formatted the old way, it should probably a regexp in that sub call. Something like:
name = klass.name.sub(/^(?:::)?Net::HTTP/, '')

I couldn't get the test suite to run under 1.9.2. Seems there is a lot of breakage under that Ruby version. That should probably discourage me from using it in 1.9.2...

OK, I ran the tests under 1.8.7. Seems that change broke some things. I'll try it with the regexp instead.

Collaborator

Regexp seems overkill, the question is this: ::Object.name == Object.name. The answer is that line 62 doesn't need to change.

@cap10morgan

Fixed the first failing test. Three more to go.

@sandro
Collaborator

Ruby 1.9.2 fixes

Closed by a51ce57
Closed by a51ce57

@ntalbott ntalbott referenced this pull request from a commit in ntalbott/httparty
@sandro sandro Ruby 1.9.2 fixes
Closes gh-65
Closes gh-63
a51ce57
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
View
23 Gemfile.lock
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
- httparty (0.6.1)
+ httparty (0.7.0)
crack (= 0.1.8)
GEM
@@ -9,7 +9,6 @@ GEM
specs:
activesupport (2.3.10)
builder (2.1.2)
- cgi_multipart_eof_fix (2.5.0)
crack (0.1.8)
cucumber (0.9.2)
builder (~> 2.1.2)
@@ -17,20 +16,23 @@ GEM
gherkin (~> 2.2.5)
json (~> 1.4.6)
term-ansicolor (~> 1.0.5)
- daemons (1.1.0)
+ daemons (1.0.10)
diff-lcs (1.1.2)
fakeweb (1.3.0)
- fastthread (1.0.7)
gem_plugin (0.2.3)
gherkin (2.2.9)
json (~> 1.4.6)
term-ansicolor (~> 1.0.5)
+ git (1.2.5)
+ jeweler (1.5.2)
+ bundler (~> 1.0.0)
+ git (>= 1.2.5)
+ rake
json (1.4.6)
- mongrel (1.1.5)
- cgi_multipart_eof_fix (>= 2.4)
- daemons (>= 1.0.3)
- fastthread (>= 1.0.1)
- gem_plugin (>= 0.2.3)
+ mongrel (1.2.0.pre2)
+ daemons (~> 1.0.10)
+ gem_plugin (~> 0.2.3)
+ rake (0.8.7)
rspec (1.3.1)
term-ansicolor (1.0.5)
@@ -43,5 +45,6 @@ DEPENDENCIES
cucumber (~> 0.7)
fakeweb (~> 1.2)
httparty!
- mongrel (~> 1.1)
+ jeweler (~> 1.5)
+ mongrel (~> 1.2.0.pre2)
rspec (~> 1.3)
View
6 httparty.gemspec
@@ -127,7 +127,7 @@ Gem::Specification.new do |s|
s.add_development_dependency(%q<activesupport>, ["~> 2.3"])
s.add_development_dependency(%q<cucumber>, ["~> 0.7"])
s.add_development_dependency(%q<fakeweb>, ["~> 1.2"])
- s.add_development_dependency(%q<mongrel>, ["~> 1.1"])
+ s.add_development_dependency(%q<mongrel>, ["~> 1.2.0.pre2"])
s.add_development_dependency(%q<rspec>, ["~> 1.3"])
s.add_development_dependency(%q<jeweler>, ["~> 1.5"])
else
@@ -135,7 +135,7 @@ Gem::Specification.new do |s|
s.add_dependency(%q<activesupport>, ["~> 2.3"])
s.add_dependency(%q<cucumber>, ["~> 0.7"])
s.add_dependency(%q<fakeweb>, ["~> 1.2"])
- s.add_dependency(%q<mongrel>, ["~> 1.1"])
+ s.add_dependency(%q<mongrel>, ["~> 1.2.0.pre2"])
s.add_dependency(%q<rspec>, ["~> 1.3"])
s.add_dependency(%q<jeweler>, ["~> 1.5"])
end
@@ -144,7 +144,7 @@ Gem::Specification.new do |s|
s.add_dependency(%q<activesupport>, ["~> 2.3"])
s.add_dependency(%q<cucumber>, ["~> 0.7"])
s.add_dependency(%q<fakeweb>, ["~> 1.2"])
- s.add_dependency(%q<mongrel>, ["~> 1.1"])
+ s.add_dependency(%q<mongrel>, ["~> 1.2.0.pre2"])
s.add_dependency(%q<rspec>, ["~> 1.3"])
s.add_dependency(%q<jeweler>, ["~> 1.5"])
end
View
2  lib/httparty.rb
@@ -13,7 +13,7 @@
# @see HTTParty::ClassMethods
module HTTParty
- VERSION = "0.7.0".freeze
+ VERSION = "0.7.0"
CRACK_DEPENDENCY = "0.1.8".freeze
module AllowedFormatsDeprecation
View
4 lib/httparty/response.rb
@@ -1,7 +1,7 @@
module HTTParty
class Response < HTTParty::BasicObject #:nodoc:
class Headers
- include Net::HTTPHeader
+ include ::Net::HTTPHeader
def initialize(header)
@header = header
@@ -56,7 +56,7 @@ def inspect
%(#<#{self.class}:0x#{inspect_id} @parsed_response=#{parsed_response.inspect}, @response=#{response.inspect}, @headers=#{headers.inspect}>)
end
- CODES_TO_OBJ = Net::HTTPResponse::CODE_CLASS_TO_OBJ.merge Net::HTTPResponse::CODE_TO_OBJ
+ CODES_TO_OBJ = ::Net::HTTPResponse::CODE_CLASS_TO_OBJ.merge ::Net::HTTPResponse::CODE_TO_OBJ
CODES_TO_OBJ.each do |response_code, klass|
name = klass.name.sub("Net::HTTP", '')
View
2  spec/httparty/request_spec.rb
@@ -9,7 +9,7 @@
let(:normalizer) { HTTParty::Request::NON_RAILS_QUERY_STRING_NORMALIZER }
it "doesn't modify strings" do
- query_string = normalizer["foo=bar&foo=baz"]
+ query_string = normalizer.call(["foo=bar&foo=baz"])
URI.unescape(query_string).should == "foo=bar&foo=baz"
end
Something went wrong with that request. Please try again.