aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com>2009-05-20 16:52:56 -0700
committerYehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com>2009-05-20 16:54:21 -0700
commitc4a6109286909c394e8c5bfc471a1eb9de245d2b (patch)
treec6801a160133bdee57c19b64625964dba266c943
parent8e7a87d299483fce6af3be89e50deae43055a96f (diff)
downloadrails-c4a6109286909c394e8c5bfc471a1eb9de245d2b.tar.gz
rails-c4a6109286909c394e8c5bfc471a1eb9de245d2b.tar.bz2
rails-c4a6109286909c394e8c5bfc471a1eb9de245d2b.zip
Got controller/mime_responds_test.rb running on the new base
-rw-r--r--actionpack/Rakefile7
-rw-r--r--actionpack/test/abstract_unit.rb2
-rw-r--r--actionpack/test/controller/mime_responds_test.rb26
-rw-r--r--actionpack/test/new_base/abstract_unit.rb3
-rw-r--r--activesupport/lib/active_support/test_case.rb5
-rw-r--r--activesupport/lib/active_support/testing/pending.rb5
6 files changed, 34 insertions, 14 deletions
diff --git a/actionpack/Rakefile b/actionpack/Rakefile
index 2a456ebb05..86f7adaee3 100644
--- a/actionpack/Rakefile
+++ b/actionpack/Rakefile
@@ -58,10 +58,11 @@ end
desc 'Old Controller Tests on New Base'
Rake::TestTask.new(:test_new_base_on_old_tests) do |t|
t.libs << "test/new_base" << "test"
- # content_type mime_responds layout
+ # content_type layout
+ # Dir.glob( "test/{dispatch,template}/**/*_test.rb" ).sort +
t.test_files = %w(
- addresses_render base benchmark caching capture dispatcher record_identifier
- redirect render rescue url_rewriter webservice flash
+ addresses_render base benchmark caching capture dispatcher flash mime_responds
+ record_identifier redirect render rescue url_rewriter webservice
).map { |name| "test/controller/#{name}_test.rb" }
end
diff --git a/actionpack/test/abstract_unit.rb b/actionpack/test/abstract_unit.rb
index f6f62bcf83..5ae54d097a 100644
--- a/actionpack/test/abstract_unit.rb
+++ b/actionpack/test/abstract_unit.rb
@@ -23,6 +23,8 @@ require 'action_controller'
require 'action_controller/testing/process'
require 'action_view/test_case'
+$tags[:old_base] = true
+
# Show backtraces for deprecated behavior for quicker cleanup.
ActiveSupport::Deprecation.debug = true
diff --git a/actionpack/test/controller/mime_responds_test.rb b/actionpack/test/controller/mime_responds_test.rb
index 3b8babb84c..56b49251c6 100644
--- a/actionpack/test/controller/mime_responds_test.rb
+++ b/actionpack/test/controller/mime_responds_test.rb
@@ -375,9 +375,11 @@ class MimeControllerTest < ActionController::TestCase
end
def test_rjs_type_skips_layout
- @request.accept = "text/javascript"
- get :all_types_with_layout
- assert_equal 'RJS for all_types_with_layout', @response.body
+ pending(:new_base) do
+ @request.accept = "text/javascript"
+ get :all_types_with_layout
+ assert_equal 'RJS for all_types_with_layout', @response.body
+ end
end
def test_html_type_with_layout
@@ -510,7 +512,7 @@ class SuperPostController < PostController
end
end
-if ENV["new_base"]
+if defined?(ActionController::Http)
PostController._write_layout_method
SuperPostController._write_layout_method
end
@@ -532,14 +534,16 @@ class MimeControllerLayoutsTest < ActionController::TestCase
assert_equal 'Hello iPhone', @response.body
end
- def test_format_with_inherited_layouts
- @controller = SuperPostController.new
+ for_tag(:old_base) do
+ def test_format_with_inherited_layouts
+ @controller = SuperPostController.new
- get :index
- assert_equal 'Super Firefox', @response.body
+ get :index
+ assert_equal 'Super Firefox', @response.body
- @request.accept = "text/iphone"
- get :index
- assert_equal '<html><div id="super_iphone">Super iPhone</div></html>', @response.body
+ @request.accept = "text/iphone"
+ get :index
+ assert_equal '<html><div id="super_iphone">Super iPhone</div></html>', @response.body
+ end
end
end
diff --git a/actionpack/test/new_base/abstract_unit.rb b/actionpack/test/new_base/abstract_unit.rb
index e72165ee67..c045247702 100644
--- a/actionpack/test/new_base/abstract_unit.rb
+++ b/actionpack/test/new_base/abstract_unit.rb
@@ -16,6 +16,9 @@ require 'action_view/test_case'
require 'action_controller/testing/integration'
require 'active_support/dependencies'
+$tags[:new_base] = true
+
+
ActiveSupport::Dependencies.hook!
FIXTURE_LOAD_PATH = File.join(File.dirname(__FILE__), '../fixtures')
diff --git a/activesupport/lib/active_support/test_case.rb b/activesupport/lib/active_support/test_case.rb
index 50e25ef740..bab2a401eb 100644
--- a/activesupport/lib/active_support/test_case.rb
+++ b/activesupport/lib/active_support/test_case.rb
@@ -32,6 +32,11 @@ module ActiveSupport
include ActiveSupport::Testing::Default
end
+ $tags = {}
+ def self.for_tag(tag)
+ yield if $tags[tag]
+ end
+
include ActiveSupport::Testing::SetupAndTeardown
include ActiveSupport::Testing::Assertions
include ActiveSupport::Testing::Deprecation
diff --git a/activesupport/lib/active_support/testing/pending.rb b/activesupport/lib/active_support/testing/pending.rb
index d945c7e476..21134ff9e2 100644
--- a/activesupport/lib/active_support/testing/pending.rb
+++ b/activesupport/lib/active_support/testing/pending.rb
@@ -11,6 +11,11 @@ module ActiveSupport
@@at_exit = false
def pending(description = "", &block)
+ if description.is_a?(Symbol)
+ is_pending = $tags[description]
+ return block.call unless is_pending
+ end
+
if block_given?
failed = false