spec/units/search_spec.rb in es-elasticity-0.6.2 vs spec/units/search_spec.rb in es-elasticity-0.6.3
- old
+ new
@@ -150,31 +150,35 @@
docs = subject.documents(mapper)
expect(docs.per_page).to eq(10)
expect(docs.total_pages).to eq(1)
expect(docs.current_page).to eq(1)
+ expect(docs.next_page).to eq(nil)
+ expect(docs.previous_page).to eq(nil)
end
it "provides custom properties for pagination" do
subject = Elasticity::Search::Facade.new(
client,
Elasticity::Search::Definition.new(
index_name,
document_type,
- { size: 14, from: 25, filter: {} }
+ { size: 15, from: 15, filter: {} }
)
)
expect(client).to receive(:search).
with(
index: index_name,
type: document_type,
- body: { size: 14, from: 25, filter: {} }
+ body: { size: 15, from: 15, filter: {} }
).and_return({ "hits" => { "total" => 112, "hits" => [] } })
docs = subject.documents(mapper)
- expect(docs.per_page).to eq(14)
+ expect(docs.per_page).to eq(15)
expect(docs.total_pages).to eq(8)
expect(docs.current_page).to eq(2)
+ expect(docs.next_page).to eq(3)
+ expect(docs.previous_page).to eq(1)
end
end
describe Elasticity::Search::DocumentProxy do
let :search do