From a30af42241aa4d9f1ac237ea88942db3cad0765f Mon Sep 17 00:00:00 2001 From: Syphax Bouazzouni Date: Sat, 17 Dec 2022 17:16:29 +0100 Subject: [PATCH] update test_inverse_on_collection test --- test/test_collections.rb | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/test/test_collections.rb b/test/test_collections.rb index 390ad349..2177c669 100644 --- a/test/test_collections.rb +++ b/test/test_collections.rb @@ -91,18 +91,18 @@ def test_unique_per_collection def test_inverse_on_collection skip "Not supported inverse on collection" - john = User.find("John").include(:name).first || - User.new(name: "John").save() + john = User.find("John").include(:name).first || User.new(name: "John").save + 5.times do |i| - Issue.new(description: "issue_#{i}", owner: john).save + Issue.find("issue_#{i}").in(john) || Issue.new(description: "issue_#{i}", owner: john).save end - - binding.pry - User.find("John",include: [:issues]).first.issues - User.find("John",include: [issues: [:desciption]]).first.issues - 5.times do |i| - Issue.find("issue_#{i}", collection: john).delete + issues = User.find("John").include(:issues).first.issues + assert_equal 5, issues.size + + issues.each do |issue| + assert_equal "issue_#{i}", issue.description + assert_equal john, issue.collection end end