spec/unit/client_spec.rb in browsermob-proxy-0.1.8 vs spec/unit/client_spec.rb in browsermob-proxy-0.1.9
- old
+ new
@@ -18,11 +18,13 @@
"limit" => double("resource[limit]"),
"headers" => double("resource[headers]"),
"auth/basic/#{DOMAIN}" => double("resource[auth/basic/#{DOMAIN}]"),
"hosts" => double("resource[hosts]"),
"timeout" => double("resource[timeout]"),
- "rewrite" => double("resource[rewrite]")
+ "rewrite" => double("resource[rewrite]"),
+ "interceptor/request" => double("resource[interceptor/request]"),
+ "interceptor/response" => double("resource[interceptor/response]")
}.each do |path, mock|
resource.stub(:[]).with(path).and_return(mock)
end
end
@@ -124,9 +126,19 @@
it "clears the blacklist" do
resource['blacklist'].should_receive(:delete)
client.clear_blacklist
+ end
+
+ it "creates request interceptor" do
+ resource['interceptor/request'].should_receive(:post).with("foo", :content_type => "text/plain")
+ client.request_interceptor = "foo"
+ end
+
+ it "creates response interceptor" do
+ resource['interceptor/response'].should_receive(:post).with("foo", :content_type => "text/plain")
+ client.response_interceptor = "foo"
end
describe 'whitelist' do
it "supports a string" do
resource['whitelist'].should_receive(:put).