2009-09-25 22:32:28 -04:00
|
|
|
require "isolation/abstract_unit"
|
|
|
|
|
|
|
|
module ApplicationTests
|
2010-01-26 07:57:11 -05:00
|
|
|
class RackupTest < Test::Unit::TestCase
|
2009-09-25 22:32:28 -04:00
|
|
|
include ActiveSupport::Testing::Isolation
|
|
|
|
|
2009-09-28 20:57:36 -04:00
|
|
|
def rackup
|
2009-11-24 16:03:24 -05:00
|
|
|
require "rack"
|
2009-11-25 17:45:12 -05:00
|
|
|
app, options = Rack::Builder.parse_file("#{app_path}/config.ru")
|
|
|
|
app
|
2009-09-28 20:57:36 -04:00
|
|
|
end
|
|
|
|
|
2009-09-25 22:32:28 -04:00
|
|
|
def setup
|
|
|
|
build_app
|
2009-09-29 19:07:29 -04:00
|
|
|
boot_rails
|
2009-09-25 22:32:28 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
test "rails app is present" do
|
|
|
|
assert File.exist?(app_path("config"))
|
|
|
|
end
|
|
|
|
|
2009-09-28 20:57:36 -04:00
|
|
|
test "config.ru can be racked up" do
|
2009-12-23 22:10:44 -05:00
|
|
|
Dir.chdir app_path do
|
|
|
|
@app = rackup
|
|
|
|
assert_welcome get("/")
|
|
|
|
end
|
2009-09-25 22:32:28 -04:00
|
|
|
end
|
|
|
|
|
2009-09-28 20:57:36 -04:00
|
|
|
test "Rails.application is available after config.ru has been racked up" do
|
|
|
|
rackup
|
2010-05-19 15:14:51 -04:00
|
|
|
assert_kind_of Rails::Application, Rails.application
|
2009-09-28 20:57:36 -04:00
|
|
|
end
|
2009-09-25 22:32:28 -04:00
|
|
|
|
2009-10-05 10:42:35 -04:00
|
|
|
# Passenger still uses AC::Dispatcher, so we need to
|
|
|
|
# keep it working for now
|
|
|
|
test "deprecated ActionController::Dispatcher still works" do
|
|
|
|
rackup
|
2010-05-20 16:49:06 -04:00
|
|
|
assert_kind_of Rails::Application, ActionController::Dispatcher.new
|
2009-10-05 10:42:35 -04:00
|
|
|
end
|
|
|
|
|
2009-09-28 20:57:36 -04:00
|
|
|
test "the config object is available on the application object" do
|
|
|
|
rackup
|
|
|
|
assert_equal 'UTC', Rails.application.config.time_zone
|
2009-09-25 22:32:28 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|