Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix WebMock regression in 1.79.2 #2874

Merged

Conversation

tubbo
Copy link
Contributor

@tubbo tubbo commented Jun 4, 2018

Since Webmock overrides the Net::HTTP#start
method

to simulate HTTP requests, unsafe usage of @socket in ActiveMerchant's
Net::HTTP#ssl_connection refinement caused cryptic errors in tests
that used VCR along with ActiveMerchant:

MyProject::TotallyFabulousIntegrationTest#test_fabulosity:
NoMethodError: undefined method `io' for nil:NilClass
    test/test_helper.rb:44:in `use_cassette'

.../gems/activemerchant-1.79.0/lib/active_merchant/net_http_ssl_connection.rb:6:in `ssl_connection'
.../gems/activemerchant-1.79.0/lib/active_merchant/connection.rb:78:in `block (2 levels) in request'
...

Since Webmock [overrides the Net::HTTP#start
method](https://github.com/bblimke/webmock/blob/master/lib/webmock/http_lib_adapters/net_http.rb#L144)
to simulate HTTP requests, unsafe usage of `@socket` in ActiveMerchant's
`Net::HTTP#ssl_connection` refinement caused cryptic errors in tests
that used VCR along with ActiveMerchant:

```
MyProject::TotallyFabulousIntegrationTest#test_fabulosity:
NoMethodError: undefined method `io' for nil:NilClass
    test/test_helper.rb:44:in `use_cassette'

.../gems/activemerchant-1.79.0/lib/active_merchant/net_http_ssl_connection.rb:6:in `ssl_connection'
.../gems/activemerchant-1.79.0/lib/active_merchant/connection.rb:78:in `block (2 levels) in request'
...
```
@bdewater bdewater merged commit 79c46f7 into activemerchant:master Jun 5, 2018
@bdewater
Copy link
Contributor

bdewater commented Jun 5, 2018

Fabulous first contribution! Thanks ✨

@abarrak
Copy link
Contributor

abarrak commented Jun 9, 2018

Fantastic indeed @tubbo.
I was seeing the failure in app tests only, and now this solves it !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants