Skip to content

Commit

Permalink
play with ci
Browse files Browse the repository at this point in the history
  • Loading branch information
markokajzer committed Dec 1, 2024
1 parent 79b185d commit d2612ec
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion spec/support/api/endpoints/it_behaves_like_a_cursor_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d2612ec

Please sign in to comment.