clean up constant definitions for rails and fix merb port fubar on selenium appserver stop

This commit is contained in:
Corey Donohoe 2009-02-15 14:37:38 -07:00
parent 9066d2a9cd
commit 7692930769
2 changed files with 13 additions and 12 deletions

View File

@ -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

View File

@ -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