[#246 state:resolved] added external application server if you have your own started
This commit is contained in:
parent
a6a4a7cfd9
commit
6d74cd935e
|
@ -14,6 +14,9 @@ module Webrat
|
|||
when :rails
|
||||
require "webrat/selenium/rails_application_server"
|
||||
return RailsApplicationServer.new
|
||||
when :external
|
||||
require "webrat/selenium/application_servers/external"
|
||||
return Webrat::Selenium::ApplicationServers::External.new
|
||||
else
|
||||
raise WebratError.new(<<-STR)
|
||||
Unknown Webrat application_framework: #{Webrat.configuration.application_framework.inspect}
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
require "webrat/selenium/sinatra_application_server"
|
||||
require "webrat/selenium/merb_application_server"
|
||||
require "webrat/selenium/rails_application_server"
|
||||
require "webrat/selenium/application_servers/external"
|
|
@ -0,0 +1,24 @@
|
|||
module Webrat
|
||||
module Selenium
|
||||
module ApplicationServers
|
||||
class External < ApplicationServer
|
||||
def start
|
||||
warn "Webrat Ignoring Start Of Application Server Due to External Mode"
|
||||
end
|
||||
|
||||
def stop
|
||||
end
|
||||
|
||||
def fail
|
||||
end
|
||||
|
||||
def pid_file
|
||||
end
|
||||
|
||||
def wait
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -4,9 +4,7 @@ require "webrat/selenium/silence_stream"
|
|||
require "webrat/selenium/application_server_factory"
|
||||
require "webrat/selenium/application_server"
|
||||
|
||||
require "webrat/selenium/sinatra_application_server"
|
||||
require "webrat/selenium/merb_application_server"
|
||||
require "webrat/selenium/rails_application_server"
|
||||
require "webrat/selenium/application_servers"
|
||||
|
||||
describe Webrat::Selenium::ApplicationServerFactory do
|
||||
|
||||
|
@ -34,6 +32,14 @@ describe Webrat::Selenium::ApplicationServerFactory do
|
|||
Webrat::Selenium::ApplicationServerFactory.app_server_instance
|
||||
end
|
||||
|
||||
it "should require and create a rails server in external mode" do
|
||||
server = mock(Webrat::Selenium::ApplicationServers::External)
|
||||
Webrat.configuration.application_framework = :external
|
||||
Webrat::Selenium::ApplicationServerFactory.should_receive(:require).with("webrat/selenium/application_servers/external")
|
||||
Webrat::Selenium::ApplicationServers::External.should_receive(:new).and_return(server)
|
||||
Webrat::Selenium::ApplicationServerFactory.app_server_instance
|
||||
end
|
||||
|
||||
it "should handle unknown servers with an exception in unknown modes" do
|
||||
Webrat.configuration.application_framework = :unknown
|
||||
lambda {
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')
|
||||
|
||||
require "webrat/selenium/application_server"
|
||||
require "webrat/selenium/application_servers/external"
|
||||
|
||||
describe Webrat::Selenium::ApplicationServers::External do
|
||||
|
||||
it "should just boot up with no exceptions" do
|
||||
Webrat::Selenium::ApplicationServers::External.new.boot
|
||||
end
|
||||
|
||||
end
|
Loading…
Reference in New Issue