From a6f19a155a0c9accb31ae12a24ff9145cce271b0 Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Sat, 19 Sep 2009 11:57:56 -0500 Subject: There is only one base now --- actionpack/test/abstract_unit.rb | 1 - 1 file changed, 1 deletion(-) (limited to 'actionpack/test/abstract_unit.rb') diff --git a/actionpack/test/abstract_unit.rb b/actionpack/test/abstract_unit.rb index 7776bd0704..78f326e341 100644 --- a/actionpack/test/abstract_unit.rb +++ b/actionpack/test/abstract_unit.rb @@ -12,7 +12,6 @@ ensure_requirable %w( rack rack/test sqlite3 ) ENV['TMPDIR'] = File.join(File.dirname(__FILE__), 'tmp') ENV['new_base'] = "true" -$stderr.puts "Running old tests on new_base" require 'test/unit' require 'active_support' -- cgit v1.2.3 From f05b1e5eb1829be47bf9581ca6666229e01d597c Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Sat, 19 Sep 2009 12:10:41 -0500 Subject: All on one abstract_unit --- actionpack/test/abstract_unit.rb | 76 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 72 insertions(+), 4 deletions(-) (limited to 'actionpack/test/abstract_unit.rb') 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 -- cgit v1.2.3 From 355e2350ca5ce203acfb7f71914339e289b37570 Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Sat, 19 Sep 2009 12:51:28 -0500 Subject: All on one base, don't need this --- actionpack/test/abstract_unit.rb | 3 --- 1 file changed, 3 deletions(-) (limited to 'actionpack/test/abstract_unit.rb') diff --git a/actionpack/test/abstract_unit.rb b/actionpack/test/abstract_unit.rb index 1aa4dcb741..3bd08e04f7 100644 --- a/actionpack/test/abstract_unit.rb +++ b/actionpack/test/abstract_unit.rb @@ -11,8 +11,6 @@ ensure_requirable %w( rack rack/test sqlite3 ) ENV['TMPDIR'] = File.join(File.dirname(__FILE__), 'tmp') -ENV['new_base'] = "true" - require 'test/unit' require 'active_support' require 'active_support/test_case' @@ -192,7 +190,6 @@ module ActionController end end - class SimpleRouteCase < Rack::TestCase setup do ActionController::Routing::Routes.draw do |map| -- cgit v1.2.3 From 69192bee2da198de1bf59fbc0646e59f68e10751 Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Sat, 19 Sep 2009 13:12:54 -0500 Subject: Merge bundler helper into abstract_unit --- actionpack/test/abstract_unit.rb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'actionpack/test/abstract_unit.rb') diff --git a/actionpack/test/abstract_unit.rb b/actionpack/test/abstract_unit.rb index 3bd08e04f7..b9293ffb9f 100644 --- a/actionpack/test/abstract_unit.rb +++ b/actionpack/test/abstract_unit.rb @@ -6,8 +6,14 @@ $:.unshift(File.dirname(__FILE__) + '/lib') $:.unshift(File.dirname(__FILE__) + '/fixtures/helpers') $:.unshift(File.dirname(__FILE__) + '/fixtures/alternate_helpers') -require 'bundler_helper' -ensure_requirable %w( rack rack/test sqlite3 ) +bundler = File.join(File.dirname(__FILE__), '..', 'vendor', 'gems', 'environment') +require bundler if File.exist?("#{bundler}.rb") + +begin + %w( rack rack/test sqlite3 ).each { |lib| require lib } +rescue LoadError => e + abort e.message +end ENV['TMPDIR'] = File.join(File.dirname(__FILE__), 'tmp') -- cgit v1.2.3