Merge commit 'snusnu/master'
This commit is contained in:
commit
f342142a71
@ -1,6 +1,13 @@
|
|||||||
require "webrat"
|
require "webrat"
|
||||||
gem "selenium-client", ">=1.2.14"
|
gem "selenium-client", ">=1.2.14"
|
||||||
require "selenium/client"
|
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/selenium_session"
|
||||||
require "webrat/selenium/matchers"
|
require "webrat/selenium/matchers"
|
||||||
require "webrat/core_extensions/tcp_socket"
|
require "webrat/core_extensions/tcp_socket"
|
||||||
|
@ -2,6 +2,8 @@ module Webrat
|
|||||||
module Selenium
|
module Selenium
|
||||||
|
|
||||||
class ApplicationServer
|
class ApplicationServer
|
||||||
|
|
||||||
|
include Webrat::Selenium::SilenceStream
|
||||||
|
|
||||||
def self.boot
|
def self.boot
|
||||||
case Webrat.configuration.application_framework
|
case Webrat.configuration.application_framework
|
||||||
|
@ -2,6 +2,8 @@ module Webrat
|
|||||||
module Selenium
|
module Selenium
|
||||||
|
|
||||||
class SeleniumRCServer
|
class SeleniumRCServer
|
||||||
|
|
||||||
|
include Webrat::Selenium::SilenceStream
|
||||||
|
|
||||||
def self.boot
|
def self.boot
|
||||||
new.boot
|
new.boot
|
||||||
|
@ -22,6 +22,7 @@ module Webrat
|
|||||||
|
|
||||||
class SeleniumSession
|
class SeleniumSession
|
||||||
include Webrat::SaveAndOpenPage
|
include Webrat::SaveAndOpenPage
|
||||||
|
include Webrat::Selenium::SilenceStream
|
||||||
|
|
||||||
def initialize(*args) # :nodoc:
|
def initialize(*args) # :nodoc:
|
||||||
end
|
end
|
||||||
@ -186,15 +187,6 @@ module Webrat
|
|||||||
|
|
||||||
protected
|
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:
|
def setup #:nodoc:
|
||||||
Webrat::Selenium::SeleniumRCServer.boot
|
Webrat::Selenium::SeleniumRCServer.boot
|
||||||
Webrat::Selenium::ApplicationServer.boot
|
Webrat::Selenium::ApplicationServer.boot
|
||||||
|
14
lib/webrat/selenium/silence_stream.rb
Normal file
14
lib/webrat/selenium/silence_stream.rb
Normal 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
|
Loading…
Reference in New Issue
Block a user