|
1 | 1 | # frozen_string_literal: true |
2 | | -require_relative "../spec_helper" |
3 | 2 |
|
4 | | -describe "Stemming Dictionaries" do |
| 3 | +require_relative '../spec_helper' |
| 4 | + |
| 5 | +describe 'StemmingDictionaries' do |
5 | 6 | let(:client) do |
6 | 7 | Typesense::Client.new( |
7 | | - nodes: [{ host: "localhost", port: "8108", protocol: "http" }], |
8 | | - api_key: "xyz", |
9 | | - connection_timeout_seconds: 10, |
| 8 | + nodes: [{ host: 'localhost', port: '8108', protocol: 'http' }], |
| 9 | + api_key: 'xyz', |
| 10 | + connection_timeout_seconds: 10 |
10 | 11 | ) |
11 | 12 | end |
12 | 13 |
|
13 | | - let(:dictionary_id) { "test_dictionary" } |
| 14 | + let(:dictionary_id) { 'test_dictionary' } |
14 | 15 | let(:dictionary) do |
15 | 16 | [ |
16 | | - { "root" => "exampleRoot1", "word" => "exampleWord1" }, |
17 | | - { "root" => "exampleRoot2", "word" => "exampleWord2" }, |
| 17 | + { 'root' => 'exampleRoot1', 'word' => 'exampleWord1' }, |
| 18 | + { 'root' => 'exampleRoot2', 'word' => 'exampleWord2' } |
18 | 19 | ] |
19 | 20 | end |
20 | 21 |
|
21 | 22 | before { WebMock.disable! } |
22 | 23 | after { WebMock.enable! } |
23 | 24 |
|
24 | | - it "can upsert a dictionary" do |
| 25 | + it 'can upsert a dictionary' do |
25 | 26 | response = client.stemming.dictionaries.upsert(dictionary_id, dictionary) |
26 | 27 | expect(response).to eq(dictionary) |
27 | 28 | end |
28 | 29 |
|
29 | | - it "can retrieve a dictionary" do |
| 30 | + it 'can retrieve a dictionary' do |
30 | 31 | response = client.stemming.dictionaries[dictionary_id].retrieve |
31 | | - expect(response["id"]).to eq(dictionary_id) |
32 | | - expect(response["words"]).to eq(dictionary) |
| 32 | + expect(response['id']).to eq(dictionary_id) |
| 33 | + expect(response['words']).to eq(dictionary) |
33 | 34 | end |
34 | 35 |
|
35 | | - it "can retrieve all dictionaries" do |
| 36 | + it 'can retrieve all dictionaries' do |
36 | 37 | response = client.stemming.dictionaries.retrieve |
37 | | - expect(response["dictionaries"].length).to eq(1) |
38 | | - expect(response["dictionaries"][0]).to eq(dictionary_id) |
| 38 | + expect(response['dictionaries'].length).to eq(1) |
| 39 | + expect(response['dictionaries'][0]).to eq(dictionary_id) |
39 | 40 | end |
40 | 41 | end |
0 commit comments