|
159 | 159 | expect(response.dig("status")).to eq("ok") |
160 | 160 | expect(response.dig("result")).to eq(true) |
161 | 161 | end |
| 162 | + |
| 163 | + it "adds wait=false query param when specified" do |
| 164 | + allow_any_instance_of(Faraday::Connection).to receive(:put) |
| 165 | + .with("collections/test_collection/index?wait=false") |
| 166 | + .and_return(response) |
| 167 | + |
| 168 | + response = collections.create_index( |
| 169 | + collection_name: "test_collection", |
| 170 | + field_name: "description", |
| 171 | + field_schema: "text", |
| 172 | + wait: false |
| 173 | + ) |
| 174 | + expect(response.dig("status")).to eq("ok") |
| 175 | + expect(response.dig("result")).to eq(true) |
| 176 | + end |
| 177 | + |
| 178 | + it "adds ordering query param when specified" do |
| 179 | + allow_any_instance_of(Faraday::Connection).to receive(:put) |
| 180 | + .with("collections/test_collection/index?ordering=weak") |
| 181 | + .and_return(response) |
| 182 | + |
| 183 | + response = collections.create_index( |
| 184 | + collection_name: "test_collection", |
| 185 | + field_name: "description", |
| 186 | + field_schema: "text", |
| 187 | + ordering: "weak" |
| 188 | + ) |
| 189 | + expect(response.dig("status")).to eq("ok") |
| 190 | + expect(response.dig("result")).to eq(true) |
| 191 | + end |
| 192 | + |
| 193 | + it "adds both wait=false and ordering params when specified" do |
| 194 | + allow_any_instance_of(Faraday::Connection).to receive(:put) |
| 195 | + .with("collections/test_collection/index?ordering=weak&wait=false") |
| 196 | + .and_return(response) |
| 197 | + |
| 198 | + response = collections.create_index( |
| 199 | + collection_name: "test_collection", |
| 200 | + field_name: "description", |
| 201 | + field_schema: "text", |
| 202 | + ordering: "weak", |
| 203 | + wait: false |
| 204 | + ) |
| 205 | + expect(response.dig("status")).to eq("ok") |
| 206 | + expect(response.dig("result")).to eq(true) |
| 207 | + end |
162 | 208 | end |
163 | 209 |
|
164 | 210 | describe "#delete_index" do |
|
0 commit comments