aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/associations
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2007-06-11 07:15:59 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2007-06-11 07:15:59 +0000
commit800b899f9685a12e0e255e29369eac36e2985d28 (patch)
tree6990f3d1ce4872aa1eafb3bbf4646b0fff47c078 /activerecord/test/associations
parent813e8ba93bf099dd065512f958a516c6b893a841 (diff)
downloadrails-800b899f9685a12e0e255e29369eac36e2985d28.tar.gz
rails-800b899f9685a12e0e255e29369eac36e2985d28.tar.bz2
rails-800b899f9685a12e0e255e29369eac36e2985d28.zip
Remove deprecated push_with_attributes.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6997 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test/associations')
-rw-r--r--activerecord/test/associations/callbacks_test.rb47
1 files changed, 17 insertions, 30 deletions
diff --git a/activerecord/test/associations/callbacks_test.rb b/activerecord/test/associations/callbacks_test.rb
index d0f7fa67de..afb1b8e84d 100644
--- a/activerecord/test/associations/callbacks_test.rb
+++ b/activerecord/test/associations/callbacks_test.rb
@@ -15,29 +15,29 @@ class AssociationCallbacksTest < Test::Unit::TestCase
@authorless = posts(:authorless)
assert @david.post_log.empty?
end
-
+
def test_adding_macro_callbacks
@david.posts_with_callbacks << @thinking
assert_equal ["before_adding#{@thinking.id}", "after_adding#{@thinking.id}"], @david.post_log
@david.posts_with_callbacks << @thinking
- assert_equal ["before_adding#{@thinking.id}", "after_adding#{@thinking.id}", "before_adding#{@thinking.id}",
+ assert_equal ["before_adding#{@thinking.id}", "after_adding#{@thinking.id}", "before_adding#{@thinking.id}",
"after_adding#{@thinking.id}"], @david.post_log
end
-
+
def test_adding_with_proc_callbacks
@david.posts_with_proc_callbacks << @thinking
assert_equal ["before_adding#{@thinking.id}", "after_adding#{@thinking.id}"], @david.post_log
@david.posts_with_proc_callbacks << @thinking
- assert_equal ["before_adding#{@thinking.id}", "after_adding#{@thinking.id}", "before_adding#{@thinking.id}",
+ assert_equal ["before_adding#{@thinking.id}", "after_adding#{@thinking.id}", "before_adding#{@thinking.id}",
"after_adding#{@thinking.id}"], @david.post_log
end
-
+
def test_removing_with_macro_callbacks
first_post, second_post = @david.posts_with_callbacks[0, 2]
@david.posts_with_callbacks.delete(first_post)
assert_equal ["before_removing#{first_post.id}", "after_removing#{first_post.id}"], @david.post_log
@david.posts_with_callbacks.delete(second_post)
- assert_equal ["before_removing#{first_post.id}", "after_removing#{first_post.id}", "before_removing#{second_post.id}",
+ assert_equal ["before_removing#{first_post.id}", "after_removing#{first_post.id}", "before_removing#{second_post.id}",
"after_removing#{second_post.id}"], @david.post_log
end
@@ -46,20 +46,20 @@ class AssociationCallbacksTest < Test::Unit::TestCase
@david.posts_with_proc_callbacks.delete(first_post)
assert_equal ["before_removing#{first_post.id}", "after_removing#{first_post.id}"], @david.post_log
@david.posts_with_proc_callbacks.delete(second_post)
- assert_equal ["before_removing#{first_post.id}", "after_removing#{first_post.id}", "before_removing#{second_post.id}",
+ assert_equal ["before_removing#{first_post.id}", "after_removing#{first_post.id}", "before_removing#{second_post.id}",
"after_removing#{second_post.id}"], @david.post_log
end
-
+
def test_multiple_callbacks
@david.posts_with_multiple_callbacks << @thinking
- assert_equal ["before_adding#{@thinking.id}", "before_adding_proc#{@thinking.id}", "after_adding#{@thinking.id}",
+ assert_equal ["before_adding#{@thinking.id}", "before_adding_proc#{@thinking.id}", "after_adding#{@thinking.id}",
"after_adding_proc#{@thinking.id}"], @david.post_log
@david.posts_with_multiple_callbacks << @thinking
- assert_equal ["before_adding#{@thinking.id}", "before_adding_proc#{@thinking.id}", "after_adding#{@thinking.id}",
- "after_adding_proc#{@thinking.id}", "before_adding#{@thinking.id}", "before_adding_proc#{@thinking.id}",
+ assert_equal ["before_adding#{@thinking.id}", "before_adding_proc#{@thinking.id}", "after_adding#{@thinking.id}",
+ "after_adding_proc#{@thinking.id}", "before_adding#{@thinking.id}", "before_adding_proc#{@thinking.id}",
"after_adding#{@thinking.id}", "after_adding_proc#{@thinking.id}"], @david.post_log
end
-
+
def test_has_and_belongs_to_many_add_callback
david = developers(:david)
ar = projects(:active_record)
@@ -67,10 +67,10 @@ class AssociationCallbacksTest < Test::Unit::TestCase
ar.developers_with_callbacks << david
assert_equal ["before_adding#{david.id}", "after_adding#{david.id}"], ar.developers_log
ar.developers_with_callbacks << david
- assert_equal ["before_adding#{david.id}", "after_adding#{david.id}", "before_adding#{david.id}",
+ assert_equal ["before_adding#{david.id}", "after_adding#{david.id}", "before_adding#{david.id}",
"after_adding#{david.id}"], ar.developers_log
end
-
+
def test_has_and_belongs_to_many_remove_callback
david = developers(:david)
jamis = developers(:jamis)
@@ -78,9 +78,9 @@ class AssociationCallbacksTest < Test::Unit::TestCase
assert activerecord.developers_log.empty?
activerecord.developers_with_callbacks.delete(david)
assert_equal ["before_removing#{david.id}", "after_removing#{david.id}"], activerecord.developers_log
-
+
activerecord.developers_with_callbacks.delete(jamis)
- assert_equal ["before_removing#{david.id}", "after_removing#{david.id}", "before_removing#{jamis.id}",
+ assert_equal ["before_removing#{david.id}", "after_removing#{david.id}", "before_removing#{jamis.id}",
"after_removing#{jamis.id}"], activerecord.developers_log
end
@@ -97,7 +97,7 @@ class AssociationCallbacksTest < Test::Unit::TestCase
assert activerecord.developers_with_callbacks.clear
assert_equal log_array, activerecord.developers_log.sort
end
-
+
def test_dont_add_if_before_callback_raises_exception
assert !@david.unchangable_posts.include?(@authorless)
begin
@@ -109,18 +109,5 @@ class AssociationCallbacksTest < Test::Unit::TestCase
@david.reload
assert !@david.unchangable_posts.include?(@authorless)
end
-
- def test_push_with_attributes
- assert_deprecated 'push_with_attributes' do
- david = developers(:david)
- activerecord = projects(:active_record)
- assert activerecord.developers_log.empty?
- activerecord.developers_with_callbacks.push_with_attributes(david, {})
- assert_equal ["before_adding#{david.id}", "after_adding#{david.id}"], activerecord.developers_log
- activerecord.developers_with_callbacks.push_with_attributes(david, {})
- assert_equal ["before_adding#{david.id}", "after_adding#{david.id}", "before_adding#{david.id}",
- "after_adding#{david.id}"], activerecord.developers_log
- end
- end
end