Skip to content

Commit 31ec00d

Browse files
committed
Fix flappy tests
Paginator changes in other tests result in flappy tests. Explicitly setting to the one we need.
1 parent 9e2a8c1 commit 31ec00d

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

test/fixtures/active_record.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1465,6 +1465,8 @@ class BookResource < JSONAPI::Resource
14651465
attribute "title"
14661466
attributes :isbn, :banned
14671467

1468+
paginator :offset
1469+
14681470
has_many "authors"
14691471

14701472
has_many "book_comments", relation_name: -> (options = {}) {
@@ -1523,6 +1525,8 @@ class BookCommentResource < JSONAPI::Resource
15231525
has_one :book
15241526
has_one :author, class_name: 'Person'
15251527

1528+
paginator :offset
1529+
15261530
filters :book
15271531
filter :approved, apply: ->(records, value, options) {
15281532
context = options[:context]

test/integration/requests/request_test.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,7 @@ def test_query_count_related_resources
609609
# * Fetch specified book record
610610
# * Fetch book comment records associated with specified book
611611
# * Select count of book comment records for pagination
612+
Api::V2::BookCommentResource.paginator :offset
612613
assert_query_count 3 do
613614
get '/api/v2/books/1/book_comments?page[limit]=20'
614615
end
@@ -621,6 +622,8 @@ def test_query_count_related_resources_with_includes
621622
# * Fetch book comment records associated with specified book
622623
# * Fetch all author records the book comments to be returned
623624
# * Select count of book comment records for pagination
625+
Api::V2::BookCommentResource.paginator :offset
626+
624627
assert_query_count 4 do
625628
get '/api/v2/books/1/book_comments?page[limit]=20&include=author'
626629
end

0 commit comments

Comments
 (0)