about summary refs log tree commit homepage
path: root/test
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2009-03-31 17:34:10 -0700
committerEric Wong <normalperson@yhbt.net>2009-03-31 19:00:21 -0700
commitaba465e9d196737b07786a759ba320c89ae31c2e (patch)
tree112b91937c258682b4d307a64775ac01cf0f1bcf /test
parent3adce6a1a803a00cb5cc9da758a10a658aab98ec (diff)
downloadunicorn-aba465e9d196737b07786a759ba320c89ae31c2e.tar.gz
Very preliminary for now.  Basically just sets up a basic
controller and response.  Requires git to clone the official
Rails repository.
Diffstat (limited to 'test')
-rw-r--r--test/rails/app-1.2.3/.gitignore2
-rw-r--r--test/rails/app-1.2.3/app/controllers/application.rb4
-rw-r--r--test/rails/app-1.2.3/app/controllers/foo_controller.rb5
-rw-r--r--test/rails/app-1.2.3/app/helpers/application_helper.rb2
-rw-r--r--test/rails/app-1.2.3/config/boot.rb9
-rw-r--r--test/rails/app-1.2.3/config/database.yml12
-rw-r--r--test/rails/app-1.2.3/config/environment.rb10
-rw-r--r--test/rails/app-1.2.3/config/environments/development.rb7
-rw-r--r--test/rails/app-1.2.3/config/environments/production.rb3
-rw-r--r--test/rails/app-1.2.3/config/routes.rb4
-rw-r--r--test/rails/app-1.2.3/db/.gitignore0
-rw-r--r--test/rails/app-1.2.3/public/404.html1
-rw-r--r--test/rails/app-1.2.3/public/500.html1
-rw-r--r--test/rails/app-2.0.2/.gitignore2
-rw-r--r--test/rails/app-2.0.2/app/controllers/application.rb2
-rw-r--r--test/rails/app-2.0.2/app/controllers/foo_controller.rb5
-rw-r--r--test/rails/app-2.0.2/app/helpers/application_helper.rb2
-rw-r--r--test/rails/app-2.0.2/config/boot.rb9
-rw-r--r--test/rails/app-2.0.2/config/database.yml12
-rw-r--r--test/rails/app-2.0.2/config/environment.rb14
-rw-r--r--test/rails/app-2.0.2/config/environments/development.rb6
-rw-r--r--test/rails/app-2.0.2/config/environments/production.rb3
-rw-r--r--test/rails/app-2.0.2/config/routes.rb4
-rw-r--r--test/rails/app-2.0.2/db/.gitignore0
-rw-r--r--test/rails/app-2.0.2/public/404.html1
-rw-r--r--test/rails/app-2.0.2/public/500.html1
-rw-r--r--test/rails/app-2.2.2/.gitignore2
-rw-r--r--test/rails/app-2.2.2/app/controllers/application.rb2
-rw-r--r--test/rails/app-2.2.2/app/controllers/foo_controller.rb5
-rw-r--r--test/rails/app-2.2.2/app/helpers/application_helper.rb2
-rw-r--r--test/rails/app-2.2.2/config/boot.rb109
-rw-r--r--test/rails/app-2.2.2/config/database.yml12
-rw-r--r--test/rails/app-2.2.2/config/environment.rb14
-rw-r--r--test/rails/app-2.2.2/config/environments/development.rb5
-rw-r--r--test/rails/app-2.2.2/config/environments/production.rb3
-rw-r--r--test/rails/app-2.2.2/config/routes.rb4
-rw-r--r--test/rails/app-2.2.2/db/.gitignore0
-rw-r--r--test/rails/app-2.2.2/public/404.html1
-rw-r--r--test/rails/app-2.2.2/public/500.html1
-rw-r--r--test/rails/app-2.3.2.1/.gitignore2
-rw-r--r--test/rails/app-2.3.2.1/app/controllers/application_controller.rb3
-rw-r--r--test/rails/app-2.3.2.1/app/controllers/foo_controller.rb5
-rw-r--r--test/rails/app-2.3.2.1/app/helpers/application_helper.rb2
-rw-r--r--test/rails/app-2.3.2.1/config/boot.rb107
-rw-r--r--test/rails/app-2.3.2.1/config/database.yml12
-rw-r--r--test/rails/app-2.3.2.1/config/environment.rb14
-rw-r--r--test/rails/app-2.3.2.1/config/environments/development.rb5
-rw-r--r--test/rails/app-2.3.2.1/config/environments/production.rb4
-rw-r--r--test/rails/app-2.3.2.1/config/routes.rb4
-rw-r--r--test/rails/app-2.3.2.1/db/.gitignore0
-rw-r--r--test/rails/app-2.3.2.1/public/404.html1
-rw-r--r--test/rails/app-2.3.2.1/public/500.html1
-rw-r--r--test/rails/test_rails.rb148
53 files changed, 589 insertions, 0 deletions
diff --git a/test/rails/app-1.2.3/.gitignore b/test/rails/app-1.2.3/.gitignore
new file mode 100644
index 0000000..f451f91
--- /dev/null
+++ b/test/rails/app-1.2.3/.gitignore
@@ -0,0 +1,2 @@
+/tmp
+/vendor
diff --git a/test/rails/app-1.2.3/app/controllers/application.rb b/test/rails/app-1.2.3/app/controllers/application.rb
new file mode 100644
index 0000000..ae8cac0
--- /dev/null
+++ b/test/rails/app-1.2.3/app/controllers/application.rb
@@ -0,0 +1,4 @@
+class ApplicationController < ActionController::Base
+  # Pick a unique cookie name to distinguish our session data from others'
+  session :session_key => "_unicorn_rails_test.#{rand}"
+end
diff --git a/test/rails/app-1.2.3/app/controllers/foo_controller.rb b/test/rails/app-1.2.3/app/controllers/foo_controller.rb
new file mode 100644
index 0000000..7602947
--- /dev/null
+++ b/test/rails/app-1.2.3/app/controllers/foo_controller.rb
@@ -0,0 +1,5 @@
+class FooController < ApplicationController
+  def index
+    render :text => "FOO\n"
+  end
+end
diff --git a/test/rails/app-1.2.3/app/helpers/application_helper.rb b/test/rails/app-1.2.3/app/helpers/application_helper.rb
new file mode 100644
index 0000000..de6be79
--- /dev/null
+++ b/test/rails/app-1.2.3/app/helpers/application_helper.rb
@@ -0,0 +1,2 @@
+module ApplicationHelper
+end
diff --git a/test/rails/app-1.2.3/config/boot.rb b/test/rails/app-1.2.3/config/boot.rb
new file mode 100644
index 0000000..71c7d7c
--- /dev/null
+++ b/test/rails/app-1.2.3/config/boot.rb
@@ -0,0 +1,9 @@
+unless defined?(RAILS_ROOT)
+  root_path = File.join(File.dirname(__FILE__), '..')
+  RAILS_ROOT = root_path
+end
+
+unless defined?(Rails::Initializer)
+  require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
+  Rails::Initializer.run(:set_load_path)
+end
diff --git a/test/rails/app-1.2.3/config/database.yml b/test/rails/app-1.2.3/config/database.yml
new file mode 100644
index 0000000..9f77843
--- /dev/null
+++ b/test/rails/app-1.2.3/config/database.yml
@@ -0,0 +1,12 @@
+development:
+  adapter: sqlite3
+  database: db/development.sqlite3
+  timeout: 5000
+test:
+  adapter: sqlite3
+  database: db/test.sqlite3
+  timeout: 5000
+production:
+  adapter: sqlite3
+  database: db/production.sqlite3
+  timeout: 5000
diff --git a/test/rails/app-1.2.3/config/environment.rb b/test/rails/app-1.2.3/config/environment.rb
new file mode 100644
index 0000000..ddeeba4
--- /dev/null
+++ b/test/rails/app-1.2.3/config/environment.rb
@@ -0,0 +1,10 @@
+unless defined? RAILS_GEM_VERSION
+  RAILS_GEM_VERSION = ENV['UNICORN_RAILS_VERSION'] # || '1.2.3'
+end
+
+# Bootstrap the Rails environment, frameworks, and default configuration
+require File.join(File.dirname(__FILE__), 'boot')
+
+Rails::Initializer.run do |config|
+  config.frameworks -= [ :action_web_service, :action_mailer ]
+end
diff --git a/test/rails/app-1.2.3/config/environments/development.rb b/test/rails/app-1.2.3/config/environments/development.rb
new file mode 100644
index 0000000..032fb46
--- /dev/null
+++ b/test/rails/app-1.2.3/config/environments/development.rb
@@ -0,0 +1,7 @@
+config.cache_classes = false
+config.whiny_nils = true
+config.breakpoint_server = true
+config.action_controller.consider_all_requests_local = true
+config.action_controller.perform_caching = false
+config.action_view.cache_template_extensions = false
+config.action_view.debug_rjs = true
diff --git a/test/rails/app-1.2.3/config/environments/production.rb b/test/rails/app-1.2.3/config/environments/production.rb
new file mode 100644
index 0000000..c4059e3
--- /dev/null
+++ b/test/rails/app-1.2.3/config/environments/production.rb
@@ -0,0 +1,3 @@
+config.cache_classes = true
+config.action_controller.consider_all_requests_local = false
+config.action_controller.perform_caching             = true
diff --git a/test/rails/app-1.2.3/config/routes.rb b/test/rails/app-1.2.3/config/routes.rb
new file mode 100644
index 0000000..774028f
--- /dev/null
+++ b/test/rails/app-1.2.3/config/routes.rb
@@ -0,0 +1,4 @@
+ActionController::Routing::Routes.draw do |map|
+  map.connect ':controller/:action/:id.:format'
+  map.connect ':controller/:action/:id'
+end
diff --git a/test/rails/app-1.2.3/db/.gitignore b/test/rails/app-1.2.3/db/.gitignore
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/rails/app-1.2.3/db/.gitignore
diff --git a/test/rails/app-1.2.3/public/404.html b/test/rails/app-1.2.3/public/404.html
new file mode 100644
index 0000000..44d986c
--- /dev/null
+++ b/test/rails/app-1.2.3/public/404.html
@@ -0,0 +1 @@
+404 Not Found
diff --git a/test/rails/app-1.2.3/public/500.html b/test/rails/app-1.2.3/public/500.html
new file mode 100644
index 0000000..e534a49
--- /dev/null
+++ b/test/rails/app-1.2.3/public/500.html
@@ -0,0 +1 @@
+500 Internal Server Error
diff --git a/test/rails/app-2.0.2/.gitignore b/test/rails/app-2.0.2/.gitignore
new file mode 100644
index 0000000..f451f91
--- /dev/null
+++ b/test/rails/app-2.0.2/.gitignore
@@ -0,0 +1,2 @@
+/tmp
+/vendor
diff --git a/test/rails/app-2.0.2/app/controllers/application.rb b/test/rails/app-2.0.2/app/controllers/application.rb
new file mode 100644
index 0000000..09705d1
--- /dev/null
+++ b/test/rails/app-2.0.2/app/controllers/application.rb
@@ -0,0 +1,2 @@
+class ApplicationController < ActionController::Base
+end
diff --git a/test/rails/app-2.0.2/app/controllers/foo_controller.rb b/test/rails/app-2.0.2/app/controllers/foo_controller.rb
new file mode 100644
index 0000000..7602947
--- /dev/null
+++ b/test/rails/app-2.0.2/app/controllers/foo_controller.rb
@@ -0,0 +1,5 @@
+class FooController < ApplicationController
+  def index
+    render :text => "FOO\n"
+  end
+end
diff --git a/test/rails/app-2.0.2/app/helpers/application_helper.rb b/test/rails/app-2.0.2/app/helpers/application_helper.rb
new file mode 100644
index 0000000..de6be79
--- /dev/null
+++ b/test/rails/app-2.0.2/app/helpers/application_helper.rb
@@ -0,0 +1,2 @@
+module ApplicationHelper
+end
diff --git a/test/rails/app-2.0.2/config/boot.rb b/test/rails/app-2.0.2/config/boot.rb
new file mode 100644
index 0000000..71c7d7c
--- /dev/null
+++ b/test/rails/app-2.0.2/config/boot.rb
@@ -0,0 +1,9 @@
+unless defined?(RAILS_ROOT)
+  root_path = File.join(File.dirname(__FILE__), '..')
+  RAILS_ROOT = root_path
+end
+
+unless defined?(Rails::Initializer)
+  require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
+  Rails::Initializer.run(:set_load_path)
+end
diff --git a/test/rails/app-2.0.2/config/database.yml b/test/rails/app-2.0.2/config/database.yml
new file mode 100644
index 0000000..9f77843
--- /dev/null
+++ b/test/rails/app-2.0.2/config/database.yml
@@ -0,0 +1,12 @@
+development:
+  adapter: sqlite3
+  database: db/development.sqlite3
+  timeout: 5000
+test:
+  adapter: sqlite3
+  database: db/test.sqlite3
+  timeout: 5000
+production:
+  adapter: sqlite3
+  database: db/production.sqlite3
+  timeout: 5000
diff --git a/test/rails/app-2.0.2/config/environment.rb b/test/rails/app-2.0.2/config/environment.rb
new file mode 100644
index 0000000..cb90b4b
--- /dev/null
+++ b/test/rails/app-2.0.2/config/environment.rb
@@ -0,0 +1,14 @@
+unless defined? RAILS_GEM_VERSION
+  RAILS_GEM_VERSION = ENV['UNICORN_RAILS_VERSION']
+end
+
+# Bootstrap the Rails environment, frameworks, and default configuration
+require File.join(File.dirname(__FILE__), 'boot')
+
+Rails::Initializer.run do |config|
+  config.frameworks -= [ :action_web_service, :action_mailer ]
+  config.action_controller.session = {
+    :session_key => "_unicorn_rails_test.#{rand}",
+    :secret => "#{rand}#{rand}#{rand}#{rand}",
+  }
+end
diff --git a/test/rails/app-2.0.2/config/environments/development.rb b/test/rails/app-2.0.2/config/environments/development.rb
new file mode 100644
index 0000000..6a613c1
--- /dev/null
+++ b/test/rails/app-2.0.2/config/environments/development.rb
@@ -0,0 +1,6 @@
+config.cache_classes = false
+config.whiny_nils = true
+config.action_controller.consider_all_requests_local = true
+config.action_controller.perform_caching = false
+config.action_view.cache_template_extensions = false
+config.action_view.debug_rjs = true
diff --git a/test/rails/app-2.0.2/config/environments/production.rb b/test/rails/app-2.0.2/config/environments/production.rb
new file mode 100644
index 0000000..c4059e3
--- /dev/null
+++ b/test/rails/app-2.0.2/config/environments/production.rb
@@ -0,0 +1,3 @@
+config.cache_classes = true
+config.action_controller.consider_all_requests_local = false
+config.action_controller.perform_caching             = true
diff --git a/test/rails/app-2.0.2/config/routes.rb b/test/rails/app-2.0.2/config/routes.rb
new file mode 100644
index 0000000..774028f
--- /dev/null
+++ b/test/rails/app-2.0.2/config/routes.rb
@@ -0,0 +1,4 @@
+ActionController::Routing::Routes.draw do |map|
+  map.connect ':controller/:action/:id.:format'
+  map.connect ':controller/:action/:id'
+end
diff --git a/test/rails/app-2.0.2/db/.gitignore b/test/rails/app-2.0.2/db/.gitignore
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/rails/app-2.0.2/db/.gitignore
diff --git a/test/rails/app-2.0.2/public/404.html b/test/rails/app-2.0.2/public/404.html
new file mode 100644
index 0000000..44d986c
--- /dev/null
+++ b/test/rails/app-2.0.2/public/404.html
@@ -0,0 +1 @@
+404 Not Found
diff --git a/test/rails/app-2.0.2/public/500.html b/test/rails/app-2.0.2/public/500.html
new file mode 100644
index 0000000..e534a49
--- /dev/null
+++ b/test/rails/app-2.0.2/public/500.html
@@ -0,0 +1 @@
+500 Internal Server Error
diff --git a/test/rails/app-2.2.2/.gitignore b/test/rails/app-2.2.2/.gitignore
new file mode 100644
index 0000000..f451f91
--- /dev/null
+++ b/test/rails/app-2.2.2/.gitignore
@@ -0,0 +1,2 @@
+/tmp
+/vendor
diff --git a/test/rails/app-2.2.2/app/controllers/application.rb b/test/rails/app-2.2.2/app/controllers/application.rb
new file mode 100644
index 0000000..09705d1
--- /dev/null
+++ b/test/rails/app-2.2.2/app/controllers/application.rb
@@ -0,0 +1,2 @@
+class ApplicationController < ActionController::Base
+end
diff --git a/test/rails/app-2.2.2/app/controllers/foo_controller.rb b/test/rails/app-2.2.2/app/controllers/foo_controller.rb
new file mode 100644
index 0000000..7602947
--- /dev/null
+++ b/test/rails/app-2.2.2/app/controllers/foo_controller.rb
@@ -0,0 +1,5 @@
+class FooController < ApplicationController
+  def index
+    render :text => "FOO\n"
+  end
+end
diff --git a/test/rails/app-2.2.2/app/helpers/application_helper.rb b/test/rails/app-2.2.2/app/helpers/application_helper.rb
new file mode 100644
index 0000000..de6be79
--- /dev/null
+++ b/test/rails/app-2.2.2/app/helpers/application_helper.rb
@@ -0,0 +1,2 @@
+module ApplicationHelper
+end
diff --git a/test/rails/app-2.2.2/config/boot.rb b/test/rails/app-2.2.2/config/boot.rb
new file mode 100644
index 0000000..0a51688
--- /dev/null
+++ b/test/rails/app-2.2.2/config/boot.rb
@@ -0,0 +1,109 @@
+# Don't change this file!
+# Configure your app in config/environment.rb and config/environments/*.rb
+
+RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)
+
+module Rails
+  class << self
+    def boot!
+      unless booted?
+        preinitialize
+        pick_boot.run
+      end
+    end
+
+    def booted?
+      defined? Rails::Initializer
+    end
+
+    def pick_boot
+      (vendor_rails? ? VendorBoot : GemBoot).new
+    end
+
+    def vendor_rails?
+      File.exist?("#{RAILS_ROOT}/vendor/rails")
+    end
+
+    def preinitialize
+      load(preinitializer_path) if File.exist?(preinitializer_path)
+    end
+
+    def preinitializer_path
+      "#{RAILS_ROOT}/config/preinitializer.rb"
+    end
+  end
+
+  class Boot
+    def run
+      load_initializer
+      Rails::Initializer.run(:set_load_path)
+    end
+  end
+
+  class VendorBoot < Boot
+    def load_initializer
+      require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
+      Rails::Initializer.run(:install_gem_spec_stubs)
+    end
+  end
+
+  class GemBoot < Boot
+    def load_initializer
+      self.class.load_rubygems
+      load_rails_gem
+      require 'initializer'
+    end
+
+    def load_rails_gem
+      if version = self.class.gem_version
+        gem 'rails', version
+      else
+        gem 'rails'
+      end
+    rescue Gem::LoadError => load_error
+      $stderr.puts %(Missing the Rails #{version} gem. Please `gem install -v=#{version} rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.)
+      exit 1
+    end
+
+    class << self
+      def rubygems_version
+        Gem::RubyGemsVersion rescue nil
+      end
+
+      def gem_version
+        if defined? RAILS_GEM_VERSION
+          RAILS_GEM_VERSION
+        elsif ENV.include?('RAILS_GEM_VERSION')
+          ENV['RAILS_GEM_VERSION']
+        else
+          parse_gem_version(read_environment_rb)
+        end
+      end
+
+      def load_rubygems
+        require 'rubygems'
+        min_version = '1.3.1'
+        unless rubygems_version >= min_version
+          $stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.)
+          exit 1
+        end
+
+      rescue LoadError
+        $stderr.puts %Q(Rails requires RubyGems >= #{min_version}. Please install RubyGems and try again: http://rubygems.rubyforge.org)
+        exit 1
+      end
+
+      def parse_gem_version(text)
+        $1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/
+      end
+
+      private
+        def read_environment_rb
+          File.read("#{RAILS_ROOT}/config/environment.rb")
+        end
+    end
+  end
+end
+
+# All that for this:
+Rails.boot!
diff --git a/test/rails/app-2.2.2/config/database.yml b/test/rails/app-2.2.2/config/database.yml
new file mode 100644
index 0000000..9f77843
--- /dev/null
+++ b/test/rails/app-2.2.2/config/database.yml
@@ -0,0 +1,12 @@
+development:
+  adapter: sqlite3
+  database: db/development.sqlite3
+  timeout: 5000
+test:
+  adapter: sqlite3
+  database: db/test.sqlite3
+  timeout: 5000
+production:
+  adapter: sqlite3
+  database: db/production.sqlite3
+  timeout: 5000
diff --git a/test/rails/app-2.2.2/config/environment.rb b/test/rails/app-2.2.2/config/environment.rb
new file mode 100644
index 0000000..cb90b4b
--- /dev/null
+++ b/test/rails/app-2.2.2/config/environment.rb
@@ -0,0 +1,14 @@
+unless defined? RAILS_GEM_VERSION
+  RAILS_GEM_VERSION = ENV['UNICORN_RAILS_VERSION']
+end
+
+# Bootstrap the Rails environment, frameworks, and default configuration
+require File.join(File.dirname(__FILE__), 'boot')
+
+Rails::Initializer.run do |config|
+  config.frameworks -= [ :action_web_service, :action_mailer ]
+  config.action_controller.session = {
+    :session_key => "_unicorn_rails_test.#{rand}",
+    :secret => "#{rand}#{rand}#{rand}#{rand}",
+  }
+end
diff --git a/test/rails/app-2.2.2/config/environments/development.rb b/test/rails/app-2.2.2/config/environments/development.rb
new file mode 100644
index 0000000..7f49032
--- /dev/null
+++ b/test/rails/app-2.2.2/config/environments/development.rb
@@ -0,0 +1,5 @@
+config.cache_classes = false
+config.whiny_nils = true
+config.action_controller.consider_all_requests_local = true
+config.action_controller.perform_caching = false
+config.action_view.debug_rjs = true
diff --git a/test/rails/app-2.2.2/config/environments/production.rb b/test/rails/app-2.2.2/config/environments/production.rb
new file mode 100644
index 0000000..c4059e3
--- /dev/null
+++ b/test/rails/app-2.2.2/config/environments/production.rb
@@ -0,0 +1,3 @@
+config.cache_classes = true
+config.action_controller.consider_all_requests_local = false
+config.action_controller.perform_caching             = true
diff --git a/test/rails/app-2.2.2/config/routes.rb b/test/rails/app-2.2.2/config/routes.rb
new file mode 100644
index 0000000..774028f
--- /dev/null
+++ b/test/rails/app-2.2.2/config/routes.rb
@@ -0,0 +1,4 @@
+ActionController::Routing::Routes.draw do |map|
+  map.connect ':controller/:action/:id.:format'
+  map.connect ':controller/:action/:id'
+end
diff --git a/test/rails/app-2.2.2/db/.gitignore b/test/rails/app-2.2.2/db/.gitignore
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/rails/app-2.2.2/db/.gitignore
diff --git a/test/rails/app-2.2.2/public/404.html b/test/rails/app-2.2.2/public/404.html
new file mode 100644
index 0000000..44d986c
--- /dev/null
+++ b/test/rails/app-2.2.2/public/404.html
@@ -0,0 +1 @@
+404 Not Found
diff --git a/test/rails/app-2.2.2/public/500.html b/test/rails/app-2.2.2/public/500.html
new file mode 100644
index 0000000..e534a49
--- /dev/null
+++ b/test/rails/app-2.2.2/public/500.html
@@ -0,0 +1 @@
+500 Internal Server Error
diff --git a/test/rails/app-2.3.2.1/.gitignore b/test/rails/app-2.3.2.1/.gitignore
new file mode 100644
index 0000000..f451f91
--- /dev/null
+++ b/test/rails/app-2.3.2.1/.gitignore
@@ -0,0 +1,2 @@
+/tmp
+/vendor
diff --git a/test/rails/app-2.3.2.1/app/controllers/application_controller.rb b/test/rails/app-2.3.2.1/app/controllers/application_controller.rb
new file mode 100644
index 0000000..6160f52
--- /dev/null
+++ b/test/rails/app-2.3.2.1/app/controllers/application_controller.rb
@@ -0,0 +1,3 @@
+class ApplicationController < ActionController::Base
+  helper :all
+end
diff --git a/test/rails/app-2.3.2.1/app/controllers/foo_controller.rb b/test/rails/app-2.3.2.1/app/controllers/foo_controller.rb
new file mode 100644
index 0000000..7602947
--- /dev/null
+++ b/test/rails/app-2.3.2.1/app/controllers/foo_controller.rb
@@ -0,0 +1,5 @@
+class FooController < ApplicationController
+  def index
+    render :text => "FOO\n"
+  end
+end
diff --git a/test/rails/app-2.3.2.1/app/helpers/application_helper.rb b/test/rails/app-2.3.2.1/app/helpers/application_helper.rb
new file mode 100644
index 0000000..de6be79
--- /dev/null
+++ b/test/rails/app-2.3.2.1/app/helpers/application_helper.rb
@@ -0,0 +1,2 @@
+module ApplicationHelper
+end
diff --git a/test/rails/app-2.3.2.1/config/boot.rb b/test/rails/app-2.3.2.1/config/boot.rb
new file mode 100644
index 0000000..d22e6b0
--- /dev/null
+++ b/test/rails/app-2.3.2.1/config/boot.rb
@@ -0,0 +1,107 @@
+RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)
+
+module Rails
+  class << self
+    def boot!
+      unless booted?
+        preinitialize
+        pick_boot.run
+      end
+    end
+
+    def booted?
+      defined? Rails::Initializer
+    end
+
+    def pick_boot
+      (vendor_rails? ? VendorBoot : GemBoot).new
+    end
+
+    def vendor_rails?
+      File.exist?("#{RAILS_ROOT}/vendor/rails")
+    end
+
+    def preinitialize
+      load(preinitializer_path) if File.exist?(preinitializer_path)
+    end
+
+    def preinitializer_path
+      "#{RAILS_ROOT}/config/preinitializer.rb"
+    end
+  end
+
+  class Boot
+    def run
+      load_initializer
+      Rails::Initializer.run(:set_load_path)
+    end
+  end
+
+  class VendorBoot < Boot
+    def load_initializer
+      require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
+      Rails::Initializer.run(:install_gem_spec_stubs)
+      Rails::GemDependency.add_frozen_gem_path
+    end
+  end
+
+  class GemBoot < Boot
+    def load_initializer
+      self.class.load_rubygems
+      load_rails_gem
+      require 'initializer'
+    end
+
+    def load_rails_gem
+      if version = self.class.gem_version
+        gem 'rails', version
+      else
+        gem 'rails'
+      end
+    rescue Gem::LoadError => load_error
+      $stderr.puts %(Missing the Rails #{version} gem. Please `gem install -v=#{version} rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.)
+      exit 1
+    end
+
+    class << self
+      def rubygems_version
+        Gem::RubyGemsVersion rescue nil
+      end
+
+      def gem_version
+        if defined? RAILS_GEM_VERSION
+          RAILS_GEM_VERSION
+        elsif ENV.include?('RAILS_GEM_VERSION')
+          ENV['RAILS_GEM_VERSION']
+        else
+          parse_gem_version(read_environment_rb)
+        end
+      end
+
+      def load_rubygems
+        require 'rubygems'
+        min_version = '1.3.1'
+        unless rubygems_version >= min_version
+          $stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.)
+          exit 1
+        end
+
+      rescue LoadError
+        $stderr.puts %Q(Rails requires RubyGems >= #{min_version}. Please install RubyGems and try again: http://rubygems.rubyforge.org)
+        exit 1
+      end
+
+      def parse_gem_version(text)
+        $1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/
+      end
+
+      private
+        def read_environment_rb
+          File.read("#{RAILS_ROOT}/config/environment.rb")
+        end
+    end
+  end
+end
+
+# All that for this:
+Rails.boot!
diff --git a/test/rails/app-2.3.2.1/config/database.yml b/test/rails/app-2.3.2.1/config/database.yml
new file mode 100644
index 0000000..9f77843
--- /dev/null
+++ b/test/rails/app-2.3.2.1/config/database.yml
@@ -0,0 +1,12 @@
+development:
+  adapter: sqlite3
+  database: db/development.sqlite3
+  timeout: 5000
+test:
+  adapter: sqlite3
+  database: db/test.sqlite3
+  timeout: 5000
+production:
+  adapter: sqlite3
+  database: db/production.sqlite3
+  timeout: 5000
diff --git a/test/rails/app-2.3.2.1/config/environment.rb b/test/rails/app-2.3.2.1/config/environment.rb
new file mode 100644
index 0000000..18f03f8
--- /dev/null
+++ b/test/rails/app-2.3.2.1/config/environment.rb
@@ -0,0 +1,14 @@
+unless defined? RAILS_GEM_VERSION
+  RAILS_GEM_VERSION = ENV['UNICORN_RAILS_VERSION']
+end
+
+# Bootstrap the Rails environment, frameworks, and default configuration
+require File.join(File.dirname(__FILE__), 'boot')
+
+Rails::Initializer.run do |config|
+  config.frameworks -= [ :active_record, :active_resource, :action_mailer ]
+  config.action_controller.session = {
+    :session_key => "_unicorn_rails_test.#{rand}",
+    :secret => "#{rand}#{rand}#{rand}#{rand}",
+  }
+end
diff --git a/test/rails/app-2.3.2.1/config/environments/development.rb b/test/rails/app-2.3.2.1/config/environments/development.rb
new file mode 100644
index 0000000..55376c5
--- /dev/null
+++ b/test/rails/app-2.3.2.1/config/environments/development.rb
@@ -0,0 +1,5 @@
+config.cache_classes = false
+config.whiny_nils = true
+config.action_controller.consider_all_requests_local = true
+config.action_view.debug_rjs                         = true
+config.action_controller.perform_caching             = false
diff --git a/test/rails/app-2.3.2.1/config/environments/production.rb b/test/rails/app-2.3.2.1/config/environments/production.rb
new file mode 100644
index 0000000..474257d
--- /dev/null
+++ b/test/rails/app-2.3.2.1/config/environments/production.rb
@@ -0,0 +1,4 @@
+config.cache_classes = true
+config.action_controller.consider_all_requests_local = false
+config.action_controller.perform_caching             = true
+config.action_view.cache_template_loading            = true
diff --git a/test/rails/app-2.3.2.1/config/routes.rb b/test/rails/app-2.3.2.1/config/routes.rb
new file mode 100644
index 0000000..4248853
--- /dev/null
+++ b/test/rails/app-2.3.2.1/config/routes.rb
@@ -0,0 +1,4 @@
+ActionController::Routing::Routes.draw do |map|
+  map.connect ':controller/:action/:id'
+  map.connect ':controller/:action/:id.:format'
+end
diff --git a/test/rails/app-2.3.2.1/db/.gitignore b/test/rails/app-2.3.2.1/db/.gitignore
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/rails/app-2.3.2.1/db/.gitignore
diff --git a/test/rails/app-2.3.2.1/public/404.html b/test/rails/app-2.3.2.1/public/404.html
new file mode 100644
index 0000000..44d986c
--- /dev/null
+++ b/test/rails/app-2.3.2.1/public/404.html
@@ -0,0 +1 @@
+404 Not Found
diff --git a/test/rails/app-2.3.2.1/public/500.html b/test/rails/app-2.3.2.1/public/500.html
new file mode 100644
index 0000000..e534a49
--- /dev/null
+++ b/test/rails/app-2.3.2.1/public/500.html
@@ -0,0 +1 @@
+500 Internal Server Error
diff --git a/test/rails/test_rails.rb b/test/rails/test_rails.rb
new file mode 100644
index 0000000..aa0d300
--- /dev/null
+++ b/test/rails/test_rails.rb
@@ -0,0 +1,148 @@
+# Copyright (c) 2009 Eric Wong
+STDIN.sync = STDOUT.sync = STDERR.sync = true
+require 'test/test_helper'
+require 'pathname'
+require 'tempfile'
+require 'fileutils'
+
+# don't call exit(0) since it may be run under rake (but gmake is recommended)
+do_test = true
+DEFAULT_TRIES = 1000
+DEFAULT_RES = 0.2
+
+$unicorn_rails_bin = ENV['UNICORN_RAILS_TEST_BIN'] || "unicorn_rails"
+redirect_test_io { do_test = system($unicorn_rails_bin, '-v') }
+
+unless do_test
+  warn "#$unicorn_rails_bin not found in PATH=#{ENV['PATH']}, " \
+       "skipping this test"
+end
+
+unless which('git')
+  warn "git not found in PATH=#{ENV['PATH']}, skipping this test"
+  do_test = false
+end
+
+if RAILS_GIT_REPO = ENV['RAILS_GIT_REPO']
+  unless File.directory?(RAILS_GIT_REPO)
+    warn "#{RAILS_GIT_REPO} not found, create it with:\n" \
+         "\tgit clone --mirror git://github.com/rails/rails #{RAILS_GIT_REPO}" \
+         "skipping this test for now"
+    do_test = false
+  end
+else
+  warn "RAILS_GIT_REPO not defined, don't know where to git clone from"
+  do_test = false
+end
+
+unless UNICORN_RAILS_TEST_VERSION = ENV['UNICORN_RAILS_TEST_VERSION']
+  warn 'UNICORN_RAILS_TEST_VERSION not defined in environment, ' \
+       'skipping this test'
+  do_test = false
+end
+
+RAILS_ROOT = "#{File.dirname(__FILE__)}/app-#{UNICORN_RAILS_TEST_VERSION}"
+unless File.directory?(RAILS_ROOT)
+  warn "unsupported UNICORN_RAILS_TEST_VERSION=#{UNICORN_RAILS_TEST_VERSION}"
+  do_test = false
+end
+
+ROR_V = UNICORN_RAILS_TEST_VERSION.split(/\./).map { |x| x.to_i }
+RB_V = RUBY_VERSION.split(/\./).map { |x| x.to_i }
+if RB_V[0] >= 1 && RB_V[1] >= 9
+  unless ROR_V[0] >= 2 && ROR_V[1] >= 3
+    warn "skipping Ruby >=1.9 test with Rails <2.3"
+    do_test = false
+  end
+end
+
+class RailsTest < Test::Unit::TestCase
+  trap(:QUIT, 'IGNORE')
+
+  COMMON_TMP = Tempfile.new('unicorn_tmp') unless defined?(COMMON_TMP)
+
+  HEAVY_CFG = <<-EOS
+worker_processes 2
+timeout 30
+logger Logger.new('#{COMMON_TMP.path}')
+  EOS
+
+  def setup
+    @pwd = Dir.pwd
+    @tmpfile = Tempfile.new('unicorn_rails_test')
+    @tmpdir = @tmpfile.path
+    @tmpfile.close!
+    assert_nothing_raised do
+      FileUtils.cp_r(RAILS_ROOT, @tmpdir, :preserve => true)
+    end
+    Dir.chdir(@tmpdir)
+    system('git', 'clone', '-nsq', RAILS_GIT_REPO, 'vendor/rails')
+    Dir.chdir("#@tmpdir/vendor/rails") do
+      system('git', 'reset', '-q', '--hard', "v#{UNICORN_RAILS_TEST_VERSION}")
+    end
+    @addr = ENV['UNICORN_TEST_ADDR'] || '127.0.0.1'
+    @port = unused_port(@addr)
+    @start_pid = $$
+  end
+
+  def test_launcher_defaults
+    tmp_dirs = %w(cache pids sessions sockets)
+    tmp_dirs.each { |dir| assert(! File.exist?("tmp/#{dir}")) }
+    pid = nil
+    redirect_test_io do
+      pid = fork { exec 'unicorn_rails', "-l#@addr:#@port" }
+    end
+    sleep 1 # HACK
+    tmp_dirs.each { |dir| assert(File.directory?("tmp/#{dir}")) }
+    res = Net::HTTP.get_response(URI.parse("http://#@addr:#@port/foo"))
+    assert_equal "FOO\n", res.body
+    assert_match %r{^text/html\b}, res['Content-Type']
+    assert_equal "4", res['Content-Length']
+    assert_nil res['Status']
+    Process.kill(:QUIT, pid)
+    pid2, status = Process.waitpid2(pid)
+    assert status.success?
+  end
+
+  def test_alt_url_root
+    # cbf to actually work on this since I never use this feature (ewong)
+    return unless ROR_V[0] >= 2 && ROR_V[1] >= 3
+    pid = nil
+    redirect_test_io do
+      pid = fork { exec 'unicorn_rails', "-l#@addr:#@port", '-P/poo' }
+    end
+    sleep 1 # HACK
+    res = Net::HTTP.get_response(URI.parse("http://#@addr:#@port/poo/foo"))
+    # p res
+    # p res.body
+    # system 'cat', 'log/development.log'
+    assert_equal "200", res.code
+    assert_equal "FOO\n", res.body
+    assert_match %r{^text/html\b}, res['Content-Type']
+    assert_equal "4", res['Content-Length']
+    assert_nil res['Status']
+
+    res = Net::HTTP.get_response(URI.parse("http://#@addr:#@port/foo"))
+    assert_equal "404", res.code
+    assert_nil res['Status']
+
+    Process.kill(:QUIT, pid)
+    pid2, status = Process.waitpid2(pid)
+    assert status.success?
+  end
+
+  def teardown
+    return if @start_pid != $$
+    Dir.chdir(@pwd)
+    FileUtils.rmtree(@tmpdir)
+    loop do
+      Process.kill('-QUIT', 0)
+      begin
+        Process.waitpid(-1, Process::WNOHANG) or break
+      rescue Errno::ECHILD
+        break
+      end
+    end
+  end
+
+end if do_test