Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Make assertion tests pass with the new base

  • Loading branch information...
commit 9d08f86cd45ed939ecf2e24e81655371910c8045 1 parent d1d9a6c
@lifo lifo authored
View
1  actionpack/Rakefile
@@ -66,6 +66,7 @@ Rake::TestTask.new(:test_new_base_on_old_tests) do |t|
render render_json render_xml
send_file request_forgery_protection rescue url_rewriter verification webservice
http_basic_authentication http_digest_authentication
+ action_pack_assertions
).map { |name| "test/controller/#{name}_test.rb" }
end
View
1  actionpack/lib/action_controller/testing/process2.rb
@@ -41,6 +41,7 @@ def process(action, parameters = nil, session = nil, flash = nil, http_method =
@response.recycle!
@controller.response_body = nil
@controller.formats = nil
+ @controller.params = nil
@html_document = nil
@request.env['REQUEST_METHOD'] = http_method
View
2  actionpack/lib/action_view/test_case.rb
@@ -11,7 +11,7 @@ def initialize(*args)
attr_internal :rendered
alias_method :_render_template_without_template_tracking, :_render_template
def _render_template(template, local_assigns = {})
- if template.respond_to?(:identifier)
+ if template.respond_to?(:identifier) && template.present?
@_rendered[:partials][template] += 1 if template.partial?
@_rendered[:template] ||= []
@_rendered[:template] << template
View
6 actionpack/test/controller/action_pack_assertions_test.rb
@@ -1,4 +1,5 @@
require 'abstract_unit'
+require 'action_controller/vendor/html-scanner'
# a controller class to facilitate the tests
class ActionPackAssertionsController < ActionController::Base
@@ -295,8 +296,8 @@ def test_assert_redirected_to_top_level_named_route_with_same_controller_name_in
# make sure that the template objects exist
def test_template_objects_alive
process :assign_this
- assert !@controller.template.assigns['hi']
- assert @controller.template.assigns['howdy']
+ assert !@controller.template.instance_variable_get(:"@hi")
+ assert @controller.template.instance_variable_get(:"@howdy")
end
# make sure we don't have template objects when we shouldn't
@@ -444,7 +445,6 @@ def test_render_based_on_parameters
assert_equal "Mr. David", @response.body
end
-
def test_assert_redirection_fails_with_incorrect_controller
process :redirect_to_controller
assert_raise(ActiveSupport::TestCase::Assertion) do
View
2  actionpack/test/new_base/abstract_unit.rb
@@ -113,7 +113,7 @@ def assert_template(options = {}, message = nil)
hax = @controller._action_view.instance_variable_get(:@_rendered)
case options
- when NilClass, String
+ when NilClass, String
rendered = (hax[:template] || []).map { |t| t.identifier }
msg = build_message(message,
"expecting <?> but rendering with <?>",
Please sign in to comment.
Something went wrong with that request. Please try again.