From 91a3cde091d4ae6ff436681f155b3907daae1c04 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 26 Jul 2012 23:44:04 +0000 Subject: remove Rails-oriented integration tests It's too much overhead to keep Rails-specific tests working, especially when it's hauling in an ancient version of SQLite3. Since Rails 3 has settled down with Rack and unicorn_rails is unlikely to need changing in the future, we can drop these tests. --- test/rails/app-1.2.3/.gitignore | 2 - test/rails/app-1.2.3/Rakefile | 7 - .../rails/app-1.2.3/app/controllers/application.rb | 6 - .../app-1.2.3/app/controllers/foo_controller.rb | 36 --- .../app-1.2.3/app/helpers/application_helper.rb | 4 - test/rails/app-1.2.3/config/boot.rb | 11 - test/rails/app-1.2.3/config/database.yml | 12 - test/rails/app-1.2.3/config/environment.rb | 13 - .../app-1.2.3/config/environments/development.rb | 9 - .../app-1.2.3/config/environments/production.rb | 5 - test/rails/app-1.2.3/config/routes.rb | 6 - test/rails/app-1.2.3/db/.gitignore | 0 test/rails/app-1.2.3/log/.gitignore | 1 - test/rails/app-1.2.3/public/404.html | 1 - test/rails/app-1.2.3/public/500.html | 1 - test/rails/app-2.0.2/.gitignore | 2 - test/rails/app-2.0.2/Rakefile | 7 - .../rails/app-2.0.2/app/controllers/application.rb | 4 - .../app-2.0.2/app/controllers/foo_controller.rb | 36 --- .../app-2.0.2/app/helpers/application_helper.rb | 4 - test/rails/app-2.0.2/config/boot.rb | 11 - test/rails/app-2.0.2/config/database.yml | 12 - test/rails/app-2.0.2/config/environment.rb | 17 -- .../app-2.0.2/config/environments/development.rb | 8 - .../app-2.0.2/config/environments/production.rb | 5 - test/rails/app-2.0.2/config/routes.rb | 6 - test/rails/app-2.0.2/db/.gitignore | 0 test/rails/app-2.0.2/log/.gitignore | 1 - test/rails/app-2.0.2/public/404.html | 1 - test/rails/app-2.0.2/public/500.html | 1 - test/rails/app-2.1.2/.gitignore | 2 - test/rails/app-2.1.2/Rakefile | 7 - .../rails/app-2.1.2/app/controllers/application.rb | 4 - .../app-2.1.2/app/controllers/foo_controller.rb | 36 --- .../app-2.1.2/app/helpers/application_helper.rb | 4 - test/rails/app-2.1.2/config/boot.rb | 111 -------- test/rails/app-2.1.2/config/database.yml | 12 - test/rails/app-2.1.2/config/environment.rb | 17 -- .../app-2.1.2/config/environments/development.rb | 7 - .../app-2.1.2/config/environments/production.rb | 5 - test/rails/app-2.1.2/config/routes.rb | 6 - test/rails/app-2.1.2/db/.gitignore | 0 test/rails/app-2.1.2/log/.gitignore | 1 - test/rails/app-2.1.2/public/404.html | 1 - test/rails/app-2.1.2/public/500.html | 1 - test/rails/app-2.2.2/.gitignore | 2 - test/rails/app-2.2.2/Rakefile | 7 - .../rails/app-2.2.2/app/controllers/application.rb | 4 - .../app-2.2.2/app/controllers/foo_controller.rb | 36 --- .../app-2.2.2/app/helpers/application_helper.rb | 4 - test/rails/app-2.2.2/config/boot.rb | 111 -------- test/rails/app-2.2.2/config/database.yml | 12 - test/rails/app-2.2.2/config/environment.rb | 17 -- .../app-2.2.2/config/environments/development.rb | 7 - .../app-2.2.2/config/environments/production.rb | 5 - test/rails/app-2.2.2/config/routes.rb | 6 - test/rails/app-2.2.2/db/.gitignore | 0 test/rails/app-2.2.2/log/.gitignore | 1 - test/rails/app-2.2.2/public/404.html | 1 - test/rails/app-2.2.2/public/500.html | 1 - test/rails/test_rails.rb | 287 --------------------- 61 files changed, 944 deletions(-) delete mode 100644 test/rails/app-1.2.3/.gitignore delete mode 100644 test/rails/app-1.2.3/Rakefile delete mode 100644 test/rails/app-1.2.3/app/controllers/application.rb delete mode 100644 test/rails/app-1.2.3/app/controllers/foo_controller.rb delete mode 100644 test/rails/app-1.2.3/app/helpers/application_helper.rb delete mode 100644 test/rails/app-1.2.3/config/boot.rb delete mode 100644 test/rails/app-1.2.3/config/database.yml delete mode 100644 test/rails/app-1.2.3/config/environment.rb delete mode 100644 test/rails/app-1.2.3/config/environments/development.rb delete mode 100644 test/rails/app-1.2.3/config/environments/production.rb delete mode 100644 test/rails/app-1.2.3/config/routes.rb delete mode 100644 test/rails/app-1.2.3/db/.gitignore delete mode 100644 test/rails/app-1.2.3/log/.gitignore delete mode 100644 test/rails/app-1.2.3/public/404.html delete mode 100644 test/rails/app-1.2.3/public/500.html delete mode 100644 test/rails/app-2.0.2/.gitignore delete mode 100644 test/rails/app-2.0.2/Rakefile delete mode 100644 test/rails/app-2.0.2/app/controllers/application.rb delete mode 100644 test/rails/app-2.0.2/app/controllers/foo_controller.rb delete mode 100644 test/rails/app-2.0.2/app/helpers/application_helper.rb delete mode 100644 test/rails/app-2.0.2/config/boot.rb delete mode 100644 test/rails/app-2.0.2/config/database.yml delete mode 100644 test/rails/app-2.0.2/config/environment.rb delete mode 100644 test/rails/app-2.0.2/config/environments/development.rb delete mode 100644 test/rails/app-2.0.2/config/environments/production.rb delete mode 100644 test/rails/app-2.0.2/config/routes.rb delete mode 100644 test/rails/app-2.0.2/db/.gitignore delete mode 100644 test/rails/app-2.0.2/log/.gitignore delete mode 100644 test/rails/app-2.0.2/public/404.html delete mode 100644 test/rails/app-2.0.2/public/500.html delete mode 100644 test/rails/app-2.1.2/.gitignore delete mode 100644 test/rails/app-2.1.2/Rakefile delete mode 100644 test/rails/app-2.1.2/app/controllers/application.rb delete mode 100644 test/rails/app-2.1.2/app/controllers/foo_controller.rb delete mode 100644 test/rails/app-2.1.2/app/helpers/application_helper.rb delete mode 100644 test/rails/app-2.1.2/config/boot.rb delete mode 100644 test/rails/app-2.1.2/config/database.yml delete mode 100644 test/rails/app-2.1.2/config/environment.rb delete mode 100644 test/rails/app-2.1.2/config/environments/development.rb delete mode 100644 test/rails/app-2.1.2/config/environments/production.rb delete mode 100644 test/rails/app-2.1.2/config/routes.rb delete mode 100644 test/rails/app-2.1.2/db/.gitignore delete mode 100644 test/rails/app-2.1.2/log/.gitignore delete mode 100644 test/rails/app-2.1.2/public/404.html delete mode 100644 test/rails/app-2.1.2/public/500.html delete mode 100644 test/rails/app-2.2.2/.gitignore delete mode 100644 test/rails/app-2.2.2/Rakefile delete mode 100644 test/rails/app-2.2.2/app/controllers/application.rb delete mode 100644 test/rails/app-2.2.2/app/controllers/foo_controller.rb delete mode 100644 test/rails/app-2.2.2/app/helpers/application_helper.rb delete mode 100644 test/rails/app-2.2.2/config/boot.rb delete mode 100644 test/rails/app-2.2.2/config/database.yml delete mode 100644 test/rails/app-2.2.2/config/environment.rb delete mode 100644 test/rails/app-2.2.2/config/environments/development.rb delete mode 100644 test/rails/app-2.2.2/config/environments/production.rb delete mode 100644 test/rails/app-2.2.2/config/routes.rb delete mode 100644 test/rails/app-2.2.2/db/.gitignore delete mode 100644 test/rails/app-2.2.2/log/.gitignore delete mode 100644 test/rails/app-2.2.2/public/404.html delete mode 100644 test/rails/app-2.2.2/public/500.html delete mode 100644 test/rails/test_rails.rb (limited to 'test') diff --git a/test/rails/app-1.2.3/.gitignore b/test/rails/app-1.2.3/.gitignore deleted file mode 100644 index f451f91..0000000 --- a/test/rails/app-1.2.3/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/tmp -/vendor diff --git a/test/rails/app-1.2.3/Rakefile b/test/rails/app-1.2.3/Rakefile deleted file mode 100644 index fbebfca..0000000 --- a/test/rails/app-1.2.3/Rakefile +++ /dev/null @@ -1,7 +0,0 @@ -require(File.join(File.dirname(__FILE__), 'config', 'boot')) - -require 'rake' -require 'rake/testtask' -require 'rake/rdoctask' - -require 'tasks/rails' diff --git a/test/rails/app-1.2.3/app/controllers/application.rb b/test/rails/app-1.2.3/app/controllers/application.rb deleted file mode 100644 index e72474f..0000000 --- a/test/rails/app-1.2.3/app/controllers/application.rb +++ /dev/null @@ -1,6 +0,0 @@ -# -*- encoding: binary -*- - -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 deleted file mode 100644 index 52b7947..0000000 --- a/test/rails/app-1.2.3/app/controllers/foo_controller.rb +++ /dev/null @@ -1,36 +0,0 @@ -# -*- encoding: binary -*- - -require 'digest/sha1' -class FooController < ApplicationController - def index - render :text => "FOO\n" - end - - def xcookie - cookies["foo"] = "cookie #$$" - render :text => "" - end - - def xnotice - flash[:notice] = "session #$$" - render :text => "" - end - - def xpost - if request.post? - digest = Digest::SHA1.new - out = "params: #{params.inspect}\n" - if file = params[:file] - loop do - buf = file.read(4096) or break - digest.update(buf) - end - out << "sha1: #{digest.to_s}\n" - end - headers['content-type'] = 'text/plain' - render :text => out - else - render :status => 403, :text => "need post\n" - end - 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 deleted file mode 100644 index d9889b3..0000000 --- a/test/rails/app-1.2.3/app/helpers/application_helper.rb +++ /dev/null @@ -1,4 +0,0 @@ -# -*- encoding: binary -*- - -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 deleted file mode 100644 index 84a5c18..0000000 --- a/test/rails/app-1.2.3/config/boot.rb +++ /dev/null @@ -1,11 +0,0 @@ -# -*- encoding: binary -*- - -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 deleted file mode 100644 index 9f77843..0000000 --- a/test/rails/app-1.2.3/config/database.yml +++ /dev/null @@ -1,12 +0,0 @@ -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 deleted file mode 100644 index e230a66..0000000 --- a/test/rails/app-1.2.3/config/environment.rb +++ /dev/null @@ -1,13 +0,0 @@ -# -*- encoding: binary -*- - -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 ] - config.action_controller.session_store = :active_record_store -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 deleted file mode 100644 index 9d78f5e..0000000 --- a/test/rails/app-1.2.3/config/environments/development.rb +++ /dev/null @@ -1,9 +0,0 @@ -# -*- encoding: binary -*- - -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 deleted file mode 100644 index 1e049b2..0000000 --- a/test/rails/app-1.2.3/config/environments/production.rb +++ /dev/null @@ -1,5 +0,0 @@ -# -*- encoding: binary -*- - -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 deleted file mode 100644 index 70816dc..0000000 --- a/test/rails/app-1.2.3/config/routes.rb +++ /dev/null @@ -1,6 +0,0 @@ -# -*- encoding: binary -*- - -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 deleted file mode 100644 index e69de29..0000000 diff --git a/test/rails/app-1.2.3/log/.gitignore b/test/rails/app-1.2.3/log/.gitignore deleted file mode 100644 index 397b4a7..0000000 --- a/test/rails/app-1.2.3/log/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.log diff --git a/test/rails/app-1.2.3/public/404.html b/test/rails/app-1.2.3/public/404.html deleted file mode 100644 index 44d986c..0000000 --- a/test/rails/app-1.2.3/public/404.html +++ /dev/null @@ -1 +0,0 @@ -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 deleted file mode 100644 index e534a49..0000000 --- a/test/rails/app-1.2.3/public/500.html +++ /dev/null @@ -1 +0,0 @@ -500 Internal Server Error diff --git a/test/rails/app-2.0.2/.gitignore b/test/rails/app-2.0.2/.gitignore deleted file mode 100644 index f451f91..0000000 --- a/test/rails/app-2.0.2/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/tmp -/vendor diff --git a/test/rails/app-2.0.2/Rakefile b/test/rails/app-2.0.2/Rakefile deleted file mode 100644 index fbebfca..0000000 --- a/test/rails/app-2.0.2/Rakefile +++ /dev/null @@ -1,7 +0,0 @@ -require(File.join(File.dirname(__FILE__), 'config', 'boot')) - -require 'rake' -require 'rake/testtask' -require 'rake/rdoctask' - -require 'tasks/rails' diff --git a/test/rails/app-2.0.2/app/controllers/application.rb b/test/rails/app-2.0.2/app/controllers/application.rb deleted file mode 100644 index e7bb740..0000000 --- a/test/rails/app-2.0.2/app/controllers/application.rb +++ /dev/null @@ -1,4 +0,0 @@ -# -*- encoding: binary -*- - -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 deleted file mode 100644 index 52b7947..0000000 --- a/test/rails/app-2.0.2/app/controllers/foo_controller.rb +++ /dev/null @@ -1,36 +0,0 @@ -# -*- encoding: binary -*- - -require 'digest/sha1' -class FooController < ApplicationController - def index - render :text => "FOO\n" - end - - def xcookie - cookies["foo"] = "cookie #$$" - render :text => "" - end - - def xnotice - flash[:notice] = "session #$$" - render :text => "" - end - - def xpost - if request.post? - digest = Digest::SHA1.new - out = "params: #{params.inspect}\n" - if file = params[:file] - loop do - buf = file.read(4096) or break - digest.update(buf) - end - out << "sha1: #{digest.to_s}\n" - end - headers['content-type'] = 'text/plain' - render :text => out - else - render :status => 403, :text => "need post\n" - end - 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 deleted file mode 100644 index d9889b3..0000000 --- a/test/rails/app-2.0.2/app/helpers/application_helper.rb +++ /dev/null @@ -1,4 +0,0 @@ -# -*- encoding: binary -*- - -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 deleted file mode 100644 index 84a5c18..0000000 --- a/test/rails/app-2.0.2/config/boot.rb +++ /dev/null @@ -1,11 +0,0 @@ -# -*- encoding: binary -*- - -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 deleted file mode 100644 index 9f77843..0000000 --- a/test/rails/app-2.0.2/config/database.yml +++ /dev/null @@ -1,12 +0,0 @@ -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 deleted file mode 100644 index 9961f08..0000000 --- a/test/rails/app-2.0.2/config/environment.rb +++ /dev/null @@ -1,17 +0,0 @@ -# -*- encoding: binary -*- - -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_store = :active_record_store - 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 deleted file mode 100644 index 5e0f1ca..0000000 --- a/test/rails/app-2.0.2/config/environments/development.rb +++ /dev/null @@ -1,8 +0,0 @@ -# -*- encoding: binary -*- - -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 deleted file mode 100644 index 1e049b2..0000000 --- a/test/rails/app-2.0.2/config/environments/production.rb +++ /dev/null @@ -1,5 +0,0 @@ -# -*- encoding: binary -*- - -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 deleted file mode 100644 index 70816dc..0000000 --- a/test/rails/app-2.0.2/config/routes.rb +++ /dev/null @@ -1,6 +0,0 @@ -# -*- encoding: binary -*- - -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 deleted file mode 100644 index e69de29..0000000 diff --git a/test/rails/app-2.0.2/log/.gitignore b/test/rails/app-2.0.2/log/.gitignore deleted file mode 100644 index 397b4a7..0000000 --- a/test/rails/app-2.0.2/log/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.log diff --git a/test/rails/app-2.0.2/public/404.html b/test/rails/app-2.0.2/public/404.html deleted file mode 100644 index 44d986c..0000000 --- a/test/rails/app-2.0.2/public/404.html +++ /dev/null @@ -1 +0,0 @@ -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 deleted file mode 100644 index e534a49..0000000 --- a/test/rails/app-2.0.2/public/500.html +++ /dev/null @@ -1 +0,0 @@ -500 Internal Server Error diff --git a/test/rails/app-2.1.2/.gitignore b/test/rails/app-2.1.2/.gitignore deleted file mode 100644 index f451f91..0000000 --- a/test/rails/app-2.1.2/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/tmp -/vendor diff --git a/test/rails/app-2.1.2/Rakefile b/test/rails/app-2.1.2/Rakefile deleted file mode 100644 index fbebfca..0000000 --- a/test/rails/app-2.1.2/Rakefile +++ /dev/null @@ -1,7 +0,0 @@ -require(File.join(File.dirname(__FILE__), 'config', 'boot')) - -require 'rake' -require 'rake/testtask' -require 'rake/rdoctask' - -require 'tasks/rails' diff --git a/test/rails/app-2.1.2/app/controllers/application.rb b/test/rails/app-2.1.2/app/controllers/application.rb deleted file mode 100644 index e7bb740..0000000 --- a/test/rails/app-2.1.2/app/controllers/application.rb +++ /dev/null @@ -1,4 +0,0 @@ -# -*- encoding: binary -*- - -class ApplicationController < ActionController::Base -end diff --git a/test/rails/app-2.1.2/app/controllers/foo_controller.rb b/test/rails/app-2.1.2/app/controllers/foo_controller.rb deleted file mode 100644 index 52b7947..0000000 --- a/test/rails/app-2.1.2/app/controllers/foo_controller.rb +++ /dev/null @@ -1,36 +0,0 @@ -# -*- encoding: binary -*- - -require 'digest/sha1' -class FooController < ApplicationController - def index - render :text => "FOO\n" - end - - def xcookie - cookies["foo"] = "cookie #$$" - render :text => "" - end - - def xnotice - flash[:notice] = "session #$$" - render :text => "" - end - - def xpost - if request.post? - digest = Digest::SHA1.new - out = "params: #{params.inspect}\n" - if file = params[:file] - loop do - buf = file.read(4096) or break - digest.update(buf) - end - out << "sha1: #{digest.to_s}\n" - end - headers['content-type'] = 'text/plain' - render :text => out - else - render :status => 403, :text => "need post\n" - end - end -end diff --git a/test/rails/app-2.1.2/app/helpers/application_helper.rb b/test/rails/app-2.1.2/app/helpers/application_helper.rb deleted file mode 100644 index d9889b3..0000000 --- a/test/rails/app-2.1.2/app/helpers/application_helper.rb +++ /dev/null @@ -1,4 +0,0 @@ -# -*- encoding: binary -*- - -module ApplicationHelper -end diff --git a/test/rails/app-2.1.2/config/boot.rb b/test/rails/app-2.1.2/config/boot.rb deleted file mode 100644 index e357f0a..0000000 --- a/test/rails/app-2.1.2/config/boot.rb +++ /dev/null @@ -1,111 +0,0 @@ -# -*- encoding: binary -*- - -# 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.1.2/config/database.yml b/test/rails/app-2.1.2/config/database.yml deleted file mode 100644 index 9f77843..0000000 --- a/test/rails/app-2.1.2/config/database.yml +++ /dev/null @@ -1,12 +0,0 @@ -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.1.2/config/environment.rb b/test/rails/app-2.1.2/config/environment.rb deleted file mode 100644 index 9961f08..0000000 --- a/test/rails/app-2.1.2/config/environment.rb +++ /dev/null @@ -1,17 +0,0 @@ -# -*- encoding: binary -*- - -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_store = :active_record_store - config.action_controller.session = { - :session_key => "_unicorn_rails_test.#{rand}", - :secret => "#{rand}#{rand}#{rand}#{rand}", - } -end diff --git a/test/rails/app-2.1.2/config/environments/development.rb b/test/rails/app-2.1.2/config/environments/development.rb deleted file mode 100644 index 37f523f..0000000 --- a/test/rails/app-2.1.2/config/environments/development.rb +++ /dev/null @@ -1,7 +0,0 @@ -# -*- encoding: binary -*- - -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.1.2/config/environments/production.rb b/test/rails/app-2.1.2/config/environments/production.rb deleted file mode 100644 index 1e049b2..0000000 --- a/test/rails/app-2.1.2/config/environments/production.rb +++ /dev/null @@ -1,5 +0,0 @@ -# -*- encoding: binary -*- - -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.1.2/config/routes.rb b/test/rails/app-2.1.2/config/routes.rb deleted file mode 100644 index 70816dc..0000000 --- a/test/rails/app-2.1.2/config/routes.rb +++ /dev/null @@ -1,6 +0,0 @@ -# -*- encoding: binary -*- - -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.1.2/db/.gitignore b/test/rails/app-2.1.2/db/.gitignore deleted file mode 100644 index e69de29..0000000 diff --git a/test/rails/app-2.1.2/log/.gitignore b/test/rails/app-2.1.2/log/.gitignore deleted file mode 100644 index 397b4a7..0000000 --- a/test/rails/app-2.1.2/log/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.log diff --git a/test/rails/app-2.1.2/public/404.html b/test/rails/app-2.1.2/public/404.html deleted file mode 100644 index 44d986c..0000000 --- a/test/rails/app-2.1.2/public/404.html +++ /dev/null @@ -1 +0,0 @@ -404 Not Found diff --git a/test/rails/app-2.1.2/public/500.html b/test/rails/app-2.1.2/public/500.html deleted file mode 100644 index e534a49..0000000 --- a/test/rails/app-2.1.2/public/500.html +++ /dev/null @@ -1 +0,0 @@ -500 Internal Server Error diff --git a/test/rails/app-2.2.2/.gitignore b/test/rails/app-2.2.2/.gitignore deleted file mode 100644 index f451f91..0000000 --- a/test/rails/app-2.2.2/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/tmp -/vendor diff --git a/test/rails/app-2.2.2/Rakefile b/test/rails/app-2.2.2/Rakefile deleted file mode 100644 index fbebfca..0000000 --- a/test/rails/app-2.2.2/Rakefile +++ /dev/null @@ -1,7 +0,0 @@ -require(File.join(File.dirname(__FILE__), 'config', 'boot')) - -require 'rake' -require 'rake/testtask' -require 'rake/rdoctask' - -require 'tasks/rails' diff --git a/test/rails/app-2.2.2/app/controllers/application.rb b/test/rails/app-2.2.2/app/controllers/application.rb deleted file mode 100644 index e7bb740..0000000 --- a/test/rails/app-2.2.2/app/controllers/application.rb +++ /dev/null @@ -1,4 +0,0 @@ -# -*- encoding: binary -*- - -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 deleted file mode 100644 index 52b7947..0000000 --- a/test/rails/app-2.2.2/app/controllers/foo_controller.rb +++ /dev/null @@ -1,36 +0,0 @@ -# -*- encoding: binary -*- - -require 'digest/sha1' -class FooController < ApplicationController - def index - render :text => "FOO\n" - end - - def xcookie - cookies["foo"] = "cookie #$$" - render :text => "" - end - - def xnotice - flash[:notice] = "session #$$" - render :text => "" - end - - def xpost - if request.post? - digest = Digest::SHA1.new - out = "params: #{params.inspect}\n" - if file = params[:file] - loop do - buf = file.read(4096) or break - digest.update(buf) - end - out << "sha1: #{digest.to_s}\n" - end - headers['content-type'] = 'text/plain' - render :text => out - else - render :status => 403, :text => "need post\n" - end - 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 deleted file mode 100644 index d9889b3..0000000 --- a/test/rails/app-2.2.2/app/helpers/application_helper.rb +++ /dev/null @@ -1,4 +0,0 @@ -# -*- encoding: binary -*- - -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 deleted file mode 100644 index e357f0a..0000000 --- a/test/rails/app-2.2.2/config/boot.rb +++ /dev/null @@ -1,111 +0,0 @@ -# -*- encoding: binary -*- - -# 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 deleted file mode 100644 index 9f77843..0000000 --- a/test/rails/app-2.2.2/config/database.yml +++ /dev/null @@ -1,12 +0,0 @@ -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 deleted file mode 100644 index 9961f08..0000000 --- a/test/rails/app-2.2.2/config/environment.rb +++ /dev/null @@ -1,17 +0,0 @@ -# -*- encoding: binary -*- - -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_store = :active_record_store - 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 deleted file mode 100644 index 37f523f..0000000 --- a/test/rails/app-2.2.2/config/environments/development.rb +++ /dev/null @@ -1,7 +0,0 @@ -# -*- encoding: binary -*- - -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 deleted file mode 100644 index 1e049b2..0000000 --- a/test/rails/app-2.2.2/config/environments/production.rb +++ /dev/null @@ -1,5 +0,0 @@ -# -*- encoding: binary -*- - -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 deleted file mode 100644 index 70816dc..0000000 --- a/test/rails/app-2.2.2/config/routes.rb +++ /dev/null @@ -1,6 +0,0 @@ -# -*- encoding: binary -*- - -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 deleted file mode 100644 index e69de29..0000000 diff --git a/test/rails/app-2.2.2/log/.gitignore b/test/rails/app-2.2.2/log/.gitignore deleted file mode 100644 index 397b4a7..0000000 --- a/test/rails/app-2.2.2/log/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.log diff --git a/test/rails/app-2.2.2/public/404.html b/test/rails/app-2.2.2/public/404.html deleted file mode 100644 index 44d986c..0000000 --- a/test/rails/app-2.2.2/public/404.html +++ /dev/null @@ -1 +0,0 @@ -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 deleted file mode 100644 index e534a49..0000000 --- a/test/rails/app-2.2.2/public/500.html +++ /dev/null @@ -1 +0,0 @@ -500 Internal Server Error diff --git a/test/rails/test_rails.rb b/test/rails/test_rails.rb deleted file mode 100644 index 9cf92c0..0000000 --- a/test/rails/test_rails.rb +++ /dev/null @@ -1,287 +0,0 @@ -# -*- encoding: binary -*- - -# Copyright (c) 2009 Eric Wong -require 'test/test_helper' - -# don't call exit(0) since it may be run under rake (but gmake is recommended) -do_test = true - -$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] >= 2 - warn "skipping Ruby 2.0+ test with Rails <3" - do_test = false -elsif RB_V[0] >= 1 && RB_V[1] >= 9 - if RB_V[2] >= 2 - warn "Ruby 1.9.2+ is not compatible with Rails 2.x" - do_test = false - end - 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 - - assert(system('rake', 'db:sessions:create')) - assert(system('rake', 'db:migrate')) - - @addr = ENV['UNICORN_TEST_ADDR'] || '127.0.0.1' - @port = unused_port(@addr) - @start_pid = $$ - @pid = nil - end - - def test_launcher - tmp_dirs = %w(cache pids sessions sockets) - tmp_dirs.each { |dir| assert(! File.exist?("tmp/#{dir}")) } - redirect_test_io { @pid = fork { exec 'unicorn_rails', "-l#@addr:#@port" } } - wait_master_ready("test_stderr.#$$.log") - - # basic GET - 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_equal "200 OK", res['Status'] - - # temp dirs exist - tmp_dirs.each { |dir| assert(File.directory?("tmp/#{dir}")) } - - # can we set cookies? - res = Net::HTTP.get_response(URI.parse("http://#@addr:#@port/foo/xcookie")) - assert_equal "200", res.code - assert_equal "200 OK", res['Status'] - cookies = res.get_fields('Set-Cookie') - assert_equal 2, cookies.size - assert_equal 1, cookies.grep(/\A_unicorn_rails_test\./).size - assert_equal 1, cookies.grep(/\Afoo=cookie/).size - - # how about just a session? - res = Net::HTTP.get_response(URI.parse("http://#@addr:#@port/foo/xnotice")) - assert_equal "200", res.code - assert_equal "200 OK", res['Status'] - cookies = res.get_fields('Set-Cookie') - assert_equal 1, cookies.size - assert_equal 1, cookies.grep(/\A_unicorn_rails_test\./).size - - # posting forms? - uri = URI.parse("http://#@addr:#@port/foo/xpost") - wait_master_ready("test_stderr.#$$.log") - res = Net::HTTP.post_form(uri, {"a" => "b", "c"=>"d"}) - assert_equal "200", res.code - params = res.body.split(/\n/).grep(/^params:/) - assert_equal 1, params.size - params = eval(params[0].gsub!(/\Aparams:/, '')) - assert_equal Hash, params.class - assert_equal 'b', params['a'] - assert_equal 'd', params['c'] - assert_equal "200 OK", res['Status'] - - # try uploading a big file - tmp = Tempfile.new('random') - sha1 = Digest::SHA1.new - assert_nothing_raised do - File.open("/dev/urandom", "rb") do |fp| - 256.times do - buf = fp.sysread(4096) - sha1.update(buf) - tmp.syswrite(buf) - end - end - end - - # fixed in Rack commit 44ed4640f077504a49b7f1cabf8d6ad7a13f6441, - # no released version of Rails or Rack has this fix - if RB_V[0] >= 1 && RB_V[1] >= 9 - warn "multipart broken with Rack 1.0.0 and Rails 2.3.2.1 under 1.9" - else - resp = `curl -isSfN -Ffile=@#{tmp.path} http://#@addr:#@port/foo/xpost` - assert $?.success? - resp = resp.split(/\r?\n/) - grepped = resp.grep(/^sha1: (.{40})/) - assert_equal 1, grepped.size - assert_equal(sha1.hexdigest, /^sha1: (.{40})/.match(grepped.first)[1]) - - grepped = resp.grep(/^Content-Type:\s+(.+)/i) - assert_equal 1, grepped.size - assert_match %r{^text/plain}, grepped.first.split(/\s*:\s*/)[1] - assert_equal 1, resp.grep(/^Status:/i).size - end - - # make sure we can get 403 responses, too - uri = URI.parse("http://#@addr:#@port/foo/xpost") - wait_master_ready("test_stderr.#$$.log") - res = Net::HTTP.get_response(uri) - assert_equal "403", res.code - assert_equal "403 Forbidden", res['Status'] - - # non existent controller - uri = URI.parse("http://#@addr:#@port/asdf") - res = Net::HTTP.get_response(uri) - assert_equal "404", res.code - assert_equal "404 Not Found", res['Status'] - - # static files - - # ensure file we're about to serve is not there yet - res = Net::HTTP.get_response(URI.parse("http://#@addr:#@port/pid.txt")) - assert_equal "404 Not Found", res['Status'] - assert_equal '404', res.code - - # can we serve text files based on suffix? - File.open("public/pid.txt", "wb") { |fp| fp.syswrite("#$$\n") } - res = Net::HTTP.get_response(URI.parse("http://#@addr:#@port/pid.txt")) - assert_equal '200', res.code - assert_equal "200 OK", res['Status'] - assert_match %r{^text/plain}, res['Content-Type'] - assert_equal "#$$\n", res.body - - # can we serve HTML files based on suffix? - assert File.exist?("public/500.html") - res = Net::HTTP.get_response(URI.parse("http://#@addr:#@port/500.html")) - assert_equal '200', res.code - assert_equal '200 OK', res['Status'] - assert_match %r{^text/html}, res['Content-Type'] - five_hundred_body = res.body - - # lets try pretending 500 is a controller that got cached - assert ! File.exist?("public/500") - assert_equal five_hundred_body, File.read("public/500.html") - res = Net::HTTP.get_response(URI.parse("http://#@addr:#@port/500")) - assert_equal '200', res.code - assert_equal '200 OK', res['Status'] - assert_match %r{^text/html}, res['Content-Type'] - assert_equal five_hundred_body, res.body - 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 - redirect_test_io do - @pid = fork { exec 'unicorn_rails', "-l#@addr:#@port", '-P/poo' } - end - wait_master_ready("test_stderr.#$$.log") - 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 '200 OK', res['Status'] - assert_equal "FOO\n", res.body - assert_match %r{^text/html\b}, res['Content-Type'] - assert_equal "4", res['Content-Length'] - - res = Net::HTTP.get_response(URI.parse("http://#@addr:#@port/foo")) - assert_equal "404", res.code - assert_equal '404 Not Found', res['Status'] - end - - def test_alt_url_root_config_env - # cbf to actually work on this since I never use this feature (ewong) - return unless ROR_V[0] >= 2 && ROR_V[1] >= 3 - tmp = Tempfile.new('') - tmp.syswrite("ENV['RAILS_RELATIVE_URL_ROOT'] = '/poo'\n") - redirect_test_io do - @pid = fork { exec 'unicorn_rails', "-l#@addr:#@port", "-c", tmp.path } - end - wait_master_ready("test_stderr.#$$.log") - res = Net::HTTP.get_response(URI.parse("http://#@addr:#@port/poo/foo")) - assert_equal "200", res.code - assert_equal '200 OK', res['Status'] - assert_equal "FOO\n", res.body - assert_match %r{^text/html\b}, res['Content-Type'] - assert_equal "4", res['Content-Length'] - - res = Net::HTTP.get_response(URI.parse("http://#@addr:#@port/foo")) - assert_equal "404", res.code - assert_equal '404 Not Found', res['Status'] - - res = Net::HTTP.get_response(URI.parse("http://#@addr:#@port/poo/x.txt")) - assert_equal "200", res.code - assert_equal "HELLO\n", res.body - end - - def teardown - return if @start_pid != $$ - - if @pid - Process.kill(:QUIT, @pid) - _, status = Process.waitpid2(@pid) - assert status.success? - end - - 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 -- cgit v1.2.3-24-ge0c7