aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/initializer/path_test.rb
diff options
context:
space:
mode:
authorCarl Lerche <carllerche@mac.com>2009-09-29 16:07:29 -0700
committerCarl Lerche <carllerche@mac.com>2009-09-29 16:07:29 -0700
commit6b086449bebc4ecbd11887c74f0c16c0c38089dc (patch)
treea586d299fc4f08ba301da36622272b8a6f13633a /railties/test/initializer/path_test.rb
parent6f6a589d4b564f5db78735ad0c7225c22ced57ac (diff)
downloadrails-6b086449bebc4ecbd11887c74f0c16c0c38089dc.tar.gz
rails-6b086449bebc4ecbd11887c74f0c16c0c38089dc.tar.bz2
rails-6b086449bebc4ecbd11887c74f0c16c0c38089dc.zip
Fix the broken railties isolation tests
Diffstat (limited to 'railties/test/initializer/path_test.rb')
-rw-r--r--railties/test/initializer/path_test.rb32
1 files changed, 15 insertions, 17 deletions
diff --git a/railties/test/initializer/path_test.rb b/railties/test/initializer/path_test.rb
index f3d70ad4ca..a4264bc31c 100644
--- a/railties/test/initializer/path_test.rb
+++ b/railties/test/initializer/path_test.rb
@@ -1,29 +1,36 @@
-require "initializer/test_helper"
+require "isolation/abstract_unit"
class PathsTest < Test::Unit::TestCase
include ActiveSupport::Testing::Isolation
- def self.setup
+ def setup
+ build_app
+ boot_rails
Rails::Initializer.run do |config|
config.frameworks = [:action_controller, :action_view, :action_mailer, :active_record]
config.after_initialize do
ActionController::Base.session_store = nil
end
end
- end
-
- def setup
@paths = Rails::Initializer.default.config.paths
end
def root(*path)
- File.expand_path(File.join(File.dirname(__FILE__), "root", *path))
+ app_path(*path).to_s
end
def assert_path(paths, *dir)
assert_equal [root(*dir)], paths.paths
end
+ def assert_in_load_path(*path)
+ assert $:.any? { |p| File.expand_path(p) == root(*path) }, "Load path does not include '#{root(*path)}'. They are:\n-----\n #{$:.join("\n")}\n-----"
+ end
+
+ def assert_not_in_load_path(*path)
+ assert !$:.any? { |p| File.expand_path(p) == root(*path) }, "Load path includes '#{root(*path)}'. They are:\n-----\n #{$:.join("\n")}\n-----"
+ end
+
test "booting up Rails yields a valid paths object" do
assert_path @paths.app, "app"
assert_path @paths.app.metals, "app", "metal"
@@ -39,8 +46,7 @@ class PathsTest < Test::Unit::TestCase
assert_path @paths.config.locales, "config", "locales"
assert_path @paths.config.environments, "config", "environments"
- assert_equal Pathname.new(File.dirname(__FILE__)).join("root", "app", "controllers").expand_path,
- Pathname.new(@paths.app.controllers.to_a.first).expand_path
+ assert_equal root("app", "controllers"), @paths.app.controllers.to_a.first
assert_equal Pathname.new(File.dirname(__FILE__)).join("..", "..", "builtin", "rails_info").expand_path,
Pathname.new(@paths.app.controllers.to_a[1]).expand_path
end
@@ -56,24 +62,16 @@ class PathsTest < Test::Unit::TestCase
assert_equal "#{RAILS_ENV}.rb", @paths.config.environments.glob
end
- def assert_in_load_path(*path)
- assert $:.any? { |p| File.expand_path(p) == root(*path) }, "Load path does not include '#{root(*path)}'. They are:\n-----\n #{$:.join("\n")}\n-----"
- end
-
- def assert_not_in_load_path(*path)
- assert !$:.any? { |p| File.expand_path(p) == root(*path) }, "Load path includes '#{root(*path)}'. They are:\n-----\n #{$:.join("\n")}\n-----"
- end
-
test "load path includes each of the paths in config.paths as long as the directories exist" do
assert_in_load_path "app"
assert_in_load_path "app", "controllers"
- assert_in_load_path "app", "metal"
assert_in_load_path "app", "models"
assert_in_load_path "app", "helpers"
assert_in_load_path "lib"
assert_in_load_path "vendor"
assert_not_in_load_path "app", "views"
+ assert_not_in_load_path "app", "metal"
assert_not_in_load_path "app", "services"
assert_not_in_load_path "config"
assert_not_in_load_path "config", "locales"