diff --git a/spec/support/api/endpoints/it_behaves_like_a_cursor_api.rb b/spec/support/api/endpoints/it_behaves_like_a_cursor_api.rb index d998338..afe6f17 100644 --- a/spec/support/api/endpoints/it_behaves_like_a_cursor_api.rb +++ b/spec/support/api/endpoints/it_behaves_like_a_cursor_api.rb @@ -27,15 +27,23 @@ end end - it 'paginates over the entire collection' do + fit 'paginates over the entire collection', :focus do models_ids = [] next_cursor = { size: 3 } loop do + puts 'YALLAH' + puts "model_ps: #{model_ps}" + puts "next params: #{next_cursor.merge(cursor_params)}" + response = client.send(model_ps, next_cursor.merge(cursor_params)) + puts response.inspect + models_ids.concat(response.map { |instance| instance._links.self._url.gsub("http://example.org/api/#{model_ps}/", '') }) + puts "next: #{response._links[:next]}" break unless response._links[:next] next_cursor = CGI.parse(URI.parse(response._links.next._url).query).map { |a| [a[0], a[1][0]] }.to_h + puts "next_cursor: #{next_cursor.inspect}" end expect(models_ids.uniq.count).to eq model.all.count end