aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoshua Peek <josh@joshpeek.com>2009-09-19 12:10:41 -0500
committerJoshua Peek <josh@joshpeek.com>2009-09-19 12:10:41 -0500
commitf05b1e5eb1829be47bf9581ca6666229e01d597c (patch)
tree4931a243be128a1f0129e37a9d50f6f0d1ff54f5
parenta6f19a155a0c9accb31ae12a24ff9145cce271b0 (diff)
downloadrails-f05b1e5eb1829be47bf9581ca6666229e01d597c.tar.gz
rails-f05b1e5eb1829be47bf9581ca6666229e01d597c.tar.bz2
rails-f05b1e5eb1829be47bf9581ca6666229e01d597c.zip
All on one abstract_unit
-rw-r--r--actionpack/test/abstract_controller/abstract_controller_test.rb2
-rw-r--r--actionpack/test/abstract_controller/callbacks_test.rb2
-rw-r--r--actionpack/test/abstract_controller/helper_test.rb2
-rw-r--r--actionpack/test/abstract_controller/layouts_test.rb2
-rw-r--r--actionpack/test/abstract_unit.rb76
-rw-r--r--actionpack/test/abstract_unit2.rb119
-rw-r--r--actionpack/test/new_base/base_test.rb2
-rw-r--r--actionpack/test/new_base/content_negotiation_test.rb2
-rw-r--r--actionpack/test/new_base/content_type_test.rb2
-rw-r--r--actionpack/test/new_base/etag_test.rb2
-rw-r--r--actionpack/test/new_base/metal_test.rb2
-rw-r--r--actionpack/test/new_base/middleware_test.rb2
-rw-r--r--actionpack/test/new_base/render_action_test.rb2
-rw-r--r--actionpack/test/new_base/render_file_test.rb2
-rw-r--r--actionpack/test/new_base/render_implicit_action_test.rb2
-rw-r--r--actionpack/test/new_base/render_layout_test.rb2
-rw-r--r--actionpack/test/new_base/render_partial_test.rb2
-rw-r--r--actionpack/test/new_base/render_rjs_test.rb2
-rw-r--r--actionpack/test/new_base/render_template_test.rb2
-rw-r--r--actionpack/test/new_base/render_test.rb2
-rw-r--r--actionpack/test/new_base/render_text_test.rb2
-rw-r--r--actionpack/test/new_base/render_xml_test.rb2
22 files changed, 92 insertions, 143 deletions
diff --git a/actionpack/test/abstract_controller/abstract_controller_test.rb b/actionpack/test/abstract_controller/abstract_controller_test.rb
index 0e6cfba5b5..524381509d 100644
--- a/actionpack/test/abstract_controller/abstract_controller_test.rb
+++ b/actionpack/test/abstract_controller/abstract_controller_test.rb
@@ -1,4 +1,4 @@
-require 'abstract_unit2'
+require 'abstract_unit'
module AbstractController
module Testing
diff --git a/actionpack/test/abstract_controller/callbacks_test.rb b/actionpack/test/abstract_controller/callbacks_test.rb
index 98656c0c70..0ce1dc506b 100644
--- a/actionpack/test/abstract_controller/callbacks_test.rb
+++ b/actionpack/test/abstract_controller/callbacks_test.rb
@@ -1,4 +1,4 @@
-require 'abstract_unit2'
+require 'abstract_unit'
module AbstractController
module Testing
diff --git a/actionpack/test/abstract_controller/helper_test.rb b/actionpack/test/abstract_controller/helper_test.rb
index 4c013137f9..5a363c9aa5 100644
--- a/actionpack/test/abstract_controller/helper_test.rb
+++ b/actionpack/test/abstract_controller/helper_test.rb
@@ -1,4 +1,4 @@
-require 'abstract_unit2'
+require 'abstract_unit'
module AbstractController
module Testing
diff --git a/actionpack/test/abstract_controller/layouts_test.rb b/actionpack/test/abstract_controller/layouts_test.rb
index bee3b5c556..453d31826e 100644
--- a/actionpack/test/abstract_controller/layouts_test.rb
+++ b/actionpack/test/abstract_controller/layouts_test.rb
@@ -1,4 +1,4 @@
-require 'abstract_unit2'
+require 'abstract_unit'
require 'active_support/core_ext/class/removal'
module AbstractControllerTests
diff --git a/actionpack/test/abstract_unit.rb b/actionpack/test/abstract_unit.rb
index 78f326e341..1aa4dcb741 100644
--- a/actionpack/test/abstract_unit.rb
+++ b/actionpack/test/abstract_unit.rb
@@ -16,15 +16,17 @@ ENV['new_base'] = "true"
require 'test/unit'
require 'active_support'
require 'active_support/test_case'
+require 'abstract_controller'
require 'action_controller'
+require 'action_view'
+require 'action_view/base'
+require 'action_dispatch'
+require 'active_model'
require 'fixture_template'
require 'action_controller/testing/process'
-require 'action_view/test_case'
require 'action_controller/testing/integration'
+require 'action_view/test_case'
require 'active_support/dependencies'
-require 'active_model'
-
-$tags[:new_base] = true
begin
require 'ruby-debug'
@@ -34,6 +36,8 @@ rescue LoadError
# Debugging disabled. `gem install ruby-debug` to enable.
end
+require 'pp' # require 'pp' early to prevent hidden_methods from not picking up the pretty-print methods until too late
+
ActiveSupport::Dependencies.hook!
# Show backtraces for deprecated behavior for quicker cleanup.
@@ -56,6 +60,61 @@ module ActionView
end
end
+# Temporary base class
+class Rack::TestCase < ActionController::IntegrationTest
+ setup do
+ ActionController::Base.session_options[:key] = "abc"
+ ActionController::Base.session_options[:secret] = ("*" * 30)
+ end
+
+ def app
+ @app ||= ActionController::Dispatcher.new
+ end
+
+ def self.testing(klass = nil)
+ if klass
+ @testing = "/#{klass.name.underscore}".sub!(/_controller$/, '')
+ else
+ @testing
+ end
+ end
+
+ def get(thing, *args)
+ if thing.is_a?(Symbol)
+ super("#{self.class.testing}/#{thing}", *args)
+ else
+ super
+ end
+ end
+
+ def assert_body(body)
+ assert_equal body, Array.wrap(response.body).join
+ end
+
+ def assert_status(code)
+ assert_equal code, response.status
+ end
+
+ def assert_response(body, status = 200, headers = {})
+ assert_body body
+ assert_status status
+ headers.each do |header, value|
+ assert_header header, value
+ end
+ end
+
+ def assert_content_type(type)
+ assert_equal type, response.headers["Content-Type"]
+ end
+
+ def assert_header(name, value)
+ assert_equal value, response.headers[name]
+ end
+end
+
+class ::ApplicationController < ActionController::Base
+end
+
module ActionController
Base.session = {
:key => '_testing_session',
@@ -132,3 +191,12 @@ module ActionController
end
end
end
+
+
+class SimpleRouteCase < Rack::TestCase
+ setup do
+ ActionController::Routing::Routes.draw do |map|
+ map.connect ':controller/:action/:id'
+ end
+ end
+end
diff --git a/actionpack/test/abstract_unit2.rb b/actionpack/test/abstract_unit2.rb
deleted file mode 100644
index 0a98d8edc2..0000000000
--- a/actionpack/test/abstract_unit2.rb
+++ /dev/null
@@ -1,119 +0,0 @@
-# TODO: Unify with abstract_unit
-
-$:.unshift(File.dirname(__FILE__) + '/../lib')
-$:.unshift(File.dirname(__FILE__) + '/../../activesupport/lib')
-$:.unshift(File.dirname(__FILE__) + '/../lib')
-$:.unshift(File.dirname(__FILE__) + '/lib')
-
-require 'bundler_helper'
-ensure_requirable %w( rack rack/test )
-
-require 'test/unit'
-require 'active_support'
-require 'active_support/test_case'
-require 'abstract_controller'
-require 'action_view'
-require 'action_view/base'
-require 'action_dispatch'
-require 'fixture_template'
-
-begin
- require 'ruby-debug'
- Debugger.settings[:autoeval] = true
- Debugger.start
-rescue LoadError
- # Debugging disabled. `gem install ruby-debug` to enable.
-end
-
-require 'action_controller'
-require 'pp' # require 'pp' early to prevent hidden_methods from not picking up the pretty-print methods until too late
-
-require 'action_controller/testing/process'
-require 'action_controller/testing/integration'
-
-module Rails
- def self.env
- x = Object.new
- def x.test?() true end
- x
- end
-end
-
-# Temporary base class
-class Rack::TestCase < ActionController::IntegrationTest
- setup do
- ActionController::Base.session_options[:key] = "abc"
- ActionController::Base.session_options[:secret] = ("*" * 30)
- end
-
- def app
- @app ||= ActionController::Dispatcher.new
- end
-
- def self.testing(klass = nil)
- if klass
- @testing = "/#{klass.name.underscore}".sub!(/_controller$/, '')
- else
- @testing
- end
- end
-
- def get(thing, *args)
- if thing.is_a?(Symbol)
- super("#{self.class.testing}/#{thing}", *args)
- else
- super
- end
- end
-
- def assert_body(body)
- assert_equal body, Array.wrap(response.body).join
- end
-
- def assert_status(code)
- assert_equal code, response.status
- end
-
- def assert_response(body, status = 200, headers = {})
- assert_body body
- assert_status status
- headers.each do |header, value|
- assert_header header, value
- end
- end
-
- def assert_content_type(type)
- assert_equal type, response.headers["Content-Type"]
- end
-
- def assert_header(name, value)
- assert_equal value, response.headers[name]
- end
-end
-
-class ::ApplicationController < ActionController::Base
-end
-
-module ActionController
- class << Routing
- def possible_controllers
- @@possible_controllers ||= []
- end
- end
-
- class Base
- def self.inherited(klass)
- name = klass.name.underscore.sub(/_controller$/, '')
- ActionController::Routing.possible_controllers << name unless name.blank?
- super
- end
- end
-end
-
-class SimpleRouteCase < Rack::TestCase
- setup do
- ActionController::Routing::Routes.draw do |map|
- map.connect ':controller/:action/:id'
- end
- end
-end
diff --git a/actionpack/test/new_base/base_test.rb b/actionpack/test/new_base/base_test.rb
index 3a559c9cb6..effde324bc 100644
--- a/actionpack/test/new_base/base_test.rb
+++ b/actionpack/test/new_base/base_test.rb
@@ -1,4 +1,4 @@
-require 'abstract_unit2'
+require 'abstract_unit'
# Tests the controller dispatching happy path
module Dispatching
diff --git a/actionpack/test/new_base/content_negotiation_test.rb b/actionpack/test/new_base/content_negotiation_test.rb
index a2f9df597f..c43cb677f8 100644
--- a/actionpack/test/new_base/content_negotiation_test.rb
+++ b/actionpack/test/new_base/content_negotiation_test.rb
@@ -1,4 +1,4 @@
-require 'abstract_unit2'
+require 'abstract_unit'
module ContentNegotiation
diff --git a/actionpack/test/new_base/content_type_test.rb b/actionpack/test/new_base/content_type_test.rb
index 7e95c715a0..898d0bb9f3 100644
--- a/actionpack/test/new_base/content_type_test.rb
+++ b/actionpack/test/new_base/content_type_test.rb
@@ -1,4 +1,4 @@
-require 'abstract_unit2'
+require 'abstract_unit'
module ContentType
class BaseController < ActionController::Base
diff --git a/actionpack/test/new_base/etag_test.rb b/actionpack/test/new_base/etag_test.rb
index 64ae10b7a7..d5b7942ab6 100644
--- a/actionpack/test/new_base/etag_test.rb
+++ b/actionpack/test/new_base/etag_test.rb
@@ -1,4 +1,4 @@
-require 'abstract_unit2'
+require 'abstract_unit'
module Etags
class BasicController < ActionController::Base
diff --git a/actionpack/test/new_base/metal_test.rb b/actionpack/test/new_base/metal_test.rb
index 613d03446c..e1d46b906e 100644
--- a/actionpack/test/new_base/metal_test.rb
+++ b/actionpack/test/new_base/metal_test.rb
@@ -1,4 +1,4 @@
-require 'abstract_unit2'
+require 'abstract_unit'
module MetalTest
class MetalMiddleware < ActionController::Middleware
diff --git a/actionpack/test/new_base/middleware_test.rb b/actionpack/test/new_base/middleware_test.rb
index ecca7e51eb..ada0215b1a 100644
--- a/actionpack/test/new_base/middleware_test.rb
+++ b/actionpack/test/new_base/middleware_test.rb
@@ -1,4 +1,4 @@
-require 'abstract_unit2'
+require 'abstract_unit'
module MiddlewareTest
class MyMiddleware
diff --git a/actionpack/test/new_base/render_action_test.rb b/actionpack/test/new_base/render_action_test.rb
index 72a16e3b67..d5896c1ebd 100644
--- a/actionpack/test/new_base/render_action_test.rb
+++ b/actionpack/test/new_base/render_action_test.rb
@@ -1,4 +1,4 @@
-require 'abstract_unit2'
+require 'abstract_unit'
module RenderAction
# This has no layout and it works
diff --git a/actionpack/test/new_base/render_file_test.rb b/actionpack/test/new_base/render_file_test.rb
index 7067baca18..c4098855e6 100644
--- a/actionpack/test/new_base/render_file_test.rb
+++ b/actionpack/test/new_base/render_file_test.rb
@@ -1,4 +1,4 @@
-require 'abstract_unit2'
+require 'abstract_unit'
module RenderFile
diff --git a/actionpack/test/new_base/render_implicit_action_test.rb b/actionpack/test/new_base/render_implicit_action_test.rb
index 03b9ff6eeb..2b78fa7d4f 100644
--- a/actionpack/test/new_base/render_implicit_action_test.rb
+++ b/actionpack/test/new_base/render_implicit_action_test.rb
@@ -1,4 +1,4 @@
-require 'abstract_unit2'
+require 'abstract_unit'
module RenderImplicitAction
class SimpleController < ::ApplicationController
diff --git a/actionpack/test/new_base/render_layout_test.rb b/actionpack/test/new_base/render_layout_test.rb
index 0dfbae4e9d..f840a47ecf 100644
--- a/actionpack/test/new_base/render_layout_test.rb
+++ b/actionpack/test/new_base/render_layout_test.rb
@@ -1,4 +1,4 @@
-require 'abstract_unit2'
+require 'abstract_unit'
module ControllerLayouts
class ImplicitController < ::ApplicationController
diff --git a/actionpack/test/new_base/render_partial_test.rb b/actionpack/test/new_base/render_partial_test.rb
index ff775dbfd7..7c2c20e1c7 100644
--- a/actionpack/test/new_base/render_partial_test.rb
+++ b/actionpack/test/new_base/render_partial_test.rb
@@ -1,4 +1,4 @@
-require 'abstract_unit2'
+require 'abstract_unit'
module RenderPartial
diff --git a/actionpack/test/new_base/render_rjs_test.rb b/actionpack/test/new_base/render_rjs_test.rb
index eecc275b1e..9c6416bbe0 100644
--- a/actionpack/test/new_base/render_rjs_test.rb
+++ b/actionpack/test/new_base/render_rjs_test.rb
@@ -1,4 +1,4 @@
-require 'abstract_unit2'
+require 'abstract_unit'
module RenderRjs
diff --git a/actionpack/test/new_base/render_template_test.rb b/actionpack/test/new_base/render_template_test.rb
index 5637565dac..3b24c2d75a 100644
--- a/actionpack/test/new_base/render_template_test.rb
+++ b/actionpack/test/new_base/render_template_test.rb
@@ -1,4 +1,4 @@
-require 'abstract_unit2'
+require 'abstract_unit'
module RenderTemplate
class WithoutLayoutController < ActionController::Base
diff --git a/actionpack/test/new_base/render_test.rb b/actionpack/test/new_base/render_test.rb
index 94820f1c9c..804be79d17 100644
--- a/actionpack/test/new_base/render_test.rb
+++ b/actionpack/test/new_base/render_test.rb
@@ -1,4 +1,4 @@
-require 'abstract_unit2'
+require 'abstract_unit'
module Render
class BlankRenderController < ActionController::Base
diff --git a/actionpack/test/new_base/render_text_test.rb b/actionpack/test/new_base/render_text_test.rb
index 23660ed101..f5839ee16f 100644
--- a/actionpack/test/new_base/render_text_test.rb
+++ b/actionpack/test/new_base/render_text_test.rb
@@ -1,4 +1,4 @@
-require 'abstract_unit2'
+require 'abstract_unit'
module RenderText
class SimpleController < ActionController::Base
diff --git a/actionpack/test/new_base/render_xml_test.rb b/actionpack/test/new_base/render_xml_test.rb
index 86a7d9c8a5..d044738a78 100644
--- a/actionpack/test/new_base/render_xml_test.rb
+++ b/actionpack/test/new_base/render_xml_test.rb
@@ -1,4 +1,4 @@
-require 'abstract_unit2'
+require 'abstract_unit'
module RenderXml