diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2006-09-04 03:07:17 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2006-09-04 03:07:17 +0000 |
commit | c3a52523ceaf4aab819c7c5da748d552f9cb3f99 (patch) | |
tree | 18d27610f2e5084f62a3bd7c6d3ef1bcaaa9a800 | |
parent | 23d579b262e6f665d8d343d066aa7fd640ce46b4 (diff) | |
download | rails-c3a52523ceaf4aab819c7c5da748d552f9cb3f99.tar.gz rails-c3a52523ceaf4aab819c7c5da748d552f9cb3f99.tar.bz2 rails-c3a52523ceaf4aab819c7c5da748d552f9cb3f99.zip |
Active Record integration deprecation tests
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4962 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r-- | actionpack/lib/action_controller/assertions/deprecated_assertions.rb | 6 | ||||
-rw-r--r-- | actionpack/test/activerecord/active_record_assertions_test.rb | 37 |
2 files changed, 26 insertions, 17 deletions
diff --git a/actionpack/lib/action_controller/assertions/deprecated_assertions.rb b/actionpack/lib/action_controller/assertions/deprecated_assertions.rb index 07adb83695..c7d2eec66c 100644 --- a/actionpack/lib/action_controller/assertions/deprecated_assertions.rb +++ b/actionpack/lib/action_controller/assertions/deprecated_assertions.rb @@ -215,14 +215,14 @@ module ActionController #:nodoc: end def find_record_in_template(key = nil) - assert_template_has(key) + assert_not_nil assigns(key) record = @response.template_objects[key] assert_not_nil(record) assert_kind_of ActiveRecord::Base, record return record - end + end end end -end
\ No newline at end of file +end diff --git a/actionpack/test/activerecord/active_record_assertions_test.rb b/actionpack/test/activerecord/active_record_assertions_test.rb index 6662d3d10c..9a3c1127a2 100644 --- a/actionpack/test/activerecord/active_record_assertions_test.rb +++ b/actionpack/test/activerecord/active_record_assertions_test.rb @@ -50,34 +50,43 @@ class ActiveRecordAssertionsControllerTest < ActiveRecordTestCase # test for 1 bad apple column def test_some_invalid_columns process :nasty_columns_1 - assert_success - assert_invalid_record 'company' - assert_invalid_column_on_record 'company', 'rating' - assert_valid_column_on_record 'company', 'name' - assert_valid_column_on_record 'company', %w(name id) + 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_success - assert_invalid_record 'company' - assert_invalid_column_on_record 'company', 'rating' - assert_invalid_column_on_record 'company', 'name' - assert_invalid_column_on_record 'company', %w(name rating) + 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_success - assert_valid_record '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_success - assert_invalid_record '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 |