Testing the parallelize_me!
option of Minitest, in conjunction with using WebMock to stub some requests.
It would appear that WebMock might not be thread safe as running these tests with parallelisation enabled results in a number of errors:
ParallelisationTest#test_242:
WebMock::NetConnectNotAllowedError: Real HTTP connections are disabled. Unregistered request: GET http://example.com/ with headers {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Host'=>'example.com', 'User-Agent'=>'Ruby'}
You can stub this request with the following snippet:
stub_request(:get, "http://example.com/").
with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Host'=>'example.com', 'User-Agent'=>'Ruby'}).
to_return(:status => 200, :body => "", :headers => {})
============================================================
/private/tmp/wem-minitest-parallelize/.bundle/gems/gems/webmock-1.21.0/lib/webmock/http_lib_adapters/net_http.rb:114:in `request'
/Users/chrisroos/.rbenv/versions/2.2.0/lib/ruby/2.2.0/net/http.rb:1285:in `request_get'
/Users/chrisroos/.rbenv/versions/2.2.0/lib/ruby/2.2.0/net/http.rb:480:in `block in get_response'
/private/tmp/wem-minitest-parallelize/.bundle/gems/gems/webmock-1.21.0/lib/webmock/http_lib_adapters/net_http.rb:123:in `start_without_connect'
/private/tmp/wem-minitest-parallelize/.bundle/gems/gems/webmock-1.21.0/lib/webmock/http_lib_adapters/net_http.rb:150:in `start'
/Users/chrisroos/.rbenv/versions/2.2.0/lib/ruby/2.2.0/net/http.rb:583:in `start'
/Users/chrisroos/.rbenv/versions/2.2.0/lib/ruby/2.2.0/net/http.rb:478:in `get_response'
/Users/chrisroos/.rbenv/versions/2.2.0/lib/ruby/2.2.0/net/http.rb:455:in `get'
parallelisation_with_webmock_test.rb:15:in `block (2 levels) in <class:ParallelisationTest>'
1000 runs, 997 assertions, 0 failures, 3 errors, 0 skips