Skip to content

Commit

Permalink
Fix creation of fake
Browse files Browse the repository at this point in the history
  • Loading branch information
stevegeek committed Oct 7, 2024
1 parent 00b2f99 commit fe09507
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/quo/minitest/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ def query
end
end
query_class.stub(:new, ->(**kwargs) {
klass.new(**kwargs, results: results, total_count: total_count, page_count: page_count)
klass.new(results: results, total_count: total_count, page_count: page_count)
}) do
yield
end
elsif query_class < Quo::RelationBackedQuery
query_class.stub(:new, ->(**kwargs) {
Quo::Fakes::RelationBackedFake.new(**kwargs, results: results, total_count: total_count, page_count: page_count)
Quo::Fakes::RelationBackedFake.new(results: results, total_count: total_count, page_count: page_count)
}) do
yield
end
Expand Down
4 changes: 2 additions & 2 deletions test/quo/fake_query_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ def collection
end

test "RelationBackedFake acts like a RelationBackedQuery" do
fake_query(UnreadCommentsQuery, results: [1, 2]) do
q = UnreadCommentsQuery.new
fake_query(NewCommentsForAuthorQuery, results: [1, 2]) do
q = NewCommentsForAuthorQuery.new(author_id: 1)
assert q.results.is_a?(Quo::RelationResults)
assert q.is_a?(Quo::RelationBackedQuery)
assert_equal 2, q.results.count
Expand Down

0 comments on commit fe09507

Please sign in to comment.