1
0
Fork 0
mirror of https://github.com/thoughtbot/capybara-webkit synced 2023-03-27 23:22:28 -04:00

Deprecate the stdout option for Connection

This commit is contained in:
Matthew Horan 2013-02-06 20:16:51 -05:00
parent 9bb7b93be3
commit a70b7c4aa1
2 changed files with 18 additions and 1 deletions

View file

@ -12,7 +12,14 @@ module Capybara::Webkit
def initialize(options = {}) def initialize(options = {})
@socket_class = options[:socket_class] || TCPSocket @socket_class = options[:socket_class] || TCPSocket
@output_target = options.has_key?(:stderr) ? options[:stderr] : $stderr if options.has_key?(:stderr)
@output_target = options[:stderr]
elsif options.has_key?(:stdout)
warn "[DEPRECATION] The `stdout` option is deprecated. Please use `stderr` instead."
@output_target = options[:stdout]
else
@output_target = $stderr
end
start_server start_server
connect connect
end end

View file

@ -37,6 +37,16 @@ describe Capybara::Webkit::Connection do
Capybara::Webkit::Connection.new(:stderr => nil) Capybara::Webkit::Connection.new(:stderr => nil)
end end
it 'prints a deprecation warning if the stdout option is used' do
Capybara::Webkit::Connection.any_instance.should_receive(:warn)
Capybara::Webkit::Connection.new(:stdout => nil)
end
it 'does not forward stdout to nil if the stdout option is used' do
Capybara::Webkit::Connection.any_instance.stub(:warn)
IO.should_not_receive(:copy_stream)
Capybara::Webkit::Connection.new(:stdout => nil)
end
it "returns the server port" do it "returns the server port" do
connection.port.should be_between 0x400, 0xffff connection.port.should be_between 0x400, 0xffff