aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test
diff options
context:
space:
mode:
Diffstat (limited to 'railties/test')
-rw-r--r--railties/test/application/initializers/load_path_test.rb17
-rw-r--r--railties/test/application/metal_test.rb86
-rw-r--r--railties/test/application/middleware_test.rb8
-rw-r--r--railties/test/application/paths_test.rb2
-rw-r--r--railties/test/generators/integration_test_generator_test.rb2
-rw-r--r--railties/test/generators/metal_generator_test.rb17
-rw-r--r--railties/test/generators/performance_test_generator_test.rb2
-rw-r--r--railties/test/railties/shared_tests.rb18
8 files changed, 20 insertions, 132 deletions
diff --git a/railties/test/application/initializers/load_path_test.rb b/railties/test/application/initializers/load_path_test.rb
index b39b9ecaae..d31915e129 100644
--- a/railties/test/application/initializers/load_path_test.rb
+++ b/railties/test/application/initializers/load_path_test.rb
@@ -19,6 +19,23 @@ module ApplicationTests
assert $:.include?("#{app_path}/app/models")
end
+ test "initializing an application adds lib path on inheritance hook" do
+ app_file "lib/foo.rb", <<-RUBY
+ module Foo; end
+ RUBY
+
+ add_to_config <<-RUBY
+ require "foo"
+ raise "Expected Foo to be defined" unless defined?(Foo)
+ RUBY
+
+ assert_nothing_raised do
+ require "#{app_path}/config/environment"
+ end
+
+ assert $:.include?("#{app_path}/lib")
+ end
+
test "initializing an application eager load any path under app" do
app_file "app/anything/foo.rb", <<-RUBY
module Foo; end
diff --git a/railties/test/application/metal_test.rb b/railties/test/application/metal_test.rb
deleted file mode 100644
index 1ec62282c8..0000000000
--- a/railties/test/application/metal_test.rb
+++ /dev/null
@@ -1,86 +0,0 @@
-require 'isolation/abstract_unit'
-
-module ApplicationTests
- class MetalTest < Test::Unit::TestCase
- include ActiveSupport::Testing::Isolation
-
- def setup
- build_app
- boot_rails
-
- require 'rack/test'
- extend Rack::Test::Methods
- end
-
- def app
- @app ||= begin
- require "#{app_path}/config/environment"
- Rails.application
- end
- end
-
- test "single metal endpoint" do
- app_file 'app/metal/foo_metal.rb', <<-RUBY
- class FooMetal
- def self.call(env)
- [200, { "Content-Type" => "text/html"}, ["FooMetal"]]
- end
- end
- RUBY
-
- get "/not/slash"
- assert_equal 200, last_response.status
- assert_equal "FooMetal", last_response.body
- end
-
- test "multiple metal endpoints" do
- app_file 'app/metal/metal_a.rb', <<-RUBY
- class MetalA
- def self.call(env)
- [404, { "Content-Type" => "text/html", "X-Cascade" => "pass" }, ["Metal A"]]
- end
- end
- RUBY
-
- app_file 'app/metal/metal_b.rb', <<-RUBY
- class MetalB
- def self.call(env)
- [200, { "Content-Type" => "text/html"}, ["Metal B"]]
- end
- end
- RUBY
-
- get "/not/slash"
- assert_equal 200, last_response.status
- assert_equal "Metal B", last_response.body
- end
-
- test "pass through to application" do
- app_file 'app/metal/foo_metal.rb', <<-RUBY
- class FooMetal
- def self.call(env)
- [404, { "Content-Type" => "text/html", "X-Cascade" => "pass" }, ["Not Found"]]
- end
- end
- RUBY
-
- controller :foo, <<-RUBY
- class FooController < ActionController::Base
- def index
- render :text => "foo"
- end
- end
- RUBY
-
- app_file 'config/routes.rb', <<-RUBY
- AppTemplate::Application.routes.draw do |map|
- match ':controller(/:action)'
- end
- RUBY
-
- get "/foo"
- assert_equal 200, last_response.status
- assert_equal "foo", last_response.body
- end
- end
-end
diff --git a/railties/test/application/middleware_test.rb b/railties/test/application/middleware_test.rb
index 617525bf78..bab17d8af5 100644
--- a/railties/test/application/middleware_test.rb
+++ b/railties/test/application/middleware_test.rb
@@ -82,12 +82,6 @@ module ApplicationTests
assert_equal "Rack::Config", middleware.first
end
- test "shows cascade if any metal exists" do
- app_file "app/metal/foo.rb", "class Foo; end"
- boot!
- assert middleware.include?("ActionDispatch::Cascade")
- end
-
# x_sendfile_header middleware
test "config.action_dispatch.x_sendfile_header defaults to ''" do
make_basic_app
@@ -170,7 +164,7 @@ module ApplicationTests
end
def middleware
- AppTemplate::Application.middleware.active.map(&:klass).map(&:name)
+ AppTemplate::Application.middleware.map(&:klass).map(&:name)
end
def remote_ip(env = {})
diff --git a/railties/test/application/paths_test.rb b/railties/test/application/paths_test.rb
index 978d677efc..c98b11556b 100644
--- a/railties/test/application/paths_test.rb
+++ b/railties/test/application/paths_test.rb
@@ -38,7 +38,6 @@ module ApplicationTests
test "booting up Rails yields a valid paths object" do
assert_path @paths.app.models, "app", "models"
- assert_path @paths.app.metals, "app", "metal"
assert_path @paths.app.helpers, "app", "helpers"
assert_path @paths.app.views, "app", "views"
assert_path @paths.lib, "lib"
@@ -73,7 +72,6 @@ module ApplicationTests
assert_in_load_path "vendor"
assert_not_in_load_path "app", "views"
- assert_not_in_load_path "app", "metal"
assert_not_in_load_path "config"
assert_not_in_load_path "config", "locales"
assert_not_in_load_path "config", "environments"
diff --git a/railties/test/generators/integration_test_generator_test.rb b/railties/test/generators/integration_test_generator_test.rb
index cf282a0911..d05ed76d24 100644
--- a/railties/test/generators/integration_test_generator_test.rb
+++ b/railties/test/generators/integration_test_generator_test.rb
@@ -7,6 +7,6 @@ class IntegrationTestGeneratorTest < Rails::Generators::TestCase
def test_integration_test_skeleton_is_created
run_generator
- assert_file "test/integration/integration_test.rb", /class IntegrationTest < ActionController::IntegrationTest/
+ assert_file "test/integration/integration_test.rb", /class IntegrationTest < ActionDispatch::IntegrationTest/
end
end
diff --git a/railties/test/generators/metal_generator_test.rb b/railties/test/generators/metal_generator_test.rb
deleted file mode 100644
index 615122c882..0000000000
--- a/railties/test/generators/metal_generator_test.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-require 'generators/generators_test_helper'
-require 'rails/generators/rails/metal/metal_generator'
-
-class MetalGeneratorTest < Rails::Generators::TestCase
- include GeneratorsTestHelper
- arguments %w(foo)
-
- def test_metal_skeleton_is_created
- run_generator
- assert_file "app/metal/foo.rb", /class Foo/
- end
-
- def test_check_class_collision
- content = capture(:stderr){ run_generator ["object"] }
- assert_match /The name 'Object' is either already used in your application or reserved/, content
- end
-end
diff --git a/railties/test/generators/performance_test_generator_test.rb b/railties/test/generators/performance_test_generator_test.rb
index 8fda83b36f..37f9857193 100644
--- a/railties/test/generators/performance_test_generator_test.rb
+++ b/railties/test/generators/performance_test_generator_test.rb
@@ -7,6 +7,6 @@ class PerformanceTestGeneratorTest < Rails::Generators::TestCase
def test_performance_test_skeleton_is_created
run_generator
- assert_file "test/performance/performance_test.rb", /class PerformanceTest < ActionController::PerformanceTest/
+ assert_file "test/performance/performance_test.rb", /class PerformanceTest < ActionDispatch::PerformanceTest/
end
end
diff --git a/railties/test/railties/shared_tests.rb b/railties/test/railties/shared_tests.rb
index 20328d402d..3f78d7d3fe 100644
--- a/railties/test/railties/shared_tests.rb
+++ b/railties/test/railties/shared_tests.rb
@@ -241,24 +241,6 @@ YAML
assert_equal "1", I18n.t(:bar)
end
- def test_plugin_metals_added_to_middleware_stack
- @plugin.write 'app/metal/foo_metal.rb', <<-RUBY
- class FooMetal
- def self.call(env)
- [200, { "Content-Type" => "text/html"}, ["FooMetal"]]
- end
- end
- RUBY
-
- boot_rails
- require 'rack/test'
- extend Rack::Test::Methods
-
- get "/not/slash"
- assert_equal 200, last_response.status
- assert_equal "FooMetal", last_response.body
- end
-
def test_namespaced_controllers_with_namespaced_routes
@plugin.write "config/routes.rb", <<-RUBY
Rails.application.routes.draw do