Merge commit 'snusnu/master'

This commit is contained in:
Mike Gaffney 2009-05-13 23:12:32 -05:00
commit f342142a71
5 changed files with 26 additions and 9 deletions

View File

@ -1,6 +1,13 @@
require "webrat"
gem "selenium-client", ">=1.2.14"
require "selenium/client"
# active_support already defines silence_stream, no need to do that again if it's already present.
# http://github.com/rails/rails/blob/master/activesupport/lib/active_support/core_ext/kernel/reporting.rb
unless Kernel.respond_to?(:silence_stream)
require "webrat/selenium/silence_stream"
end
require "webrat/selenium/selenium_session"
require "webrat/selenium/matchers"
require "webrat/core_extensions/tcp_socket"

View File

@ -3,6 +3,8 @@ module Webrat
class ApplicationServer
include Webrat::Selenium::SilenceStream
def self.boot
case Webrat.configuration.application_framework
when :sinatra

View File

@ -3,6 +3,8 @@ module Webrat
class SeleniumRCServer
include Webrat::Selenium::SilenceStream
def self.boot
new.boot
end

View File

@ -22,6 +22,7 @@ module Webrat
class SeleniumSession
include Webrat::SaveAndOpenPage
include Webrat::Selenium::SilenceStream
def initialize(*args) # :nodoc:
end
@ -186,15 +187,6 @@ module Webrat
protected
def silence_stream(stream)
old_stream = stream.dup
stream.reopen(RUBY_PLATFORM =~ /mswin/ ? 'NUL:' : '/dev/null')
stream.sync = true
yield
ensure
stream.reopen(old_stream)
end
def setup #:nodoc:
Webrat::Selenium::SeleniumRCServer.boot
Webrat::Selenium::ApplicationServer.boot

View File

@ -0,0 +1,14 @@
module Webrat
module Selenium
module SilenceStream
def silence_stream(stream)
old_stream = stream.dup
stream.reopen(RUBY_PLATFORM =~ /mswin/ ? 'NUL:' : '/dev/null')
stream.sync = true
yield
ensure
stream.reopen(old_stream)
end
end
end
end