require'spec_helper'describeBitbucket::Paginatordolet(:last_page){double(:page,next?: false,items: ['item_2'])}let(:first_page){double(:page,next?: true,next: last_page,items: ['item_1'])}describe'items'doit'return items and raises StopIteration in the end'dopaginator=described_class.new(nil,nil,nil)allow(paginator).toreceive(:fetch_next_page).and_return(first_page)expect(paginator.items).tomatch(['item_1'])allow(paginator).toreceive(:fetch_next_page).and_return(last_page)expect(paginator.items).tomatch(['item_2'])allow(paginator).toreceive(:fetch_next_page).and_return(nil)