Permalink
Browse files

Dont call id explicitly to do reloading that way we get rid of the wa…

…rnings #583 [Tim Bates]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@521 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent c89c2bc commit 8382e6e50681fef860fb2856af12fa72853a8488 @dhh dhh committed Feb 7, 2005
Showing with 11 additions and 11 deletions.
  1. +10 −10 activerecord/test/associations_test.rb
  2. +1 −1 activerecord/test/base_test.rb
@@ -462,13 +462,13 @@ def test_deleting_a_item_which_is_not_in_the_collection
def test_deleting_type_mismatch
david = Developer.find(1)
- david.projects.id
+ david.projects.reload
assert_raises(ActiveRecord::AssociationTypeMismatch) { david.projects.delete(1) }
end
def test_deleting_self_type_mismatch
david = Developer.find(1)
- david.projects.id
+ david.projects.reload
assert_raises(ActiveRecord::AssociationTypeMismatch) { david.projects.delete(Project.find(1).developers) }
end
@@ -672,7 +672,7 @@ def test_has_and_belongs_to_many
def test_adding_single
jamis = Developer.find(2)
- jamis.projects.id # causing the collection to load
+ jamis.projects.reload # causing the collection to load
action_controller = Project.find(2)
assert_equal 1, jamis.projects.size
assert_equal 1, action_controller.developers.size
@@ -693,7 +693,7 @@ def test_adding_type_mismatch
def test_adding_from_the_project
jamis = Developer.find(2)
action_controller = Project.find(2)
- action_controller.developers.id
+ action_controller.developers.reload
assert_equal 1, jamis.projects.size
assert_equal 1, action_controller.developers.size
@@ -707,7 +707,7 @@ def test_adding_from_the_project
def test_adding_multiple
aridridel = Developer.new("name" => "Aridridel")
aridridel.save
- aridridel.projects.id
+ aridridel.projects.reload
aridridel.projects.push(Project.find(1), Project.find(2))
assert_equal 2, aridridel.projects.size
assert_equal 2, aridridel.projects(true).size
@@ -716,7 +716,7 @@ def test_adding_multiple
def test_adding_a_collection
aridridel = Developer.new("name" => "Aridridel")
aridridel.save
- aridridel.projects.id
+ aridridel.projects.reload
aridridel.projects.concat([Project.find(1), Project.find(2)])
assert_equal 2, aridridel.projects.size
assert_equal 2, aridridel.projects(true).size
@@ -791,7 +791,7 @@ def test_uniq_before_the_fact
def test_deleting
david = Developer.find(1)
active_record = Project.find(1)
- david.projects.id
+ david.projects.reload
assert_equal 2, david.projects.size
assert_equal 2, active_record.developers.size
@@ -804,15 +804,15 @@ def test_deleting
def test_deleting_array
david = Developer.find(1)
- david.projects.id
+ david.projects.reload
david.projects.delete(Project.find_all)
assert_equal 0, david.projects.size
assert_equal 0, david.projects(true).size
end
def test_deleting_all
david = Developer.find(1)
- david.projects.id
+ david.projects.reload
david.projects.clear
assert_equal 0, david.projects.size
assert_equal 0, david.projects(true).size
@@ -829,7 +829,7 @@ def test_additional_columns_from_join_table
def test_destroy_all
david = Developer.find(1)
- david.projects.id
+ david.projects.reload
assert !david.projects.empty?
david.projects.destroy_all
assert david.projects.empty?
@@ -201,7 +201,7 @@ def test_destroy
end
def test_record_not_found_exception
- assert_raises(ActiveRecord::RecordNotFound) { topicReloaded = Topic.find(id) }
+ assert_raises(ActiveRecord::RecordNotFound) { topicReloaded = Topic.find(99999) }
end
def test_initialize_with_attributes

0 comments on commit 8382e6e

Please sign in to comment.