Skip to content

Commit

Permalink
[#246 state:resolved] added external application server if you have y…
Browse files Browse the repository at this point in the history
…our own started
  • Loading branch information
Mike Gaffney committed Jun 4, 2009
1 parent a6a4a7c commit 6d74cd9
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 3 deletions.
3 changes: 3 additions & 0 deletions lib/webrat/selenium/application_server_factory.rb
Expand Up @@ -14,6 +14,9 @@ def self.app_server_instance
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}
Expand Down
4 changes: 4 additions & 0 deletions lib/webrat/selenium/application_servers.rb
@@ -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"
24 changes: 24 additions & 0 deletions lib/webrat/selenium/application_servers/external.rb
@@ -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
12 changes: 9 additions & 3 deletions spec/public/selenium/application_server_factory_spec.rb
Expand Up @@ -4,9 +4,7 @@
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

Expand Down Expand Up @@ -34,6 +32,14 @@
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 {
Expand Down
12 changes: 12 additions & 0 deletions spec/public/selenium/application_servers/external_spec.rb
@@ -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

0 comments on commit 6d74cd9

Please sign in to comment.