diff options
author | Emilio Tagua <miloops@gmail.com> | 2010-12-20 11:23:07 -0300 |
---|---|---|
committer | Emilio Tagua <miloops@gmail.com> | 2010-12-20 11:23:07 -0300 |
commit | 02fc6fbccdd3345e95592cc14e7855e2f1ea14b3 (patch) | |
tree | b26b91e2b2fad62ec382c9cee4ca2ac318f09257 /railties/test | |
parent | 2ba06b48defaca940e7c878724e2fb1c090eaa92 (diff) | |
parent | 0cbfd6c28d327304432f7d0c067662b5c1e41a78 (diff) | |
download | rails-02fc6fbccdd3345e95592cc14e7855e2f1ea14b3.tar.gz rails-02fc6fbccdd3345e95592cc14e7855e2f1ea14b3.tar.bz2 rails-02fc6fbccdd3345e95592cc14e7855e2f1ea14b3.zip |
Merge remote branch 'rails/master' into identity_map
Conflicts:
activerecord/lib/active_record/associations/association_proxy.rb
activerecord/lib/active_record/autosave_association.rb
activerecord/lib/active_record/base.rb
activerecord/lib/active_record/persistence.rb
Diffstat (limited to 'railties/test')
-rw-r--r-- | railties/test/application/configuration_test.rb | 43 | ||||
-rw-r--r-- | railties/test/application/console_test.rb | 8 | ||||
-rw-r--r-- | railties/test/application/middleware_test.rb | 7 | ||||
-rw-r--r-- | railties/test/generators/app_generator_test.rb | 6 | ||||
-rw-r--r-- | railties/test/generators/generator_generator_test.rb | 39 | ||||
-rw-r--r-- | railties/test/generators/model_generator_test.rb | 18 | ||||
-rw-r--r-- | railties/test/generators/plugin_new_generator_test.rb | 32 | ||||
-rw-r--r-- | railties/test/generators/scaffold_generator_test.rb | 7 | ||||
-rw-r--r-- | railties/test/generators/shared_generator_tests.rb | 9 | ||||
-rw-r--r-- | railties/test/railties/engine_test.rb | 228 | ||||
-rw-r--r-- | railties/test/railties/railtie_test.rb | 6 |
11 files changed, 321 insertions, 82 deletions
diff --git a/railties/test/application/configuration_test.rb b/railties/test/application/configuration_test.rb index b8d0854286..4f4b7beec4 100644 --- a/railties/test/application/configuration_test.rb +++ b/railties/test/application/configuration_test.rb @@ -95,6 +95,11 @@ module ApplicationTests assert AppTemplate::Application.config.allow_concurrency end + test "asset_path defaults to nil for application" do + require "#{app_path}/config/environment" + assert_equal nil, AppTemplate::Application.config.asset_path + end + test "the application can be marked as threadsafe when there are no frameworks" do FileUtils.rm_rf("#{app_path}/config/environments") add_to_config <<-RUBY @@ -275,5 +280,43 @@ module ApplicationTests get "/" assert_equal "/omg/images/foo.jpg", last_response.body end + + test "config.action_view.cache_template_loading with cache_classes default" do + add_to_config "config.cache_classes = true" + require "#{app_path}/config/environment" + require 'action_view/base' + + assert ActionView::Resolver.caching? + end + + test "config.action_view.cache_template_loading without cache_classes default" do + add_to_config "config.cache_classes = false" + require "#{app_path}/config/environment" + require 'action_view/base' + + assert !ActionView::Resolver.caching? + end + + test "config.action_view.cache_template_loading = false" do + add_to_config <<-RUBY + config.cache_classes = true + config.action_view.cache_template_loading = false + RUBY + require "#{app_path}/config/environment" + require 'action_view/base' + + assert !ActionView::Resolver.caching? + end + + test "config.action_view.cache_template_loading = true" do + add_to_config <<-RUBY + config.cache_classes = false + config.action_view.cache_template_loading = true + RUBY + require "#{app_path}/config/environment" + require 'action_view/base' + + assert ActionView::Resolver.caching? + end end end diff --git a/railties/test/application/console_test.rb b/railties/test/application/console_test.rb index d4159dd0fd..793e73556c 100644 --- a/railties/test/application/console_test.rb +++ b/railties/test/application/console_test.rb @@ -26,14 +26,14 @@ class ConsoleTest < Test::Unit::TestCase assert_instance_of ActionDispatch::Integration::Session, session end - def test_reload_should_fire_preparation_callbacks + def test_reload_should_fire_preparation_and_cleanup_callbacks load_environment a = b = c = nil # TODO: These should be defined on the initializer - ActionDispatch::Callbacks.to_prepare { a = b = c = 1 } - ActionDispatch::Callbacks.to_prepare { b = c = 2 } - ActionDispatch::Callbacks.to_prepare { c = 3 } + ActionDispatch::Reloader.to_cleanup { a = b = c = 1 } + ActionDispatch::Reloader.to_cleanup { b = c = 2 } + ActionDispatch::Reloader.to_prepare { c = 3 } # Hide Reloading... output silence_stream(STDOUT) { reload! } diff --git a/railties/test/application/middleware_test.rb b/railties/test/application/middleware_test.rb index f74fa594d9..d88bd05a74 100644 --- a/railties/test/application/middleware_test.rb +++ b/railties/test/application/middleware_test.rb @@ -27,6 +27,7 @@ module ApplicationTests "ActionDispatch::ShowExceptions", "ActionDispatch::RemoteIp", "Rack::Sendfile", + "ActionDispatch::Reloader", "ActionDispatch::Callbacks", "ActiveRecord::IdentityMap::Middleware", "ActiveRecord::ConnectionAdapters::ConnectionManagement", @@ -83,6 +84,12 @@ module ApplicationTests assert !middleware.include?("ActionDispatch::ShowExceptions") end + test "removes ActionDispatch::Reloader if cache_classes is true" do + add_to_config "config.cache_classes = true" + boot! + assert !middleware.include?("ActionDispatch::Reloader") + end + test "use middleware" do use_frameworks [] add_to_config "config.middleware.use Rack::Config" diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb index 7faa674a81..0fe5cdc4a8 100644 --- a/railties/test/generators/app_generator_test.rb +++ b/railties/test/generators/app_generator_test.rb @@ -135,6 +135,9 @@ class AppGeneratorTest < Rails::Generators::TestCase assert_file "public/javascripts/application.js" assert_file "public/javascripts/prototype.js" assert_file "public/javascripts/rails.js" + assert_file "public/javascripts/controls.js" + assert_file "public/javascripts/dragdrop.js" + assert_file "public/javascripts/effects.js" assert_file "test" end @@ -151,6 +154,9 @@ class AppGeneratorTest < Rails::Generators::TestCase assert_file "config/application.rb", /#\s+config\.action_view\.javascript_expansions\[:defaults\]\s+=\s+%w\(jquery rails\)/ assert_file "public/javascripts/application.js" assert_file "public/javascripts/prototype.js" + assert_file "public/javascripts/controls.js" + assert_file "public/javascripts/dragdrop.js" + assert_file "public/javascripts/effects.js" assert_file "public/javascripts/rails.js", /prototype/ end diff --git a/railties/test/generators/generator_generator_test.rb b/railties/test/generators/generator_generator_test.rb index 26f975a191..f4c975fc18 100644 --- a/railties/test/generators/generator_generator_test.rb +++ b/railties/test/generators/generator_generator_test.rb @@ -17,4 +17,43 @@ class GeneratorGeneratorTest < Rails::Generators::TestCase assert_file "lib/generators/awesome/awesome_generator.rb", /class AwesomeGenerator < Rails::Generators::NamedBase/ end + + def test_namespaced_generator_skeleton + run_generator ["rails/awesome"] + + %w( + lib/generators/rails/awesome + lib/generators/rails/awesome/USAGE + lib/generators/rails/awesome/templates + ).each{ |path| assert_file path } + + assert_file "lib/generators/rails/awesome/awesome_generator.rb", + /class Rails::AwesomeGenerator < Rails::Generators::NamedBase/ + end + + def test_generator_skeleton_is_created_without_file_name_namespace + run_generator ["awesome", "--namespace", "false"] + + %w( + lib/generators/ + lib/generators/USAGE + lib/generators/templates + ).each{ |path| assert_file path } + + assert_file "lib/generators/awesome_generator.rb", + /class AwesomeGenerator < Rails::Generators::NamedBase/ + end + + def test_namespaced_generator_skeleton_without_file_name_namespace + run_generator ["rails/awesome", "--namespace", "false"] + + %w( + lib/generators/rails + lib/generators/rails/USAGE + lib/generators/rails/templates + ).each{ |path| assert_file path } + + assert_file "lib/generators/rails/awesome_generator.rb", + /class Rails::AwesomeGenerator < Rails::Generators::NamedBase/ + end end diff --git a/railties/test/generators/model_generator_test.rb b/railties/test/generators/model_generator_test.rb index 8a0f560bc8..552b7eb30a 100644 --- a/railties/test/generators/model_generator_test.rb +++ b/railties/test/generators/model_generator_test.rb @@ -147,10 +147,22 @@ class ModelGeneratorTest < Rails::Generators::TestCase end end - def test_migration_already_exists_error_message + def test_migration_is_skipped_with_skip_option run_generator - error = capture(:stderr){ run_generator ["Account"], :behavior => :skip } - assert_match /Another migration is already named create_accounts/, error + output = run_generator ["Account", "--skip"] + assert_match %r{skip\s+db/migrate/\d+_create_accounts.rb}, output + end + + def test_migration_is_ignored_as_identical_with_skip_option + run_generator ["Account"] + output = run_generator ["Account", "--skip"] + assert_match %r{identical\s+db/migrate/\d+_create_accounts.rb}, output + end + + def test_migration_is_skipped_on_skip_behavior + run_generator + output = run_generator ["Account"], :behavior => :skip + assert_match %r{skip\s+db/migrate/\d+_create_accounts.rb}, output end def test_migration_error_is_not_shown_on_revoke diff --git a/railties/test/generators/plugin_new_generator_test.rb b/railties/test/generators/plugin_new_generator_test.rb index 2105585272..2a9e8046b8 100644 --- a/railties/test/generators/plugin_new_generator_test.rb +++ b/railties/test/generators/plugin_new_generator_test.rb @@ -91,6 +91,35 @@ class PluginNewGeneratorTest < Rails::Generators::TestCase assert_file "test/dummy/config/database.yml", /postgres/ end + def test_skipping_javascripts_without_mountable_option + run_generator + assert_no_file "public/javascripts/prototype.js" + assert_no_file "public/javascripts/rails.js" + assert_no_file "public/javascripts/controls.js" + assert_no_file "public/javascripts/dragdrop.js" + assert_no_file "public/javascripts/dragdrop.js" + assert_no_file "public/javascripts/application.js" + end + + def test_javascripts_generation + run_generator [destination_root, "--mountable"] + assert_file "public/javascripts/rails.js" + assert_file "public/javascripts/prototype.js" + assert_file "public/javascripts/controls.js" + assert_file "public/javascripts/dragdrop.js" + assert_file "public/javascripts/dragdrop.js" + assert_file "public/javascripts/application.js" + end + + def test_skip_javascripts + run_generator [destination_root, "--skip-javascript", "--mountable"] + assert_no_file "public/javascripts/prototype.js" + assert_no_file "public/javascripts/rails.js" + assert_no_file "public/javascripts/controls.js" + assert_no_file "public/javascripts/dragdrop.js" + assert_no_file "public/javascripts/dragdrop.js" + end + def test_ensure_that_javascript_option_is_passed_to_app_generator run_generator [destination_root, "--javascript", "jquery"] assert_file "test/dummy/public/javascripts/jquery.js" @@ -114,7 +143,7 @@ class PluginNewGeneratorTest < Rails::Generators::TestCase end def test_ensure_that_tests_works_in_full_mode - run_generator [destination_root, "--full"] + run_generator [destination_root, "--full", "--skip_active_record"] FileUtils.cd destination_root `bundle install` assert_match /2 tests, 2 assertions, 0 failures, 0 errors/, `bundle exec rake test` @@ -137,6 +166,7 @@ class PluginNewGeneratorTest < Rails::Generators::TestCase assert_file "test/dummy/config/routes.rb", /mount Bukkits::Engine => "\/bukkits"/ assert_file "app/controllers/bukkits/application_controller.rb", /module Bukkits\n class ApplicationController < ActionController::Base/ assert_file "app/helpers/bukkits/application_helper.rb", /module Bukkits\n module ApplicationHelper/ + assert_file "app/views/layouts/bukkits/application.html.erb", /<title>Bukkits<\/title>/ end def test_passing_dummy_path_as_a_parameter diff --git a/railties/test/generators/scaffold_generator_test.rb b/railties/test/generators/scaffold_generator_test.rb index f366600b16..df787f61ba 100644 --- a/railties/test/generators/scaffold_generator_test.rb +++ b/railties/test/generators/scaffold_generator_test.rb @@ -3,7 +3,7 @@ require 'rails/generators/rails/scaffold/scaffold_generator' class ScaffoldGeneratorTest < Rails::Generators::TestCase include GeneratorsTestHelper - arguments %w(product_line title:string price:integer) + arguments %w(product_line title:string product:belongs_to user:references) setup :copy_routes @@ -14,7 +14,10 @@ class ScaffoldGeneratorTest < Rails::Generators::TestCase assert_file "app/models/product_line.rb", /class ProductLine < ActiveRecord::Base/ assert_file "test/unit/product_line_test.rb", /class ProductLineTest < ActiveSupport::TestCase/ assert_file "test/fixtures/product_lines.yml" - assert_migration "db/migrate/create_product_lines.rb" + assert_migration "db/migrate/create_product_lines.rb", /belongs_to :product/ + assert_migration "db/migrate/create_product_lines.rb", /add_index :product_lines, :product_id/ + assert_migration "db/migrate/create_product_lines.rb", /references :user/ + assert_migration "db/migrate/create_product_lines.rb", /add_index :product_lines, :user_id/ # Route assert_file "config/routes.rb" do |route| diff --git a/railties/test/generators/shared_generator_tests.rb b/railties/test/generators/shared_generator_tests.rb index d117656fbd..9e6169721b 100644 --- a/railties/test/generators/shared_generator_tests.rb +++ b/railties/test/generators/shared_generator_tests.rb @@ -113,6 +113,15 @@ module SharedGeneratorTests assert_match /It works!/, silence(:stdout){ generator.invoke_all } end + def test_template_is_executed_when_supplied_an_https_path + path = "https://gist.github.com/103208.txt" + template = %{ say "It works!" } + template.instance_eval "def read; self; end" # Make the string respond to read + + generator([destination_root], :template => path).expects(:open).with(path, 'Accept' => 'application/x-thor-template').returns(template) + assert_match /It works!/, silence(:stdout){ generator.invoke_all } + end + def test_dev_option generator([destination_root], :dev => true).expects(:run).with("#{@bundle_command} install") silence(:stdout){ generator.invoke_all } diff --git a/railties/test/railties/engine_test.rb b/railties/test/railties/engine_test.rb index 701b6816c8..92aa025238 100644 --- a/railties/test/railties/engine_test.rb +++ b/railties/test/railties/engine_test.rb @@ -1,12 +1,15 @@ require "isolation/abstract_unit" require "railties/shared_tests" require 'stringio' +require 'rack/test' +require 'rack/file' module RailtiesTest class EngineTest < Test::Unit::TestCase include ActiveSupport::Testing::Isolation include SharedTests + include Rack::Test::Methods def setup build_app @@ -87,10 +90,8 @@ module RailtiesTest boot_rails - env = Rack::MockRequest.env_for("/bukkits") - response = Rails.application.call(env) - - assert_equal ["HELLO WORLD"], response[2] + get("/bukkits") + assert_equal "HELLO WORLD", last_response.body end test "it provides routes as default endpoint" do @@ -115,9 +116,8 @@ module RailtiesTest boot_rails - env = Rack::MockRequest.env_for("/bukkits/foo") - response = Rails.application.call(env) - assert_equal ["foo"], response[2] + get("/bukkits/foo") + assert_equal "foo", last_response.body end test "engine can load its own plugins" do @@ -191,13 +191,11 @@ module RailtiesTest boot_rails env = Rack::MockRequest.env_for("/") - response = Bukkits::Engine.call(env) - + Bukkits::Engine.call(env) assert_equal Bukkits::Engine.routes, env['action_dispatch.routes'] env = Rack::MockRequest.env_for("/") - response = Rails.application.call(env) - + Rails.application.call(env) assert_equal Rails.application.routes, env['action_dispatch.routes'] end @@ -230,6 +228,12 @@ module RailtiesTest <%= stylesheet_link_tag("foo") %> ERB + app_file "config/routes.rb", <<-RUBY + Rails.application.routes.draw do + mount Bukkits::Engine => "/bukkits" + end + RUBY + add_to_config 'config.asset_path = "/omg%s"' boot_rails @@ -239,9 +243,8 @@ module RailtiesTest ::Bukkits::Engine.config.asset_path = "/bukkits%s" - env = Rack::MockRequest.env_for("/foo") - response = Bukkits::Engine.call(env) - stripped_body = response[2].body.split("\n").map(&:strip).join + get("/bukkits/foo") + stripped_body = last_response.body.split("\n").map(&:strip).join expected = "/omg/bukkits/images/foo.png" + "<script src=\"/omg/bukkits/javascripts/foo.js\" type=\"text/javascript\"></script>" + @@ -264,14 +267,16 @@ module RailtiesTest end RUBY - boot_rails + app_file "config/routes.rb", <<-RUBY + AppTemplate::Application.routes.draw do + mount Bukkits::Engine => "/bukkits" + end + RUBY - env = Rack::MockRequest.env_for("/foo") - response = Bukkits::Engine.call(env) - stripped_body = response[2].body.strip + boot_rails - expected = "/bukkits/images/foo.png" - assert_equal expected, stripped_body + get("/bukkits/foo") + assert_equal "/bukkits/images/foo.png", last_response.body.strip end test "engine's files are served via ActionDispatch::Static" do @@ -291,25 +296,14 @@ module RailtiesTest boot_rails - env = Rack::MockRequest.env_for("/app.html") - response = Rails.application.call(env) - assert_equal rack_body(response[2]), rack_body(File.open(File.join(app_path, "public/app.html"))) - - env = Rack::MockRequest.env_for("/bukkits/bukkits.html") - response = Rails.application.call(env) - assert_equal rack_body(response[2]), rack_body(File.open(File.join(@plugin.path, "public/bukkits.html"))) + get("/app.html") + assert_equal File.read(File.join(app_path, "public/app.html")), last_response.body - env = Rack::MockRequest.env_for("/bukkits/file_from_app.html") - response = Rails.application.call(env) - assert_equal rack_body(response[2]), rack_body(File.open(File.join(app_path, "public/bukkits/file_from_app.html"))) - end + get("/bukkits/bukkits.html") + assert_equal File.read(File.join(@plugin.path, "public/bukkits.html")), last_response.body - def rack_body(obj) - buffer = "" - obj.each do |part| - buffer << part - end - buffer + get("/bukkits/file_from_app.html") + assert_equal File.read(File.join(app_path, "public/bukkits/file_from_app.html")), last_response.body end test "shared engine should include application's helpers and own helpers" do @@ -355,17 +349,14 @@ module RailtiesTest boot_rails - env = Rack::MockRequest.env_for("/foo") - response = Rails.application.call(env) - assert_equal ["Something... Something... Something..."], response[2] + get("/foo") + assert_equal "Something... Something... Something...", last_response.body - env = Rack::MockRequest.env_for("/foo/show") - response = Rails.application.call(env) - assert_equal ["/foo"], response[2] + get("/foo/show") + assert_equal "/foo", last_response.body - env = Rack::MockRequest.env_for("/foo/bar") - response = Rails.application.call(env) - assert_equal ["It's a bar."], response[2] + get("/foo/bar") + assert_equal "It's a bar.", last_response.body end test "isolated engine should include only its own routes and helpers" do @@ -464,25 +455,20 @@ module RailtiesTest assert ::Bukkits::MyMailer.method_defined?(:foo_path) assert !::Bukkits::MyMailer.method_defined?(:bar_path) - env = Rack::MockRequest.env_for("/bukkits/from_app") - response = AppTemplate::Application.call(env) - assert_equal ["false"], response[2] + get("/bukkits/from_app") + assert_equal "false", last_response.body - env = Rack::MockRequest.env_for("/bukkits/foo/show") - response = AppTemplate::Application.call(env) - assert_equal ["/bukkits/foo"], response[2] + get("/bukkits/foo/show") + assert_equal "/bukkits/foo", last_response.body - env = Rack::MockRequest.env_for("/bukkits/foo") - response = AppTemplate::Application.call(env) - assert_equal ["Helped."], response[2] + get("/bukkits/foo") + assert_equal "Helped.", last_response.body - env = Rack::MockRequest.env_for("/bukkits/routes_helpers_in_view") - response = AppTemplate::Application.call(env) - assert_equal ["/bukkits/foo, /bar"], response[2] + get("/bukkits/routes_helpers_in_view") + assert_equal "/bukkits/foo, /bar", last_response.body - env = Rack::MockRequest.env_for("/bukkits/polymorphic_path_without_namespace") - response = AppTemplate::Application.call(env) - assert_equal ["/bukkits/posts/1"], response[2] + get("/bukkits/polymorphic_path_without_namespace") + assert_equal "/bukkits/posts/1", last_response.body end test "isolated engine should avoid namespace in names if that's possible" do @@ -541,9 +527,8 @@ module RailtiesTest boot_rails - env = Rack::MockRequest.env_for("/bukkits/posts/new") - response = AppTemplate::Application.call(env) - assert rack_body(response[2]) =~ /name="post\[title\]"/ + get("/bukkits/posts/new") + assert_match /name="post\[title\]"/, last_response.body end test "loading seed data" do @@ -612,16 +597,14 @@ module RailtiesTest end RUBY - require 'rack/test' - extend Rack::Test::Methods - boot_rails require "#{rails_root}/config/environment" - get "/foo" + + get("/foo") assert_equal "foo", last_response.body - get "/bukkits/bar" + get("/bukkits/bar") assert_equal "bar", last_response.body end @@ -683,5 +666,112 @@ module RailtiesTest app_generators = Rails.application.config.generators.options[:rails] assert_equal :test_unit , app_generators[:test_framework] end + + test "do not create table_name_prefix method if it already exists" do + @plugin.write "lib/bukkits.rb", <<-RUBY + module Bukkits + def self.table_name_prefix + "foo" + end + + class Engine < ::Rails::Engine + isolate_namespace(Bukkits) + end + end + RUBY + + boot_rails + require "#{rails_root}/config/environment" + + assert_equal "foo", Bukkits.table_name_prefix + end + + test "fetching engine by path" do + @plugin.write "lib/bukkits.rb", <<-RUBY + module Bukkits + class Engine < ::Rails::Engine + end + end + RUBY + + boot_rails + require "#{rails_root}/config/environment" + + assert_equal Bukkits::Engine.instance, Rails::Engine.find(@plugin.path) + + # check expanding paths + engine_dir = @plugin.path.chomp("/").split("/").last + engine_path = File.join(@plugin.path, '..', engine_dir) + assert_equal Bukkits::Engine.instance, Rails::Engine.find(engine_path) + end + + test "ensure that engine properly sets assets directories" do + add_to_config("config.action_dispatch.show_exceptions = false") + add_to_config("config.serve_static_assets = true") + + @plugin.write "lib/bukkits.rb", <<-RUBY + module Bukkits + class Engine < ::Rails::Engine + isolate_namespace Bukkits + end + end + RUBY + + @plugin.write "public/stylesheets/foo.css", "" + @plugin.write "public/javascripts/foo.js", "" + + @plugin.write "app/views/layouts/bukkits/application.html.erb", <<-RUBY + <%= stylesheet_link_tag :all %> + <%= javascript_include_tag :all %> + <%= yield %> + RUBY + + @plugin.write "app/controllers/bukkits/home_controller.rb", <<-RUBY + module Bukkits + class HomeController < ActionController::Base + def index + render :text => "Good morning!", :layout => "bukkits/application" + end + end + end + RUBY + + @plugin.write "config/routes.rb", <<-RUBY + Bukkits::Engine.routes.draw do + match "/home" => "home#index" + end + RUBY + + app_file "config/routes.rb", <<-RUBY + Rails.application.routes.draw do + mount Bukkits::Engine => "/bukkits" + end + RUBY + + require 'rack/test' + extend Rack::Test::Methods + + boot_rails + + require "#{rails_root}/config/environment" + + assert_equal File.join(@plugin.path, "public"), Bukkits::HomeController.assets_dir + assert_equal File.join(@plugin.path, "public/stylesheets"), Bukkits::HomeController.stylesheets_dir + assert_equal File.join(@plugin.path, "public/javascripts"), Bukkits::HomeController.javascripts_dir + + assert_equal File.join(app_path, "public"), ActionController::Base.assets_dir + assert_equal File.join(app_path, "public/stylesheets"), ActionController::Base.stylesheets_dir + assert_equal File.join(app_path, "public/javascripts"), ActionController::Base.javascripts_dir + + get "/bukkits/home" + + assert_match %r{bukkits/stylesheets/foo.css}, last_response.body + assert_match %r{bukkits/javascripts/foo.js}, last_response.body + end + + private + def app + Rails.application + end end end diff --git a/railties/test/railties/railtie_test.rb b/railties/test/railties/railtie_test.rb index 6d194eecba..7ea8364ae9 100644 --- a/railties/test/railties/railtie_test.rb +++ b/railties/test/railties/railtie_test.rb @@ -21,10 +21,10 @@ module RailtiesTest test "Railtie provides railtie_name" do begin - class ::Foo < Rails::Railtie ; end - assert_equal "foo", ::Foo.railtie_name + class ::FooBarBaz < Rails::Railtie ; end + assert_equal "foo_bar_baz", ::FooBarBaz.railtie_name ensure - Object.send(:remove_const, :"Foo") + Object.send(:remove_const, :"FooBarBaz") end end |