Sha256: c40fde51f458b9da25fada967da46e7d83c8f2cacd502cd7c5335077eaec8130

Contents?: true

Size: 1.49 KB

Versions: 7

Compression:

Stored size: 1.49 KB

Contents

describe Elastic::AppSearch::Client::SearchSettings do
  include_context 'App Search Credentials'
  include_context 'Test Engine'

  let(:client) { Elastic::AppSearch::Client.new(client_options) }

  context 'SearchSettings' do
    let(:default_settings) do
      {
        'search_fields' => {
          'id' => {
            'weight' => 1
          }
        },
        'result_fields' => { 'id' => { 'raw' => {} } },
        'boosts' => {}
      }
    end

    let(:updated_settings) do
      {
        'search_fields' => {
          'id' => {
            'weight' => 3
          }
        },
        'result_fields' => { 'id' => { 'raw' => {} } },
        'boosts' => {}
      }
    end

    describe '#show_settings' do
      subject { client.show_settings(engine_name) }

      it 'should return default settings' do
        expect(subject).to(match(default_settings))
      end
    end

    describe '#update_settings' do
      subject { client.show_settings(engine_name) }

      before do
        client.update_settings(engine_name, updated_settings)
      end

      it 'should update search settings' do
        expect(subject).to(match(updated_settings))
      end
    end

    describe '#reset_settings' do
      subject { client.show_settings(engine_name) }

      before do
        client.update_settings(engine_name, updated_settings)
        client.reset_settings(engine_name)
      end

      it 'should reset search settings' do
        expect(subject).to(match(default_settings))
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
elastic-app-search-7.10.0 spec/search_settings_spec.rb
elastic-app-search-7.9.0 spec/search_settings_spec.rb
elastic-app-search-7.8.0 spec/search_settings_spec.rb
elastic-app-search-7.7.0 spec/search_settings_spec.rb
elastic-app-search-7.6.0 spec/search_settings_spec.rb
elastic-app-search-7.5.0 spec/search_settings_spec.rb
elastic-app-search-7.4.1 spec/search_settings_spec.rb