Permalink
Browse files

Deprecate the stdout option for Connection

  • Loading branch information...
mhoran committed Feb 7, 2013
1 parent 9bb7b93 commit a70b7c4aa1b0a514a9f17e81974d599db0fa6f14
Showing with 18 additions and 1 deletion.
  1. +8 −1 lib/capybara/webkit/connection.rb
  2. +10 −0 spec/connection_spec.rb
@@ -12,7 +12,14 @@ class Connection
def initialize(options = {})
@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
connect
end
View
@@ -37,6 +37,16 @@
Capybara::Webkit::Connection.new(:stderr => nil)
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
connection.port.should be_between 0x400, 0xffff

0 comments on commit a70b7c4

Please sign in to comment.