Running RSpec tests, how can I resolve a “Curl::Err::OutOfMemoryError”?

Running an rspec test with ruby bindings for libcurl (with
curbhttps://github.com/taf2/curb)
like so:

it “Should return a certain user in a JSON array” do
$var = Curl::Easy.new(“some-url.com”)
$var.perform
response = JSON.parse($var.body_str)
response[‘user’].should eq(‘some user name’)
end

and sometimes I get this error:

Failure/Error: $var.perform
Curl::Err::OutOfMemoryError:
Curl::Err::OutOfMemoryError

Anyone know how to resolve this? Thanks.