spec/acceptance/realtime/channel_history_spec.rb in ably-0.8.5 vs spec/acceptance/realtime/channel_history_spec.rb in ably-0.8.6

- old
+ new

@@ -184,12 +184,22 @@ expect(messages.items.map(&:data).uniq.first).to eql(message_before_attach) messages.next do |next_page_messages| expect(next_page_messages.items.count).to eql(5) expect(next_page_messages.items.map(&:data).uniq.first).to eql(message_before_attach) - expect(next_page_messages).to be_last - stop_reactor + if next_page_messages.last? + expect(next_page_messages).to be_last + stop_reactor + else + # If previous page said there is another page it is plausible and correct that + # the next page is empty and then the last, if the limit was satisfied + next_page_messages.next do |empty_page| + expect(empty_page.items.count).to eql(0) + expect(empty_page).to be_last + stop_reactor + end + end end end end end end