Skip to content

Commit

Permalink
update test_inverse_on_collection test
Browse files Browse the repository at this point in the history
  • Loading branch information
syphax-bouazzouni committed Dec 17, 2022
1 parent 361940a commit a30af42
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions test/test_collections.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit a30af42

Please sign in to comment.