From 7692930769ccc43952e3249caced4362abd0c01d Mon Sep 17 00:00:00 2001 From: Corey Donohoe Date: Sun, 15 Feb 2009 14:37:38 -0700 Subject: [PATCH] clean up constant definitions for rails and fix merb port fubar on selenium appserver stop --- lib/webrat/selenium.rb | 23 ++++++++++++----------- spec/private/selenium/selenium_spec.rb | 2 +- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/lib/webrat/selenium.rb b/lib/webrat/selenium.rb index e140087..e45ac46 100644 --- a/lib/webrat/selenium.rb +++ b/lib/webrat/selenium.rb @@ -42,7 +42,7 @@ module Webrat end when :merb fork do - exec 'merb', '-d' + exec 'merb', '-d', '-p', Webrat.configuration.application_port end else # rails system("mongrel_rails start -d --chdir='#{RAILS_ROOT}' --port=#{Webrat.configuration.application_port} --environment=#{Webrat.configuration.application_environment} --pid #{pid_file} &") @@ -57,9 +57,9 @@ module Webrat system("kill -9 #{pid}") FileUtils.rm_f 'rack.pid' when :merb - pid = File.read('log/merb.4000.pid') + pid = File.read("log/merb.#{Webrat.configuration.application_port}.pid") system("kill -9 #{pid}") - FileUtils.rm_f 'log/merb.4000.pid' + FileUtils.rm_f "log/merb.#{Webrat.configuration.application_port}.pid" else # rails system "mongrel_rails stop -c #{RAILS_ROOT} --pid #{pid_file}" end @@ -118,11 +118,12 @@ module Webrat end end end - -#module ActionController #:nodoc: -# IntegrationTest.class_eval do -# include Webrat::Methods -# include Webrat::Selenium::Methods -# include Webrat::Selenium::Matchers -# end -#end +if defined?(ActionController::IntegrationTest) + module ActionController #:nodoc: + IntegrationTest.class_eval do + include Webrat::Methods + include Webrat::Selenium::Methods + include Webrat::Selenium::Matchers + end + end +end diff --git a/spec/private/selenium/selenium_spec.rb b/spec/private/selenium/selenium_spec.rb index efeb7fe..ae6c97b 100644 --- a/spec/private/selenium/selenium_spec.rb +++ b/spec/private/selenium/selenium_spec.rb @@ -51,7 +51,7 @@ describe Webrat, "Selenium" do describe "merb" do it "should stop the app server with correct config options" do Webrat.configuration.application_type = :merb - File.should_receive(:read).with('log/merb.4000.pid').and_return('666') + File.should_receive(:read).with('log/merb.3001.pid').and_return('666') Webrat.should_receive(:system).with("kill -9 666") Webrat.stop_app_server end