bbc-capybara-mechanize 0.3.6 → 0.3.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -18,6 +18,9 @@ class Capybara::Mechanize::Browser < Capybara::RackTest::Browser
18
18
  @agent.cert = driver.options[:certificate][:cer]
19
19
  @agent.key = driver.options[:certificate][:key]
20
20
  end
21
+ if driver.options[:user_agent]
22
+ @agent.user_agent = driver.options[:user_agent]
23
+ end
21
24
  if driver.options[:proxy] && !driver.options[:proxy].empty?
22
25
  proxy = nil
23
26
  begin
@@ -33,7 +36,7 @@ class Capybara::Mechanize::Browser < Capybara::RackTest::Browser
33
36
  end
34
37
  end
35
38
  super
36
- end
39
+ end
37
40
 
38
41
  def reset_host!
39
42
  @last_remote_host = nil
@@ -1,5 +1,5 @@
1
1
  module Capybara
2
2
  module Mechanize
3
- VERSION = '0.3.6'
3
+ VERSION = '0.3.8'
4
4
  end
5
5
  end
@@ -92,4 +92,4 @@ describe "Capybara::Mechanize::Driver, browser" do
92
92
  end.should_not raise_error()
93
93
  end
94
94
  end
95
- end
95
+ end
@@ -56,4 +56,19 @@ describe Capybara::Session do
56
56
  it_should_behave_like "session with headers support"
57
57
  it_should_behave_like "session with status code support"
58
58
  end
59
+
60
+ context "Custom user agent" do
61
+
62
+ before do
63
+ @session = Capybara::Session.new(:mechanize, TestApp)
64
+ @session.driver.options[:respect_data_method] = true
65
+ Capybara.default_host = 'http://www.local.com'
66
+ end
67
+
68
+ it "should allow setting of custom user agents" do
69
+ @session.driver.options[:user_agent] = "Mozilla/5.0 (iPhone; CPU iPhone OS 5_0 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9A334 Safari/7534.48.3"
70
+ @session.visit("#{REMOTE_TEST_URL}/request_info/user_agent")
71
+ @session.body.should include("Mozilla/5.0 (iPhone; CPU iPhone OS 5_0 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9A334 Safari/7534.48.3")
72
+ end
73
+ end
59
74
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bbc-capybara-mechanize
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 3
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 6
10
- version: 0.3.6
9
+ - 8
10
+ version: 0.3.8
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jeroen van Dijk
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2012-02-20 00:00:00 Z
19
+ date: 2012-03-14 00:00:00 Z
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
22
  version_requirements: &id001 !ruby/object:Gem::Requirement