Skip to content

Commit

Permalink
Merge pull request #747 from oliakremmyda/curl_reset
Browse files Browse the repository at this point in the history
Add `reset` method in curb adapter
  • Loading branch information
oliakremmyda committed Mar 8, 2018
2 parents 46b2321 + 7620eab commit fc1536d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/webmock/http_lib_adapters/curb_adapter.rb
Expand Up @@ -332,6 +332,11 @@ def on_#{callback} &block
end
METHOD
end

def reset
instance_variable_set(:@body_str, nil)
super
end
end
end
end
15 changes: 15 additions & 0 deletions spec/acceptance/curb/curb_spec.rb
Expand Up @@ -462,5 +462,20 @@
it_should_behave_like "Curb"
include CurbSpecHelper::ClassPerform
end

describe "using .reset" do
before do
@curl = Curl::Easy.new
@curl.url = "http://example.com"
body = "on_success fired"
stub_request(:any, "example.com").to_return(body: body)
@curl.http_get
end

it "should clear the body_str" do
@curl.reset
expect(@curl.body_str).to eq(nil)
end
end
end
end

0 comments on commit fc1536d

Please sign in to comment.