Sha256: f9d9d28e0423726b3a6909aaa91bdfd67fc7b73b57f25b5f9b9a34ab9d155d8a

Contents?: true

Size: 1.1 KB

Versions: 4

Compression:

Stored size: 1.1 KB

Contents

module Webrat
  module Selenium

    class RailsApplicationServer < ApplicationServer

      def start
        system start_command
      end

      def stop
        silence_stream(STDERR) do
          silence_stream(STDOUT) do
            system stop_command
          end
        end
      end

      def fail
        $stderr.puts
        $stderr.puts
        $stderr.puts "==> Failed to boot the Rails application server... exiting!"
        $stderr.puts
        $stderr.puts "Verify you can start a Rails server on port #{Webrat.configuration.application_port} with the following command:"
        $stderr.puts
        $stderr.puts "    #{start_command}"
        exit
      end

      def pid_file
        prepare_pid_file("#{RAILS_ROOT}/tmp/pids", "mongrel_selenium.pid")
      end

      def start_command
        "mongrel_rails start -d --chdir='#{RAILS_ROOT}' --port=#{Webrat.configuration.application_port} --environment=#{Webrat.configuration.application_environment} --pid #{pid_file} &"
      end

      def stop_command
        "mongrel_rails stop -c #{RAILS_ROOT} --pid #{pid_file}"
      end

    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
jwilger-webrat-0.4.4.2 lib/webrat/selenium/rails_application_server.rb
jwilger-webrat-0.4.4.3 lib/webrat/selenium/rails_application_server.rb
jwilger-webrat-0.4.4.4 lib/webrat/selenium/rails_application_server.rb
jwilger-webrat-0.4.4.5 lib/webrat/selenium/rails_application_server.rb