browsermob-proxy 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -19,10 +19,14 @@ module BrowserMob
19
19
  @port = port
20
20
  end
21
21
 
22
- def new_har(initial_page_ref)
23
- previous = @resource["har"].put :initialPageRef => initial_page_ref
22
+ def new_har(ref = nil)
23
+ previous = @resource["har"].put :initialPageRef => ref
24
24
  HAR::Archive.from_string(previous) unless previous.empty?
25
25
  end
26
+
27
+ def new_page(ref)
28
+ @resource['har/pageRef'].put :pageRef => ref
29
+ end
26
30
 
27
31
  def har
28
32
  HAR::Archive.from_string @resource["har"].get
@@ -1,5 +1,5 @@
1
1
  module BrowserMob
2
2
  module Proxy
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
@@ -14,7 +14,7 @@ describe "Proxy + WebDriver" do
14
14
  after { proxy.close }
15
15
 
16
16
  it "should fetch a HAR" do
17
- proxy.new_har "google.com"
17
+ proxy.new_har
18
18
  driver.get "http://google.com"
19
19
 
20
20
  har = proxy.har
@@ -7,9 +7,11 @@ module BrowserMob
7
7
  let(:resource) { mock(RestClient::Resource) }
8
8
  let(:client) { Client.new(resource, "localhost", 9091) }
9
9
  let(:har_resource) { mock("resource[har]") }
10
+ let(:page_ref_resource) { mock("resource[har/pageRef]") }
10
11
 
11
12
  before do
12
13
  resource.stub!(:[]).with("har").and_return(har_resource)
14
+ resource.stub!(:[]).with("har/pageRef").and_return(page_ref_resource)
13
15
  end
14
16
 
15
17
  it "creates a new har" do
@@ -29,6 +31,12 @@ module BrowserMob
29
31
 
30
32
  client.har.should be_kind_of(HAR::Archive)
31
33
  end
34
+
35
+ it "creates a new page" do
36
+ page_ref_resource.should_receive(:put).with :pageRef => "foo"
37
+
38
+ client.new_page("foo")
39
+ end
32
40
  end
33
41
 
34
42
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: browsermob-proxy
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.1
5
+ version: 0.0.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - jari.bakken