mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Dont call id explicitly to do reloading that way we get rid of the warnings #583 [Tim Bates]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@521 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
c89c2bcbfb
commit
8382e6e506
2 changed files with 11 additions and 11 deletions
|
@ -462,13 +462,13 @@ class HasManyAssociationsTest < Test::Unit::TestCase
|
|||
|
||||
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 @@ class HasAndBelongsToManyAssociationsTest < Test::Unit::TestCase
|
|||
|
||||
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 @@ class HasAndBelongsToManyAssociationsTest < Test::Unit::TestCase
|
|||
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 @@ class HasAndBelongsToManyAssociationsTest < Test::Unit::TestCase
|
|||
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 @@ class HasAndBelongsToManyAssociationsTest < Test::Unit::TestCase
|
|||
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 @@ class HasAndBelongsToManyAssociationsTest < Test::Unit::TestCase
|
|||
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,7 +804,7 @@ class HasAndBelongsToManyAssociationsTest < Test::Unit::TestCase
|
|||
|
||||
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
|
||||
|
@ -812,7 +812,7 @@ class HasAndBelongsToManyAssociationsTest < Test::Unit::TestCase
|
|||
|
||||
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 @@ class HasAndBelongsToManyAssociationsTest < Test::Unit::TestCase
|
|||
|
||||
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 @@ class BasicsTest < Test::Unit::TestCase
|
|||
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
|
||||
|
|
Loading…
Reference in a new issue