browsermob-proxy 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/Gemfile +3 -0
- data/LICENSE +202 -0
- data/README.md +68 -0
- data/Rakefile +7 -0
- data/browsermob-proxy.gemspec +29 -0
- data/lib/browsermob-proxy.rb +1 -0
- data/lib/browsermob/proxy.rb +13 -0
- data/lib/browsermob/proxy/client.rb +42 -0
- data/lib/browsermob/proxy/server.rb +67 -0
- data/lib/browsermob/proxy/version.rb +5 -0
- data/spec/e2e/selenium_spec.rb +25 -0
- data/spec/fixtures/google.har +612 -0
- data/spec/spec_helper.rb +33 -0
- data/spec/unit/client_spec.rb +35 -0
- metadata +137 -0
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'browsermob/proxy'
|
2
|
+
require 'selenium-webdriver'
|
3
|
+
|
4
|
+
RestClient.log = STDOUT
|
5
|
+
|
6
|
+
module BrowserMob
|
7
|
+
module Proxy
|
8
|
+
module SpecHelper
|
9
|
+
def server
|
10
|
+
$_bm_server ||= Server.new(File.join(home, "bin", "browsermob-proxy"), :log => true).start
|
11
|
+
end
|
12
|
+
|
13
|
+
def new_proxy
|
14
|
+
server.create_proxy
|
15
|
+
end
|
16
|
+
|
17
|
+
def home
|
18
|
+
ENV['BROWSERMOB_PROXY_HOME'] or raise "BROWSERMOB_PROXY_HOME not set"
|
19
|
+
end
|
20
|
+
|
21
|
+
def fixture(name)
|
22
|
+
File.read(File.join(File.expand_path("../", __FILE__), "fixtures", name))
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
|
30
|
+
RSpec.configure do |c|
|
31
|
+
c.include(BrowserMob::Proxy::SpecHelper)
|
32
|
+
c.after(:suite) { $_bm_server.stop if $_bm_server }
|
33
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module BrowserMob
|
4
|
+
module Proxy
|
5
|
+
|
6
|
+
describe Client do
|
7
|
+
let(:resource) { mock(RestClient::Resource) }
|
8
|
+
let(:client) { Client.new(resource, "localhost", 9091) }
|
9
|
+
let(:har_resource) { mock("resource[har]") }
|
10
|
+
|
11
|
+
before do
|
12
|
+
resource.stub!(:[]).with("har").and_return(har_resource)
|
13
|
+
end
|
14
|
+
|
15
|
+
it "creates a new har" do
|
16
|
+
har_resource.should_receive(:put).with(:initialPageRef => "foo").and_return('')
|
17
|
+
|
18
|
+
client.new_har("foo").should be_nil
|
19
|
+
end
|
20
|
+
|
21
|
+
it "returns the previous archive if one exists" do
|
22
|
+
har_resource.should_receive(:put).with(:initialPageRef => "foo").and_return(fixture("google.har"))
|
23
|
+
|
24
|
+
client.new_har("foo").should be_kind_of(HAR::Archive)
|
25
|
+
end
|
26
|
+
|
27
|
+
it "gets the current har" do
|
28
|
+
har_resource.should_receive(:get).and_return(fixture("google.har"))
|
29
|
+
|
30
|
+
client.har.should be_kind_of(HAR::Archive)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
metadata
ADDED
@@ -0,0 +1,137 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: browsermob-proxy
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.0.1
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- jari.bakken
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2011-07-15 00:00:00 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: rest-client
|
17
|
+
prerelease: false
|
18
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
19
|
+
none: false
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "0"
|
24
|
+
type: :runtime
|
25
|
+
version_requirements: *id001
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: childprocess
|
28
|
+
prerelease: false
|
29
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
30
|
+
none: false
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: "0"
|
35
|
+
type: :runtime
|
36
|
+
version_requirements: *id002
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: json
|
39
|
+
prerelease: false
|
40
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: "0"
|
46
|
+
type: :runtime
|
47
|
+
version_requirements: *id003
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: har
|
50
|
+
prerelease: false
|
51
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: "0"
|
57
|
+
type: :runtime
|
58
|
+
version_requirements: *id004
|
59
|
+
- !ruby/object:Gem::Dependency
|
60
|
+
name: rspec
|
61
|
+
prerelease: false
|
62
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
63
|
+
none: false
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: 2.5.0
|
68
|
+
type: :development
|
69
|
+
version_requirements: *id005
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: selenium-webdriver
|
72
|
+
prerelease: false
|
73
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: 2.0.0
|
79
|
+
type: :development
|
80
|
+
version_requirements: *id006
|
81
|
+
description: Ruby client for the BrowserMob Proxy REST API
|
82
|
+
email:
|
83
|
+
- jari.bakken@gmail.com
|
84
|
+
executables: []
|
85
|
+
|
86
|
+
extensions: []
|
87
|
+
|
88
|
+
extra_rdoc_files: []
|
89
|
+
|
90
|
+
files:
|
91
|
+
- .gitignore
|
92
|
+
- Gemfile
|
93
|
+
- LICENSE
|
94
|
+
- README.md
|
95
|
+
- Rakefile
|
96
|
+
- browsermob-proxy.gemspec
|
97
|
+
- lib/browsermob-proxy.rb
|
98
|
+
- lib/browsermob/proxy.rb
|
99
|
+
- lib/browsermob/proxy/client.rb
|
100
|
+
- lib/browsermob/proxy/server.rb
|
101
|
+
- lib/browsermob/proxy/version.rb
|
102
|
+
- spec/e2e/selenium_spec.rb
|
103
|
+
- spec/fixtures/google.har
|
104
|
+
- spec/spec_helper.rb
|
105
|
+
- spec/unit/client_spec.rb
|
106
|
+
homepage: http://github.com/jarib/browsermob-proxy-rb
|
107
|
+
licenses: []
|
108
|
+
|
109
|
+
post_install_message:
|
110
|
+
rdoc_options: []
|
111
|
+
|
112
|
+
require_paths:
|
113
|
+
- lib
|
114
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
115
|
+
none: false
|
116
|
+
requirements:
|
117
|
+
- - ">="
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: "0"
|
120
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ">="
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: "0"
|
126
|
+
requirements: []
|
127
|
+
|
128
|
+
rubyforge_project: browsermob-proxy-rb
|
129
|
+
rubygems_version: 1.8.5
|
130
|
+
signing_key:
|
131
|
+
specification_version: 3
|
132
|
+
summary: Ruby client for the BrowserMob Proxy REST API
|
133
|
+
test_files:
|
134
|
+
- spec/e2e/selenium_spec.rb
|
135
|
+
- spec/fixtures/google.har
|
136
|
+
- spec/spec_helper.rb
|
137
|
+
- spec/unit/client_spec.rb
|