Searcher#results results from twitter search: 14 instead of 15

Hi,

I don’t know if anyone encountered this issue. When I run the unit test for:

describe Searcher, "#results" do
  it "returns results from a twitter search" do
  searcher = Searcher.new('awesome search')
  expect(searcher.results.length).to eq 15 
  end
end

the test fails with the error message:

1) Searcher#results returns results from a twitter search
 Failure/Error: expect(searcher.results.length).to eq 15
   
   expected: 15
        got: 14

Does anyone have an idea what’s going on?

Thanks for your help,

Anthony

I had something similar (I once got 3 results, I think) which occurred when I ran a couple of test back-to-back; what was happening was that there were only that many ‘new’ results in the intervening time period.

yeah, I’n the meantime the test is passing again with 15 results.

Yep, I saw this as well. Can’t see any reason why though, but nothing wrong with sharing a pain. :smile:

I tried the version 5 of the interface but still saw the same problems. I ended up, for want of a better idea, using between instead.

expect(page).to have_css 'li.tweet', between: 14..15 
1 Like