2009-09-25 22:32:28 -04:00
|
|
|
require "isolation/abstract_unit"
|
|
|
|
|
|
|
|
module ApplicationTests
|
2012-01-05 20:30:17 -05:00
|
|
|
class RackupTest < ActiveSupport::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"
|
2011-11-11 05:04:47 -05:00
|
|
|
app, _ = Rack::Builder.parse_file("#{app_path}/config.ru")
|
2009-11-25 17:45:12 -05:00
|
|
|
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
|
|
|
|
|
2011-06-04 15:15:52 -04:00
|
|
|
def teardown
|
2011-06-06 08:54:05 -04:00
|
|
|
teardown_app
|
2011-06-04 15:15:52 -04:00
|
|
|
end
|
|
|
|
|
2009-09-25 22:32:28 -04:00
|
|
|
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-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
|