spec/units/search_spec.rb in es-elasticity-0.4.5 vs spec/units/search_spec.rb in es-elasticity-0.5.0
- old
+ new
@@ -130,10 +130,11 @@
connection: double(:connection),
table_name: "table_name",
klass: double(:klass, primary_key: "id"),
to_sql: "SELECT * FROM table_name WHERE id IN (1)"
)
+
allow(relation.connection).to receive(:quote_column_name) { |name| name }
allow(relation.connection).to receive(:quote) { |name| name }
expect(relation).to receive(:where).with("table_name.id IN (?)", [1, 2]).and_return(relation)
expect(relation).to receive(:order).with("FIELD(table_name.id, 1,2)").and_return(relation)
@@ -165,10 +166,10 @@
expect(client).to receive(:search).
with(
index: index_name,
type: document_type,
body: { size: 14, from: 25, filter: {} }
- ).and_return({ "hits" => { "total" => 112 } })
+ ).and_return({ "hits" => { "total" => 112, "hits" => [] } })
docs = subject.documents(mapper)
expect(docs.per_page).to eq(14)
expect(docs.total_pages).to eq(8)
expect(docs.current_page).to eq(2)