spec/unit/client_spec.rb in browsermob-proxy-0.0.1 vs spec/unit/client_spec.rb in browsermob-proxy-0.0.2
- old
+ new
@@ -5,13 +5,15 @@
describe Client do
let(:resource) { mock(RestClient::Resource) }
let(:client) { Client.new(resource, "localhost", 9091) }
let(:har_resource) { mock("resource[har]") }
+ let(:page_ref_resource) { mock("resource[har/pageRef]") }
before do
resource.stub!(:[]).with("har").and_return(har_resource)
+ resource.stub!(:[]).with("har/pageRef").and_return(page_ref_resource)
end
it "creates a new har" do
har_resource.should_receive(:put).with(:initialPageRef => "foo").and_return('')
@@ -26,9 +28,15 @@
it "gets the current har" do
har_resource.should_receive(:get).and_return(fixture("google.har"))
client.har.should be_kind_of(HAR::Archive)
+ end
+
+ it "creates a new page" do
+ page_ref_resource.should_receive(:put).with :pageRef => "foo"
+
+ client.new_page("foo")
end
end
end
end
\ No newline at end of file