Skip to content

Commit 95956f8

Browse files
committed
[rb] get specs passing without stdout clutter
1 parent 16f1c11 commit 95956f8

File tree

2 files changed

+12
-19
lines changed

2 files changed

+12
-19
lines changed

rb/spec/unit/selenium/webdriver/common/logger_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ module Selenium
2323
module WebDriver
2424
describe Logger do
2525
around do |example|
26-
WebDriver.instance_variable_set(:@logger, nil) # reset cache
2726
debug = $DEBUG
2827
$DEBUG = false
2928
example.call
3029
$DEBUG = debug
30+
WebDriver.instance_variable_set(:@logger, nil) # reset cache
3131
end
3232

3333
it 'logs warnings by default' do

rb/spec/unit/selenium/webdriver/remote/http/default_spec.rb

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ module Remote
2525
module Http
2626
describe Default do
2727
let(:client) do
28-
client = Default.new
28+
client = Default.new
2929
client.server_url = URI.parse('http://example.com')
3030

3131
client
@@ -52,7 +52,9 @@ module Http
5252

5353
describe '#timeout=' do
5454
let(:value_set) { 22 }
55-
before { client.timeout = value_set }
55+
before do
56+
expect { client.timeout = value_set }.to output.to_stdout_from_any_process
57+
end
5658

5759
it 'assigns value to #read_timeout' do
5860
expect(client.read_timeout).to eq value_set
@@ -64,16 +66,16 @@ module Http
6466
end
6567

6668
it 'uses the specified timeout' do
67-
client.timeout = 10
68-
http = client.send :http
69+
expect { client.timeout = 10 }.to output.to_stdout_from_any_process
70+
http = client.send :http
6971

7072
expect(http.open_timeout).to eq(10)
7173
expect(http.read_timeout).to eq(10)
7274
end
7375

7476
it 'uses the specified proxy' do
7577
client.proxy = Proxy.new(http: 'http://foo:bar@proxy.org:8080')
76-
http = client.send :http
78+
http = client.send :http
7779

7880
expect(http).to be_proxy
7981
expect(http.proxy_address).to eq('proxy.org')
@@ -113,14 +115,14 @@ module Http
113115

114116
%w[no_proxy NO_PROXY].each do |no_proxy_var|
115117
it "honors the #{no_proxy_var} environment variable when matching" do
116-
with_env('HTTP_PROXY' => 'proxy.org:8080', no_proxy_var => 'example.com') do
118+
with_env('http_proxy' => 'proxy.org:8080', no_proxy_var => 'example.com') do
117119
http = client.send :http
118120
expect(http).not_to be_proxy
119121
end
120122
end
121123

122124
it "ignores the #{no_proxy_var} environment variable when not matching" do
123-
with_env('HTTP_PROXY' => 'proxy.org:8080', no_proxy_var => 'foo.com') do
125+
with_env('http_proxy' => 'proxy.org:8080', no_proxy_var => 'foo.com') do
124126
http = client.send :http
125127

126128
expect(http).to be_proxy
@@ -130,23 +132,14 @@ module Http
130132
end
131133

132134
it "understands a comma separated list of domains in #{no_proxy_var}" do
133-
with_env('HTTP_PROXY' => 'proxy.org:8080', no_proxy_var => 'example.com,foo.com') do
135+
with_env('http_proxy' => 'proxy.org:8080', no_proxy_var => 'example.com,foo.com') do
134136
http = client.send :http
135137
expect(http).not_to be_proxy
136138
end
137139
end
138140

139-
unless RUBY_VERSION > '2.0' # Ruby 2.0 does its own proxy handling in net/http, which breaks this behaviour
140-
it "understands an asterisk in #{no_proxy_var}" do
141-
with_env('HTTP_PROXY' => 'proxy.org:8080', no_proxy_var => '*') do
142-
http = client.send :http
143-
expect(http).not_to be_proxy
144-
end
145-
end
146-
end
147-
148141
it "understands subnetting in #{no_proxy_var}" do
149-
with_env('HTTP_PROXY' => 'proxy.org:8080', no_proxy_var => 'localhost,127.0.0.0/8') do
142+
with_env('http_proxy' => 'proxy.org:8080', no_proxy_var => 'localhost,127.0.0.0/8') do
150143
client.server_url = URI.parse('http://127.0.0.1:4444/wd/hub')
151144

152145
http = client.send :http

0 commit comments

Comments
 (0)