Ruby 1.9 fixes #65

Closed
wants to merge 6 commits into
from

Conversation

Projects
None yet
2 participants
Contributor

cap10morgan commented Jan 19, 2011

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 commented on 890b126 Jan 19, 2011

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.

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

Contributor

cap10morgan commented Jan 19, 2011

Fixed the first failing test. Three more to go.

Collaborator

sandro commented Jan 19, 2011

Ruby 1.9.2 fixes

Closed by a51ce57
Closed by a51ce57

@ntalbott ntalbott pushed a commit to ntalbott/httparty that referenced this pull request May 4, 2012

@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