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

Add reset method in curb adapter #747

Merged
merged 1 commit into from
Mar 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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