<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -9,23 +9,27 @@ module RailsTestServing
 
     include Utilities
 
-    def initialize
-      ENV['RAILS_ENV'] = 'test'
-      log &quot;** Test server starting [##{$$}]...&quot; do
-        enable_dependency_tracking
-        start_cleaner
-        load_framework
-      end
-      install_signal_traps
-    end
-
     def run(file, argv)
       GUARD.synchronize do
+        prepare
         perform_run(file, argv)
       end
     end
 
   private
+  
+    def prepare
+      @prepared ||= begin
+        ENV['RAILS_ENV'] = 'test'
+        log &quot;** Test server starting [##{$$}]...&quot; do
+          enable_dependency_tracking
+          start_cleaner
+          load_framework
+        end
+        install_signal_traps
+        true
+      end
+    end
 
     def enable_dependency_tracking
       require 'config/boot'
@@ -55,8 +59,10 @@ module RailsTestServing
     def install_signal_traps
       log &quot; - CTRL+C: Stop the server\n&quot;
       trap(:INT) do
-        log &quot;** Stopping the server...&quot; do
-          DRb.thread.raise Interrupt, &quot;stop&quot;
+        GUARD.synchronize do
+          log &quot;** Stopping the server...&quot; do
+            DRb.thread.raise Interrupt, &quot;stop&quot;
+          end
         end
       end
 </diff>
      <filename>lib/rails_test_serving/server.rb</filename>
    </modified>
    <modified>
      <diff>@@ -70,12 +70,6 @@ class RailsTestServing::ServerTest &lt; Test::Unit::TestCase
 private
 
   def stub_server
-    s = RailsTestServing::Server
-    s.any_instance.stubs(:log).yields
-    s.any_instance.stubs(:enable_dependency_tracking)
-    s.any_instance.stubs(:start_cleaner)
-    s.any_instance.stubs(:load_framework)
-    s.any_instance.stubs(:install_signal_traps)
-    s.new
+    RailsTestServing::Server.new
   end
 end</diff>
      <filename>test/rails_test_serving/server_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>49f8251574be3a2ef0c4271bfa0fd5a07bc160c1</id>
    </parent>
  </parents>
  <author>
    <name>Roman Le Negrate</name>
    <email>roman.lenegrate@gmail.com</email>
  </author>
  <url>http://github.com/Roman2K/rails-test-serving/commit/cd4c76103e2b3f8ed5bed022055c296c00b95151</url>
  <id>cd4c76103e2b3f8ed5bed022055c296c00b95151</id>
  <committed-date>2008-12-27T11:46:32-08:00</committed-date>
  <authored-date>2008-12-27T11:46:32-08:00</authored-date>
  <message>Start listening for test run requests as soon as possible.

This allows for starting the server and immediately CMD+R'ing without having the environment loaded twice (once for the server, once for the independent process that couldn't connect to the server yet).</message>
  <tree>2f349a773c4d6d2a1f27aaa1b800c34558b93938</tree>
  <committer>
    <name>Roman Le Negrate</name>
    <email>roman.lenegrate@gmail.com</email>
  </committer>
</commit>
