spec/unit/client_spec.rb in browsermob-proxy-0.0.7 vs spec/unit/client_spec.rb in browsermob-proxy-0.0.8
- old
+ new
@@ -18,26 +18,50 @@
}.each do |path, mock|
resource.stub!(:[]).with(path).and_return(mock)
end
end
- it "creates a new har" do
+ it "creates a named har" do
resource['har'].should_receive(:put).
with(:initialPageRef => "foo").
and_return('')
client.new_har("foo").should be_nil
end
+ it "creates a new har with no name" do
+ resource['har'].should_receive(:put).
+ with({}).
+ and_return('')
+
+ client.new_har.should be_nil
+ end
+
it "returns the previous archive if one exists" do
resource['har'].should_receive(:put).
with(:initialPageRef => "foo").
and_return(fixture("google.har"))
client.new_har("foo").should be_kind_of(HAR::Archive)
end
+ it "turns on header capture when given a name" do
+ resource['har'].should_receive(:put).
+ with(:initialPageRef => "foo", :captureHeaders => true).
+ and_return('')
+
+ client.new_har("foo", :capture_headers => true).should be_nil
+ end
+
+ it "turns on header capture when not given a name" do
+ resource['har'].should_receive(:put).
+ with(:captureHeaders => true).
+ and_return('')
+
+ client.new_har(:capture_headers => true).should be_nil
+ end
+
it "gets the current har" do
resource['har'].should_receive(:get).
and_return(fixture("google.har"))
client.har.should be_kind_of(HAR::Archive)
@@ -135,6 +159,6 @@
end
end
end
end
-end
\ No newline at end of file
+end