From dde527440a52317e2e7eb4a928009c036cdf772b Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Sun, 28 Jan 2007 07:00:43 +0000 Subject: Remove deprecated assertions. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6055 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- .../activerecord/active_record_assertions_test.rb | 92 --------------- .../test/controller/action_pack_assertions_test.rb | 130 --------------------- 2 files changed, 222 deletions(-) delete mode 100644 actionpack/test/activerecord/active_record_assertions_test.rb (limited to 'actionpack/test') diff --git a/actionpack/test/activerecord/active_record_assertions_test.rb b/actionpack/test/activerecord/active_record_assertions_test.rb deleted file mode 100644 index 9a3c1127a2..0000000000 --- a/actionpack/test/activerecord/active_record_assertions_test.rb +++ /dev/null @@ -1,92 +0,0 @@ -require "#{File.dirname(__FILE__)}/../active_record_unit" - -class ActiveRecordAssertionsController < ActionController::Base - self.template_root = "#{File.dirname(__FILE__)}/../fixtures/" - - # fail with 1 bad column - def nasty_columns_1 - @company = Company.new - @company.name = "B" - @company.rating = 2 - render :inline => "snicker...." - end - - # fail with 2 bad columns - def nasty_columns_2 - @company = Company.new - @company.name = "" - @company.rating = 2 - render :inline => "double snicker...." - end - - # this will pass validation - def good_company - @company = Company.new - @company.name = "A" - @company.rating = 69 - render :inline => "Goodness Gracious!" - end - - # this will fail validation - def bad_company - @company = Company.new - render :inline => "Who's Bad?" - end - - # the safety dance...... - def rescue_action(e) raise; end -end - -class ActiveRecordAssertionsControllerTest < ActiveRecordTestCase - fixtures :companies - - def setup - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new - @controller = ActiveRecordAssertionsController.new - super - end - - # test for 1 bad apple column - def test_some_invalid_columns - process :nasty_columns_1 - assert_response :success - - assert_deprecated_assertion { assert_invalid_record 'company' } - assert_deprecated_assertion { assert_invalid_column_on_record 'company', 'rating' } - assert_deprecated_assertion { assert_valid_column_on_record 'company', 'name' } - assert_deprecated_assertion { assert_valid_column_on_record 'company', %w(name id) } - end - - # test for 2 bad apples columns - def test_all_invalid_columns - process :nasty_columns_2 - assert_response :success - - assert_deprecated_assertion { assert_invalid_record 'company' } - assert_deprecated_assertion { assert_invalid_column_on_record 'company', 'rating' } - assert_deprecated_assertion { assert_invalid_column_on_record 'company', 'name' } - assert_deprecated_assertion { assert_invalid_column_on_record 'company', %w(name rating) } - end - - # ensure we have no problems with an ActiveRecord - def test_valid_record - process :good_company - assert_response :success - - assert_deprecated_assertion { assert_valid_record 'company' } - end - - # ensure we have problems with an ActiveRecord - def test_invalid_record - process :bad_company - assert_response :success - - assert_deprecated_assertion { assert_invalid_record 'company' } - end - - protected - def assert_deprecated_assertion(message = nil, &block) - assert_deprecated(/assert_.*from test_/, &block) - end -end diff --git a/actionpack/test/controller/action_pack_assertions_test.rb b/actionpack/test/controller/action_pack_assertions_test.rb index 21930aa061..d9cfe18ae5 100644 --- a/actionpack/test/controller/action_pack_assertions_test.rb +++ b/actionpack/test/controller/action_pack_assertions_test.rb @@ -175,13 +175,6 @@ class ActionPackAssertionsControllerTest < Test::Unit::TestCase assert_tag :content => "/action_pack_assertions/flash_me" end - # test the session assertion to make sure something is there. - def test_assert_session_has - process :session_stuffing - assert_deprecated_assertion { assert_session_has 'xmas' } - assert_deprecated_assertion { assert_session_has_no 'halloween' } - end - # test the get method, make sure the request really was a get def test_get assert_raise(RuntimeError) { get :raise_on_get } @@ -209,49 +202,6 @@ class ActionPackAssertionsControllerTest < Test::Unit::TestCase # assert_equal @response.body, 'request method: GET' # end - # test the assertion of goodies in the template - def test_assert_template_has - process :assign_this - assert_deprecated_assertion { assert_template_has 'howdy' } - end - - # test the assertion for goodies that shouldn't exist in the template - def test_assert_template_has_no - process :nothing - assert_deprecated_assertion { assert_template_has_no 'maple syrup' } - assert_deprecated_assertion { assert_template_has_no 'howdy' } - end - - # test the redirection assertions - def test_assert_redirect - process :redirect_internal - assert_deprecated_assertion { assert_redirect } - end - - # test the redirect url string - def test_assert_redirect_url - process :redirect_external - assert_deprecated_assertion do - assert_redirect_url 'http://www.rubyonrails.org' - end - end - - # test the redirection pattern matching on a string - def test_assert_redirect_url_match_string - process :redirect_external - assert_deprecated_assertion do - assert_redirect_url_match 'rails.org' - end - end - - # test the redirection pattern matching on a pattern - def test_assert_redirect_url_match_pattern - process :redirect_external - assert_deprecated_assertion do - assert_redirect_url_match /ruby/ - end - end - # test the redirection to a named route def test_assert_redirect_to_named_route with_routing do |set| @@ -317,47 +267,8 @@ class ActionPackAssertionsControllerTest < Test::Unit::TestCase end end - # test the flash-based assertions with something is in the flash - def test_flash_assertions_full - process :flash_me - assert @response.has_flash_with_contents? - assert_deprecated_assertion { assert_flash_exists } - assert_deprecated_assertion { assert_flash_not_empty } - assert_deprecated_assertion { assert_flash_has 'hello' } - assert_deprecated_assertion { assert_flash_has_no 'stds' } - end - - # test the flash-based assertions with no flash at all - def test_flash_assertions_negative - process :nothing - assert_deprecated_assertion { assert_flash_empty } - assert_deprecated_assertion { assert_flash_has_no 'hello' } - assert_deprecated_assertion { assert_flash_has_no 'qwerty' } - end - - # test the assert_rendered_file - def test_assert_rendered_file - assert_deprecated(/render/) { process :hello_world } - assert_deprecated_assertion { assert_rendered_file 'test/hello_world' } - assert_deprecated_assertion { assert_rendered_file 'hello_world' } - end - - # test the assert_success assertion - def test_assert_success - process :nothing - assert_deprecated_assertion { assert_success } - end - # -- standard request/response object testing -------------------------------- - # ensure our session is working properly - def test_session_objects - process :session_stuffing - assert @response.has_session_object?('xmas') - assert_deprecated_assertion { assert_session_equal 'turkey', 'xmas' } - assert !@response.has_session_object?('easter') - end - # make sure that the template objects exist def test_template_objects_alive process :assign_this @@ -371,11 +282,6 @@ class ActionPackAssertionsControllerTest < Test::Unit::TestCase assert_nil @response.template_objects['howdy'] end - def test_assigned_equal - process :assign_this - assert_deprecated_assertion { assert_assigned_equal "ho", :howdy } - end - # check the empty flashing def test_flash_me_naked process :flash_me_naked @@ -399,14 +305,6 @@ class ActionPackAssertionsControllerTest < Test::Unit::TestCase assert_nil @response.flash['hello'] end - # examine that the flash objects are what we expect - def test_flash_equals - process :flash_me - assert_deprecated_assertion do - assert_flash_equal 'my name is inigo montoya...', 'hello' - end - end - # check if we were rendered by a file-based template? def test_rendered_action process :nothing @@ -489,29 +387,6 @@ class ActionPackAssertionsControllerTest < Test::Unit::TestCase assert_equal "Mr. David", @response.body end - def test_assert_template_xpath_match_no_matches - assert_deprecated(/render/) { process :hello_xml_world } - assert_raises Test::Unit::AssertionFailedError do - assert_deprecated_assertion do - assert_template_xpath_match('/no/such/node/in/document') - end - end - end - - def test_simple_one_element_xpath_match - assert_deprecated(/render/) { process :hello_xml_world } - assert_deprecated_assertion do - assert_template_xpath_match('//title', "Hello World") - end - end - - def test_array_of_elements_in_xpath_match - assert_deprecated(/render/) { process :hello_xml_world } - assert_deprecated_assertion do - assert_template_xpath_match('//p', %w( abes monks wiseguys )) - end - end - def test_follow_redirect process :redirect_to_action assert_redirected_to :action => "flash_me" @@ -577,11 +452,6 @@ class ActionPackAssertionsControllerTest < Test::Unit::TestCase rescue Test::Unit::AssertionFailedError => e end end - - protected - def assert_deprecated_assertion(&block) - assert_deprecated(/assert/, &block) - end end class ActionPackHeaderTest < Test::Unit::TestCase -- cgit v1.2.3