diff options
author | José Valim <jose.valim@gmail.com> | 2010-10-06 17:18:59 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-10-06 17:20:15 +0200 |
commit | d649bf158be130515566aed987f83d36ac9b0ae8 (patch) | |
tree | 4d056bbc2d84903dbf6931e0ee6aa6ded01094cd /railties/test/application | |
parent | d40ca9cce241a8083756c993d6c99a79e62e050e (diff) | |
download | rails-d649bf158be130515566aed987f83d36ac9b0ae8.tar.gz rails-d649bf158be130515566aed987f83d36ac9b0ae8.tar.bz2 rails-d649bf158be130515566aed987f83d36ac9b0ae8.zip |
Provide a cleaner syntax for paths configuration that does not rely on method_missing.
Diffstat (limited to 'railties/test/application')
-rw-r--r-- | railties/test/application/configuration_test.rb | 4 | ||||
-rw-r--r-- | railties/test/application/console_test.rb | 5 | ||||
-rw-r--r-- | railties/test/application/generators_test.rb | 2 | ||||
-rw-r--r-- | railties/test/application/paths_test.rb | 28 |
4 files changed, 19 insertions, 20 deletions
diff --git a/railties/test/application/configuration_test.rb b/railties/test/application/configuration_test.rb index 7403d16cf4..b8d0854286 100644 --- a/railties/test/application/configuration_test.rb +++ b/railties/test/application/configuration_test.rb @@ -42,7 +42,7 @@ module ApplicationTests test "Rails::Application responds to paths" do require "#{app_path}/config/environment" assert_respond_to AppTemplate::Application, :paths - assert_equal AppTemplate::Application.paths.app.views.to_a, ["#{app_path}/app/views"] + assert_equal AppTemplate::Application.paths["app/views"].expanded, ["#{app_path}/app/views"] end test "the application root is set correctly" do @@ -180,7 +180,7 @@ module ApplicationTests test "config.paths.public sets Rails.public_path" do add_to_config <<-RUBY - config.paths.public = "somewhere" + config.paths["public"] = "somewhere" RUBY require "#{app_path}/config/application" diff --git a/railties/test/application/console_test.rb b/railties/test/application/console_test.rb index 25b4a21902..d4159dd0fd 100644 --- a/railties/test/application/console_test.rb +++ b/railties/test/application/console_test.rb @@ -1,7 +1,7 @@ require 'isolation/abstract_unit' class ConsoleTest < Test::Unit::TestCase - include ActiveSupport::Testing::Isolation + include ActiveSupport::Testing::Isolation def setup build_app @@ -14,16 +14,15 @@ class ConsoleTest < Test::Unit::TestCase end def test_app_method_should_return_integration_session + TestHelpers::Rack.send :remove_method, :app load_environment console_session = app - assert_not_nil console_session assert_instance_of ActionDispatch::Integration::Session, console_session end def test_new_session_should_return_integration_session load_environment session = new_session - assert_not_nil session assert_instance_of ActionDispatch::Integration::Session, session end diff --git a/railties/test/application/generators_test.rb b/railties/test/application/generators_test.rb index d258625f42..551e966c85 100644 --- a/railties/test/application/generators_test.rb +++ b/railties/test/application/generators_test.rb @@ -69,7 +69,7 @@ module ApplicationTests assert_equal :rspec, Rails::Generators.options[:rails][:test_framework] assert_equal "-w", Rails::Generators.aliases[:rails][:test_framework] assert_equal Hash[:shoulda => :test_unit], Rails::Generators.fallbacks - assert_equal ["#{app_path}/lib/templates", "some/where"], Rails::Generators.templates_path + assert_equal ["some/where"], Rails::Generators.templates_path end test "generators no color on initialization" do diff --git a/railties/test/application/paths_test.rb b/railties/test/application/paths_test.rb index c98b11556b..b1ff6e9cb1 100644 --- a/railties/test/application/paths_test.rb +++ b/railties/test/application/paths_test.rb @@ -25,7 +25,7 @@ module ApplicationTests end def assert_path(paths, *dir) - assert_equal [root(*dir)], paths.paths + assert_equal [root(*dir)], paths.expanded end def assert_in_load_path(*path) @@ -37,20 +37,20 @@ module ApplicationTests end test "booting up Rails yields a valid paths object" do - assert_path @paths.app.models, "app", "models" - assert_path @paths.app.helpers, "app", "helpers" - assert_path @paths.app.views, "app", "views" - assert_path @paths.lib, "lib" - assert_path @paths.vendor, "vendor" - assert_path @paths.vendor.plugins, "vendor", "plugins" - assert_path @paths.tmp, "tmp" - assert_path @paths.tmp.cache, "tmp", "cache" - assert_path @paths.config, "config" - assert_path @paths.config.locales, "config", "locales", "en.yml" - assert_path @paths.config.environment, "config", "environment.rb" - assert_path @paths.config.environments, "config", "environments", "development.rb" + assert_path @paths["app/models"], "app/models" + assert_path @paths["app/helpers"], "app/helpers" + assert_path @paths["app/views"], "app/views" + assert_path @paths["lib"], "lib" + assert_path @paths["vendor"], "vendor" + assert_path @paths["vendor/plugins"], "vendor/plugins" + assert_path @paths["tmp"], "tmp" + assert_path @paths["tmp/cache"], "tmp/cache" + assert_path @paths["config"], "config" + assert_path @paths["config/locales"], "config/locales/en.yml" + assert_path @paths["config/environment"], "config/environment.rb" + assert_path @paths["config/environments"], "config/environments/development.rb" - assert_equal root("app", "controllers"), @paths.app.controllers.to_a.first + assert_equal root("app", "controllers"), @paths["app/controllers"].expanded.first end test "booting up Rails yields a list of paths that are eager" do |