Merge commit 'snusnu/master'
This commit is contained in:
commit
f342142a71
|
@ -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"
|
||||
|
|
|
@ -2,6 +2,8 @@ module Webrat
|
|||
module Selenium
|
||||
|
||||
class ApplicationServer
|
||||
|
||||
include Webrat::Selenium::SilenceStream
|
||||
|
||||
def self.boot
|
||||
case Webrat.configuration.application_framework
|
||||
|
|
|
@ -2,6 +2,8 @@ module Webrat
|
|||
module Selenium
|
||||
|
||||
class SeleniumRCServer
|
||||
|
||||
include Webrat::Selenium::SilenceStream
|
||||
|
||||
def self.boot
|
||||
new.boot
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
Loading…
Reference in New Issue