Skip to content

Commit

Permalink
Add spec for preload (#64)
Browse files Browse the repository at this point in the history
This was previously broken. Adding this spec to make sure we don't have any regressions
  • Loading branch information
paulcsmith authored Oct 21, 2020
1 parent 3b1c0e0 commit dddcf7d
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions spec/preloading_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,18 @@ describe "Preloading" do
2.times { posts.results }
end

it "does not fail for has_many with custom query" do
post = PostBox.create
_another_post = PostBox.create
comment = CommentBox.create &.post_id(post.id)

posts = Post::BaseQuery.new.preload_comments(
Comment::BaseQuery.new.id.not.eq(comment.id)
)

2.times { posts.results }
end

it "does not fail for has_one" do
AdminBox.create

Expand Down

0 comments on commit dddcf7d

Please sign in to comment.