repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/journal_spec.rb | spec/chewy/journal_spec.rb | require 'spec_helper'
describe Chewy::Journal do
context 'journaling', :orm do
['', 'namespace/'].each do |namespace|
context namespace.present? ? 'with namespace' : 'without namespace' do
before do
stub_model(:city) do
update_index "#{namespace}cities", :self
end
... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/repository_spec.rb | spec/chewy/repository_spec.rb | require 'spec_helper'
describe Chewy::Repository do
subject { described_class.send(:new) }
its(:analyzers) { should == {} }
its(:tokenizers) { should == {} }
its(:filters) { should == {} }
its(:char_filters) { should == {} }
describe '#analyzer' do
specify { expect(subject.analyzer(:name)).to be_nil ... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/runtime_spec.rb | spec/chewy/runtime_spec.rb | require 'spec_helper'
describe Chewy::Runtime do
describe '.version' do
specify { expect(described_class.version).to be_a(described_class::Version) }
specify { expect(described_class.version).to be >= '8.0' }
specify { expect(described_class.version).to be < '9.0' }
end
end
| ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/stash_spec.rb | spec/chewy/stash_spec.rb | require 'spec_helper'
describe Chewy::Stash::Journal, :orm do
def fetch_deleted_number(response)
response['deleted'] || response['_indices']['_all']['deleted']
end
before { drop_indices }
before do
stub_model(:city)
stub_index(:cities) do
index_scope City
end
stub_index(:countries)
... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/strategy_spec.rb | spec/chewy/strategy_spec.rb | require 'spec_helper'
describe Chewy::Strategy do
before { drop_indices }
subject(:strategy) { Chewy::Strategy.new }
describe '#current' do
specify { expect(strategy.current).to be_a(Chewy::Strategy::Base) }
context do
before { allow(Chewy).to receive_messages(root_strategy: :bypass) }
spec... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/elastic_client_spec.rb | spec/chewy/elastic_client_spec.rb | require 'spec_helper'
describe Chewy::ElasticClient do
describe 'payload inspection' do
let(:filter) { instance_double('Proc') }
let!(:filter_previous_value) { Chewy.before_es_request_filter }
before do
drop_indices
stub_index(:products) do
field :id, type: :integer
end
P... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/index_spec.rb | spec/chewy/index_spec.rb | require 'spec_helper'
describe Chewy::Index do
before do
stub_index(:dummies)
end
describe '.import', :orm do
before do
stub_model(:city)
stub_model(:country)
stub_index(:cities) do
index_scope City
end
stub_index(:countries) do
index_scope Country
e... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/config_spec.rb | spec/chewy/config_spec.rb | require 'spec_helper'
describe Chewy::Config do
subject { described_class.send(:new) }
its(:logger) { should be_nil }
its(:transport_logger) { should be_nil }
its(:transport_logger) { should be_nil }
its(:root_strategy) { should == :base }
its(:request_strategy) { should == :atomic }
its(:console_strate... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/rake_helper_spec.rb | spec/chewy/rake_helper_spec.rb | require 'spec_helper'
require 'rake'
describe Chewy::RakeHelper, :orm do
before { drop_indices }
before do
described_class.instance_variable_set(:@journal_exists, journal_exists)
stub_model(:city)
stub_model(:country)
stub_index(:cities) do
index_scope City
field :name
field :u... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/minitest/search_index_receiver_spec.rb | spec/chewy/minitest/search_index_receiver_spec.rb | require 'spec_helper'
require 'chewy/minitest'
describe :search_index_receiver do
def search_request(item_count = 2, verb: :index)
items = Array.new(item_count) do |i|
{
verb => {_id: i + 1, data: {}}
}
end
[
{
body: items
}
]
end
def parse_request(reques... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/minitest/helpers_spec.rb | spec/chewy/minitest/helpers_spec.rb | require 'spec_helper'
require 'chewy/minitest'
describe :minitest_helper do
class << self
alias_method :teardown, :after
end
def assert_includes(haystack, needle, _comment)
expect(haystack).to include(needle)
end
include Chewy::Minitest::Helpers
def assert_equal(expected, actual, message)
ra... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/rspec/build_query_spec.rb | spec/chewy/rspec/build_query_spec.rb | require 'spec_helper'
describe :build_query do
before do
stub_model(:city)
stub_index(:cities) { index_scope City }
CitiesIndex.create
end
let(:expected_query) do
{
index: ['cities'],
body: {
query: {
match: {name: 'name'}
}
}
}
end
let(:dummy_... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/rspec/update_index_spec.rb | spec/chewy/rspec/update_index_spec.rb | require 'spec_helper'
describe :update_index do
before do
stub_index(:dummies) do
end
stub_index(:dummies2) do
end
end
before do
drop_indices
DummiesIndex.create!
end
specify { expect {}.not_to update_index(DummiesIndex) }
specify { expect { DummiesIndex.bulk body: [] }.not_to upd... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/rspec/helpers_spec.rb | spec/chewy/rspec/helpers_spec.rb | require 'spec_helper'
describe :rspec_helper do
include Chewy::Rspec::Helpers
before do
stub_model(:city)
stub_index(:cities) { index_scope City }
CitiesIndex.create
end
let(:hits) do
[
{
'_index' => 'cities',
'_type' => '_doc',
'_id' => '1',
'_score' => ... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/index/witchcraft_spec.rb | spec/chewy/index/witchcraft_spec.rb | require 'spec_helper'
describe Chewy::Index::Witchcraft do
def self.mapping(&block)
before do
stub_index(:products) do
witchcraft!
instance_exec(&block)
end
end
end
describe '#cauldron' do
let(:index) { ProductsIndex }
let(:object) {}
context 'empty mapping' do
... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/index/import_spec.rb | spec/chewy/index/import_spec.rb | require 'spec_helper'
describe Chewy::Index::Import do
before { drop_indices }
before do
stub_model(:city)
end
before do
stub_index(:cities) do
index_scope City
field :name
end
end
def imported_cities
CitiesIndex.all.map do |city|
city.attributes.except('_score', '_expl... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/index/mapping_spec.rb | spec/chewy/index/mapping_spec.rb | require 'spec_helper'
describe Chewy::Index::Mapping do
let(:product) { ProductsIndex }
let(:review) { ReviewsIndex }
before do
stub_index(:products) do
root do
field :name, 'surname'
field :title, type: 'text' do
field :subfield1
end
field 'price', type: 'fl... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/index/actions_spec.rb | spec/chewy/index/actions_spec.rb | require 'spec_helper'
describe Chewy::Index::Actions do
before { drop_indices }
before do
stub_index :dummies
stub_index :dummies_suffixed
end
describe '.exists?' do
specify { expect(DummiesIndex.exists?).to eq(false) }
context do
before { DummiesIndex.create }
specify { expect(D... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/index/specification_spec.rb | spec/chewy/index/specification_spec.rb | require 'spec_helper'
describe Chewy::Index::Specification do
before { drop_indices }
let(:index1) do
stub_index(:places) do
field :founded_on, type: 'date'
end
end
let(:index2) do
stub_index(:places) do
settings analyzer: {}
field :founded_on, type: 'date'
end
end
let(... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/index/wrapper_spec.rb | spec/chewy/index/wrapper_spec.rb | require 'spec_helper'
describe Chewy::Index::Wrapper do
before do
stub_class(:city)
stub_index(:cities) do
index_scope City
end
end
let(:cities_index) { CitiesIndex }
describe '.build' do
specify do
expect(cities_index.build({}).attributes)
.to eq('id' => nil, '_score' => ... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/index/settings_spec.rb | spec/chewy/index/settings_spec.rb | require 'spec_helper'
describe Chewy::Index::Settings do
describe '#to_hash' do
before { allow(Chewy).to receive_messages(config: Chewy::Config.send(:new)) }
before { allow(Chewy).to receive_messages(repository: Chewy::Repository.send(:new)) }
specify { expect(described_class.new.to_hash).to eq({}) }
... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/index/aliases_spec.rb | spec/chewy/index/aliases_spec.rb | require 'spec_helper'
describe Chewy::Index::Aliases do
before { drop_indices }
before { stub_index :dummies }
describe '.indexes' do
specify { expect(DummiesIndex.indexes).to eq([]) }
context do
before { DummiesIndex.create! }
specify { expect(DummiesIndex.indexes).to eq(['dummies']) }
... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/index/observe_spec.rb | spec/chewy/index/observe_spec.rb | require 'spec_helper'
describe Chewy::Index::Observe do
describe '.update_index' do
before do
stub_index(:dummies)
end
let(:backreferenced) { Array.new(3) { |i| double(id: i) } }
specify do
expect { DummiesIndex.update_index(backreferenced) }
.to raise_error Chewy::UndefinedUpda... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/index/syncer_spec.rb | spec/chewy/index/syncer_spec.rb | require 'spec_helper'
describe Chewy::Index::Syncer, :orm do
before { drop_indices }
before do
stub_model(:city)
stub_index(:cities) do
index_scope City
field :name
field :updated_at, type: 'date'
end
end
shared_examples 'sync' do |options = {}|
let!(:cities) { Array.new(3) {... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/index/observe/active_record_methods_spec.rb | spec/chewy/index/observe/active_record_methods_spec.rb | require 'spec_helper'
describe Chewy::Index::Observe::ActiveRecordMethods do
describe '.update_index' do
before { stub_model(:city) }
it 'initializes chewy callbacks when first update_index is evaluated' do
expect(City).to receive(:initialize_chewy_callbacks).once
City.update_index 'cities', :se... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/index/observe/callback_spec.rb | spec/chewy/index/observe/callback_spec.rb | require 'spec_helper'
describe Chewy::Index::Observe::Callback do
subject(:callback) { described_class.new(executable) }
before do
stub_model(:city) do
attr_accessor :population
end
end
let(:city) { City.create!(population: 100) }
describe '#call' do
context 'when executable is has arity... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/index/adapter/active_record_spec.rb | spec/chewy/index/adapter/active_record_spec.rb | require 'spec_helper'
RawCity = Struct.new(:id) do
def rating
id * 10
end
end
describe Chewy::Index::Adapter::ActiveRecord, :active_record do
before do
stub_model(:city)
stub_model(:country)
City.belongs_to :country
Country.has_many :cities
end
describe '#name' do
specify { expect(d... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/index/adapter/object_spec.rb | spec/chewy/index/adapter/object_spec.rb | require 'spec_helper'
describe Chewy::Index::Adapter::Object do
before { stub_class(:product) }
subject { described_class.new(:product) }
describe '#name' do
specify { expect(described_class.new('product').name).to eq('Product') }
specify { expect(described_class.new(:products).name).to eq('Products') }... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/index/import/bulk_builder_spec.rb | spec/chewy/index/import/bulk_builder_spec.rb | require 'spec_helper'
SimpleComment = Class.new do
attr_reader :content, :comment_type, :commented_id, :updated_at, :id
def initialize(hash)
@id = hash['id']
@content = hash['content']
@comment_type = hash['comment_type']
@commented_id = hash['commented_id']
@updated_at = hash['updated_at']
... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/index/import/journal_builder_spec.rb | spec/chewy/index/import/journal_builder_spec.rb | require 'spec_helper'
describe Chewy::Index::Import::JournalBuilder, :orm do
before do
stub_model(:country)
stub_index 'namespace/cities'
stub_index 'namespace/countries' do
index_scope Country
end
Timecop.freeze(time)
end
after { Timecop.return }
let(:time) { Time.parse('2017-07-14 ... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/index/import/bulk_request_spec.rb | spec/chewy/index/import/bulk_request_spec.rb | require 'spec_helper'
describe Chewy::Index::Import::BulkRequest do
before { drop_indices }
subject { described_class.new(index, suffix: suffix, bulk_size: bulk_size, **bulk_options) }
let(:suffix) {}
let(:bulk_size) {}
let(:bulk_options) { {} }
let(:index) { PlacesIndex }
describe '#initialize' do
... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/index/import/routine_spec.rb | spec/chewy/index/import/routine_spec.rb | require 'spec_helper'
# TODO: add more specs here later
describe Chewy::Index::Import::Routine do
before { drop_indices }
before do
stub_index(:cities) do
field :name
field :object, type: 'object'
end
CitiesIndex.create!
end
let(:index) { [double('city_1', id: 1, name: 'Name', object: ... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/runtime/version_spec.rb | spec/chewy/runtime/version_spec.rb | require 'spec_helper'
describe Chewy::Runtime::Version do
describe '#major' do
specify { expect(described_class.new('1.2.3').major).to eq(1) }
specify { expect(described_class.new('1.2').major).to eq(1) }
specify { expect(described_class.new(1.2).major).to eq(1) }
specify { expect(described_class.new... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/search/response_spec.rb | spec/chewy/search/response_spec.rb | require 'spec_helper'
describe Chewy::Search::Response, :orm do
before { drop_indices }
before do
stub_model(:city)
stub_model(:country)
stub_index(:cities) do
index_scope City
field :name
field :rating, type: 'integer'
end
stub_index(:countries) do
index_scope Country... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/search/parameters_spec.rb | spec/chewy/search/parameters_spec.rb | require 'spec_helper'
describe Chewy::Search::Parameters do
subject { described_class.new }
describe '.storages' do
specify { expect(described_class.storages[:limit]).to eq(Chewy::Search::Parameters::Limit) }
end
describe '#initialize' do
let(:limit) { described_class.storages[:limit].new(3) }
su... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/search/request_spec.rb | spec/chewy/search/request_spec.rb | require 'spec_helper'
describe Chewy::Search::Request do
before { drop_indices }
before do
stub_index(:products) do
field :id, type: :integer
field :name
field :age, type: :integer
end
stub_index(:cities) do
field :id, type: :integer
end
stub_index(:countries) do
... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | true |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/search/scrolling_spec.rb | spec/chewy/search/scrolling_spec.rb | require 'spec_helper'
describe Chewy::Search::Scrolling, :orm do
before { drop_indices }
before do
stub_model(:city)
stub_model(:country)
stub_index(:cities) do
index_scope City
field :name
field :rating, type: 'integer'
end
stub_index(:countries) do
index_scope Countr... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/search/loader_spec.rb | spec/chewy/search/loader_spec.rb | require 'spec_helper'
describe Chewy::Search::Loader do
before { drop_indices }
before do
stub_model(:city)
stub_model(:country)
stub_index(:cities) do
index_scope City
field :name
field :rating, type: 'integer'
end
stub_index(:countries) do
index_scope Country
... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/search/query_proxy_spec.rb | spec/chewy/search/query_proxy_spec.rb | require 'spec_helper'
describe Chewy::Search::QueryProxy do
before { stub_index(:products) }
let(:request) { Chewy::Search::Request.new(ProductsIndex).query(match: {foo: 'bar'}) }
let(:scope) { Chewy::Search::Request.new(ProductsIndex).query.must_not(match: {foo: 'bar'}) }
subject { described_class.new(:query,... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/search/pagination/kaminari_spec.rb | spec/chewy/search/pagination/kaminari_spec.rb | require 'chewy/search/pagination/kaminari_examples'
describe Chewy::Search::Pagination::Kaminari do
it_behaves_like :kaminari, Chewy::Search::Request do
describe '#objects' do
let(:data) { Array.new(12) { |i| {id: i.next.to_s, name: "Name#{i.next}", age: 10 * i.next}.stringify_keys! } }
before { Pro... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/search/pagination/kaminari_examples.rb | spec/chewy/search/pagination/kaminari_examples.rb | require 'spec_helper'
shared_examples :kaminari do |request_base_class|
before { drop_indices }
before do
stub_index(:products) do
field :name
field :age, type: 'integer'
end
end
let(:except_fields) { %w[_score _explanation] }
let(:request_class) do
Class.new(request_base_class).tap... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/search/parameters/docvalue_fields_spec.rb | spec/chewy/search/parameters/docvalue_fields_spec.rb | require 'chewy/search/parameters/string_array_storage_examples'
describe Chewy::Search::Parameters::DocvalueFields do
it_behaves_like :string_array_storage, :docvalue_fields
end
| ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/search/parameters/load_spec.rb | spec/chewy/search/parameters/load_spec.rb | require 'spec_helper'
describe Chewy::Search::Parameters::Load do
subject { described_class.new(only: :foo) }
describe '#initialize' do
specify { expect(described_class.new.value).to eq({}) }
specify { expect(described_class.new(nil).value).to eq({}) }
specify { expect(described_class.new(scope: {'typ... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/search/parameters/track_total_hits_spec.rb | spec/chewy/search/parameters/track_total_hits_spec.rb | require 'chewy/search/parameters/bool_storage_examples'
describe Chewy::Search::Parameters::TrackTotalHits do
it_behaves_like :bool_storage, :track_total_hits
end
| ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/search/parameters/version_spec.rb | spec/chewy/search/parameters/version_spec.rb | require 'chewy/search/parameters/bool_storage_examples'
describe Chewy::Search::Parameters::Version do
it_behaves_like :bool_storage, :version
end
| ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/search/parameters/source_spec.rb | spec/chewy/search/parameters/source_spec.rb | require 'spec_helper'
describe Chewy::Search::Parameters::Source do
subject { described_class.new(%i[foo bar]) }
describe '#initialize' do
specify { expect(described_class.new.value).to eq(includes: [], excludes: [], enabled: true) }
specify { expect(described_class.new(nil).value).to eq(includes: [], exc... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/search/parameters/request_cache_spec.rb | spec/chewy/search/parameters/request_cache_spec.rb | require 'spec_helper'
describe Chewy::Search::Parameters::RequestCache do
subject { described_class.new(true) }
describe '#initialize' do
specify { expect(subject.value).to eq(true) }
specify { expect(described_class.new.value).to eq(nil) }
specify { expect(described_class.new(42).value).to eq(true) }... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/search/parameters/query_spec.rb | spec/chewy/search/parameters/query_spec.rb | require 'chewy/search/parameters/query_storage_examples'
describe Chewy::Search::Parameters::Query do
it_behaves_like :query_storage, :query
end
| ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/search/parameters/bool_storage_examples.rb | spec/chewy/search/parameters/bool_storage_examples.rb | require 'spec_helper'
shared_examples :bool_storage do |param_name|
subject { described_class.new(true) }
describe '#initialize' do
specify { expect(subject.value).to eq(true) }
specify { expect(described_class.new.value).to eq(false) }
specify { expect(described_class.new(42).value).to eq(true) }
... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/search/parameters/track_scores_spec.rb | spec/chewy/search/parameters/track_scores_spec.rb | require 'chewy/search/parameters/bool_storage_examples'
describe Chewy::Search::Parameters::TrackScores do
it_behaves_like :bool_storage, :track_scores
end
| ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/search/parameters/integer_storage_examples.rb | spec/chewy/search/parameters/integer_storage_examples.rb | require 'spec_helper'
shared_examples :integer_storage do |param_name|
subject { described_class.new(10) }
describe '#initialize' do
specify { expect(described_class.new.value).to be_nil }
specify { expect(described_class.new('42').value).to eq(42) }
specify { expect(described_class.new(33.3).value).t... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/search/parameters/terminate_after_spec.rb | spec/chewy/search/parameters/terminate_after_spec.rb | require 'chewy/search/parameters/integer_storage_examples'
describe Chewy::Search::Parameters::TerminateAfter do
it_behaves_like :integer_storage, :terminate_after
end
| ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/search/parameters/order_spec.rb | spec/chewy/search/parameters/order_spec.rb | require 'spec_helper'
describe Chewy::Search::Parameters::Order do
subject { described_class.new(%i[foo bar]) }
describe '#initialize' do
specify { expect(described_class.new.value).to eq([]) }
specify { expect(described_class.new(nil).value).to eq([]) }
specify { expect(described_class.new('').value)... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/search/parameters/stored_fields_spec.rb | spec/chewy/search/parameters/stored_fields_spec.rb | require 'spec_helper'
describe Chewy::Search::Parameters::StoredFields do
subject { described_class.new(%i[foo bar]) }
describe '#initialize' do
specify { expect(described_class.new.value).to eq(stored_fields: [], enabled: true) }
specify { expect(described_class.new(nil).value).to eq(stored_fields: [], e... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/search/parameters/suggest_spec.rb | spec/chewy/search/parameters/suggest_spec.rb | require 'chewy/search/parameters/hash_storage_examples'
describe Chewy::Search::Parameters::Suggest do
it_behaves_like :hash_storage, :suggest
end
| ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/search/parameters/none_spec.rb | spec/chewy/search/parameters/none_spec.rb | require 'chewy/search/parameters/bool_storage_examples'
describe Chewy::Search::Parameters::None do
it_behaves_like :bool_storage, query: {match_none: {}}
end
| ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/search/parameters/filter_spec.rb | spec/chewy/search/parameters/filter_spec.rb | require 'chewy/search/parameters/query_storage_examples'
describe Chewy::Search::Parameters::Filter do
it_behaves_like :query_storage, :filter
end
| ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/search/parameters/preference_spec.rb | spec/chewy/search/parameters/preference_spec.rb | require 'chewy/search/parameters/string_storage_examples'
describe Chewy::Search::Parameters::Preference do
it_behaves_like :string_storage, :preference
end
| ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/search/parameters/profile_spec.rb | spec/chewy/search/parameters/profile_spec.rb | require 'chewy/search/parameters/bool_storage_examples'
describe Chewy::Search::Parameters::Profile do
it_behaves_like :bool_storage, :profile
end
| ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/search/parameters/timeout_spec.rb | spec/chewy/search/parameters/timeout_spec.rb | require 'chewy/search/parameters/string_storage_examples'
describe Chewy::Search::Parameters::Timeout do
it_behaves_like :string_storage, :timeout
end
| ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/search/parameters/ignore_unavailable_spec.rb | spec/chewy/search/parameters/ignore_unavailable_spec.rb | require 'spec_helper'
describe Chewy::Search::Parameters::IgnoreUnavailable do
subject { described_class.new(true) }
describe '#initialize' do
specify { expect(subject.value).to eq(true) }
specify { expect(described_class.new.value).to eq(nil) }
specify { expect(described_class.new(42).value).to eq(tr... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/search/parameters/search_after_spec.rb | spec/chewy/search/parameters/search_after_spec.rb | require 'spec_helper'
describe Chewy::Search::Parameters::SearchAfter do
subject { described_class.new([:foo, 42]) }
describe '#initialize' do
specify { expect(described_class.new.value).to be_nil }
specify { expect(described_class.new(:foo).value).to eq([:foo]) }
specify { expect(described_class.new(... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/search/parameters/aggs_spec.rb | spec/chewy/search/parameters/aggs_spec.rb | require 'chewy/search/parameters/hash_storage_examples'
describe Chewy::Search::Parameters::Aggs do
it_behaves_like :hash_storage, :aggs
end
| ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/search/parameters/explain_spec.rb | spec/chewy/search/parameters/explain_spec.rb | require 'chewy/search/parameters/bool_storage_examples'
describe Chewy::Search::Parameters::Explain do
it_behaves_like :bool_storage, :explain
end
| ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/search/parameters/hash_storage_examples.rb | spec/chewy/search/parameters/hash_storage_examples.rb | require 'spec_helper'
shared_examples :hash_storage do |param_name|
subject { described_class.new(field: {foo: 'bar'}) }
describe '#initialize' do
specify { expect(described_class.new.value).to eq({}) }
specify { expect(described_class.new(nil).value).to eq({}) }
specify { expect(subject.value).to eq(... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/search/parameters/limit_spec.rb | spec/chewy/search/parameters/limit_spec.rb | require 'chewy/search/parameters/integer_storage_examples'
describe Chewy::Search::Parameters::Limit do
it_behaves_like :integer_storage, :size
end
| ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/search/parameters/query_storage_examples.rb | spec/chewy/search/parameters/query_storage_examples.rb | require 'spec_helper'
shared_examples :query_storage do |param_name|
subject { described_class.new(must: {foo: 'bar'}, should: {moo: 'baz'}) }
describe '#initialize' do
specify do
expect(described_class.new.value.to_h)
.to eq(must: [], should: [], must_not: [], minimum_should_match: nil)
end... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/search/parameters/search_type_spec.rb | spec/chewy/search/parameters/search_type_spec.rb | require 'chewy/search/parameters/string_storage_examples'
describe Chewy::Search::Parameters::SearchType do
it_behaves_like :string_storage, :search_type
end
| ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/search/parameters/rescore_spec.rb | spec/chewy/search/parameters/rescore_spec.rb | require 'spec_helper'
describe Chewy::Search::Parameters::Rescore do
subject { described_class.new([{foo: 42}, {bar: 43}]) }
describe '#initialize' do
specify { expect(described_class.new.value).to eq([]) }
specify { expect(described_class.new(nil).value).to eq([]) }
specify { expect(described_class.n... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/search/parameters/min_score_spec.rb | spec/chewy/search/parameters/min_score_spec.rb | require 'spec_helper'
describe Chewy::Search::Parameters::MinScore do
subject { described_class.new(0.5) }
describe '#initialize' do
specify { expect(described_class.new.value).to be_nil }
specify { expect(described_class.new('1.4').value).to eq(1.4) }
specify { expect(described_class.new(2).value).to... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/search/parameters/string_array_storage_examples.rb | spec/chewy/search/parameters/string_array_storage_examples.rb | require 'spec_helper'
shared_examples :string_array_storage do |param_name|
subject { described_class.new(%i[foo bar]) }
describe '#initialize' do
specify { expect(described_class.new.value).to eq([]) }
specify { expect(described_class.new(nil).value).to eq([]) }
specify { expect(described_class.new(:... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/search/parameters/offset_spec.rb | spec/chewy/search/parameters/offset_spec.rb | require 'chewy/search/parameters/integer_storage_examples'
describe Chewy::Search::Parameters::Offset do
it_behaves_like :integer_storage, :from
end
| ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/search/parameters/highlight_spec.rb | spec/chewy/search/parameters/highlight_spec.rb | require 'chewy/search/parameters/hash_storage_examples'
describe Chewy::Search::Parameters::Highlight do
it_behaves_like :hash_storage, :highlight
end
| ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/search/parameters/knn_spec.rb | spec/chewy/search/parameters/knn_spec.rb | require 'chewy/search/parameters/hash_storage_examples'
describe Chewy::Search::Parameters::Knn do
it_behaves_like :hash_storage, :knn
end
| ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/search/parameters/storage_spec.rb | spec/chewy/search/parameters/storage_spec.rb | require 'spec_helper'
describe Chewy::Search::Parameters::Storage do
subject { described_class.new }
describe '.param_name' do
specify { expect(described_class.param_name).to eq(:storage) }
context do
before { stub_class('Namespace::CustomParamName', Class.new(described_class)) }
specify { ex... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/search/parameters/string_storage_examples.rb | spec/chewy/search/parameters/string_storage_examples.rb | require 'spec_helper'
shared_examples :string_storage do |param_name|
subject { described_class.new(:foo) }
describe '#initialize' do
specify { expect(subject.value).to eq('foo') }
specify { expect(described_class.new(42).value).to eq('42') }
specify { expect(described_class.new('').value).to be_nil }... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/search/parameters/collapse_spec.rb | spec/chewy/search/parameters/collapse_spec.rb | require 'chewy/search/parameters/hash_storage_examples'
describe Chewy::Search::Parameters::Collapse do
it_behaves_like :hash_storage, :collapse
end
| ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/search/parameters/post_filter_spec.rb | spec/chewy/search/parameters/post_filter_spec.rb | require 'chewy/search/parameters/query_storage_examples'
describe Chewy::Search::Parameters::PostFilter do
it_behaves_like :query_storage, :post_filter
end
| ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/search/parameters/script_fields_spec.rb | spec/chewy/search/parameters/script_fields_spec.rb | require 'chewy/search/parameters/hash_storage_examples'
describe Chewy::Search::Parameters::ScriptFields do
it_behaves_like :hash_storage, :script_fields
end
| ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/search/parameters/indices_spec.rb | spec/chewy/search/parameters/indices_spec.rb | require 'spec_helper'
describe Chewy::Search::Parameters::Indices do
before do
stub_index(:first)
stub_index(:second)
stub_index(:third)
end
subject { described_class.new(indices: [FirstIndex, SecondIndex]) }
describe '#initialize' do
specify { expect(described_class.new.value).to eq(indices:... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/strategy/sidekiq_spec.rb | spec/chewy/strategy/sidekiq_spec.rb | require 'spec_helper'
if defined?(Sidekiq)
require 'sidekiq/testing'
describe Chewy::Strategy::Sidekiq do
around do |example|
sidekiq_settings = Chewy.settings[:sidekiq]
Chewy.settings[:sidekiq] = {queue: 'low'}
Chewy.strategy(:bypass) { example.run }
Chewy.settings[:sidekiq] = sidekiq... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/strategy/delayed_sidekiq_spec.rb | spec/chewy/strategy/delayed_sidekiq_spec.rb | require 'spec_helper'
if defined?(Sidekiq)
require 'sidekiq/testing'
require 'redis'
describe Chewy::Strategy::DelayedSidekiq do
around do |example|
Chewy.strategy(:bypass) { example.run }
end
before do
redis = Redis.new
allow(Sidekiq).to receive(:redis).and_yield(redis)
Sid... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/strategy/atomic_no_refresh_spec.rb | spec/chewy/strategy/atomic_no_refresh_spec.rb | require 'spec_helper'
describe Chewy::Strategy::AtomicNoRefresh, :orm do
around { |example| Chewy.strategy(:bypass) { example.run } }
before do
stub_model(:country) do
update_index('countries') { self }
end
stub_index(:countries) do
index_scope Country
end
end
let(:country) { Cou... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/strategy/atomic_spec.rb | spec/chewy/strategy/atomic_spec.rb | require 'spec_helper'
describe Chewy::Strategy::Atomic, :orm do
around { |example| Chewy.strategy(:bypass) { example.run } }
before do
stub_model(:country) do
update_index('countries') { self }
end
stub_index(:countries) do
index_scope Country
end
end
let(:country) { Country.crea... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/strategy/active_job_spec.rb | spec/chewy/strategy/active_job_spec.rb | require 'spec_helper'
if defined?(ActiveJob)
describe Chewy::Strategy::ActiveJob do
around do |example|
active_job_settings = Chewy.settings[:active_job]
Chewy.settings[:active_job] = {queue: 'low'}
Chewy.strategy(:bypass) { example.run }
Chewy.settings[:active_job] = active_job_settings
... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/strategy/lazy_sidekiq_spec.rb | spec/chewy/strategy/lazy_sidekiq_spec.rb | require 'spec_helper'
if defined?(Sidekiq)
require 'sidekiq/testing'
describe Chewy::Strategy::LazySidekiq do
around do |example|
sidekiq_settings = Chewy.settings[:sidekiq]
Chewy.settings[:sidekiq] = {queue: 'low'}
Chewy.strategy(:bypass) { example.run }
Chewy.settings[:sidekiq] = sid... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/fields/time_fields_spec.rb | spec/chewy/fields/time_fields_spec.rb | require 'spec_helper'
describe 'Time fields' do
before { drop_indices }
before do
stub_index(:posts) do
field :published_at, type: 'date'
end
end
before do
PostsIndex.import(
double(published_at: ActiveSupport::TimeZone[-28_800].parse('2014/12/18 19:00')),
double(published_at: A... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/fields/root_spec.rb | spec/chewy/fields/root_spec.rb | require 'spec_helper'
describe Chewy::Fields::Root do
subject(:field) { described_class.new('product') }
describe '#dynamic_template' do
specify do
field.dynamic_template 'hello', type: 'keyword'
field.dynamic_template 'hello*', :integer
field.dynamic_template 'hello.*'
field.dynamic_t... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/spec/chewy/fields/base_spec.rb | spec/chewy/fields/base_spec.rb | require 'spec_helper'
describe Chewy::Fields::Base do
specify { expect(described_class.new('name').name).to eq(:name) }
specify { expect(described_class.new('name', type: 'integer').options[:type]).to eq('integer') }
describe '#compose' do
let(:field) { described_class.new(:name, value: lambda(&:value)) }
... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy.rb | lib/chewy.rb | require 'active_support'
require 'active_support/version'
require 'active_support/concern'
require 'active_support/deprecation'
require 'active_support/json'
require 'active_support/log_subscriber'
require 'active_support/isolated_execution_state' if ActiveSupport::VERSION::MAJOR >= 7
require 'active_support/core_ext/... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/stash.rb | lib/chewy/stash.rb | module Chewy
# This class is the main storage for Chewy service data,
# Now index raw specifications are stored in the `chewy_specifications`
# index.
# Journal entries are stored in `chewy_journal`
#
# @see Chewy::Index::Specification
module Stash
class Specification < Chewy::Index
index_name '... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/repository.rb | lib/chewy/repository.rb | module Chewy
class Repository
include Singleton
attr_reader :analyzers, :tokenizers, :filters, :char_filters
def self.delegated
public_instance_methods - superclass.public_instance_methods - Singleton.public_instance_methods
end
def self.repository(name)
plural_name = name.to_s.plur... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/elastic_client.rb | lib/chewy/elastic_client.rb | module Chewy
# Replacement for Chewy.client
class ElasticClient
def self.build_es_client(configuration = Chewy.configuration)
client_configuration = configuration.deep_dup
client_configuration.delete(:prefix) # used by Chewy, not relevant to Elasticsearch::Client
block = client_configuration[:... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/version.rb | lib/chewy/version.rb | module Chewy
VERSION = '8.0.0-beta'.freeze
end
| ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/log_subscriber.rb | lib/chewy/log_subscriber.rb | module Chewy
class LogSubscriber < ActiveSupport::LogSubscriber
def logger
Chewy.logger
end
def import_objects(event)
render_action('Import', event) { |payload| payload[:import] }
end
def search_query(event)
render_action('Search', event) { |payload| payload[:request] }
end... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/errors.rb | lib/chewy/errors.rb | module Chewy
class Error < StandardError
end
class UndefinedIndex < Error
end
class UndefinedUpdateStrategy < Error
def initialize(_type)
super(<<-MESSAGE)
Index update strategy is undefined for current context.
Please wrap your code with `Chewy.strategy(:strategy_name) block.`
MESSAGE
... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/strategy.rb | lib/chewy/strategy.rb | require 'chewy/strategy/base'
require 'chewy/strategy/bypass'
require 'chewy/strategy/urgent'
require 'chewy/strategy/atomic'
require 'chewy/strategy/atomic_no_refresh'
begin
require 'sidekiq'
require 'chewy/strategy/sidekiq'
require 'chewy/strategy/lazy_sidekiq'
require 'chewy/strategy/delayed_sidekiq'
rescue... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/index.rb | lib/chewy/index.rb | require 'chewy/search'
require 'chewy/index/actions'
require 'chewy/index/adapter/active_record'
require 'chewy/index/adapter/object'
require 'chewy/index/aliases'
require 'chewy/index/crutch'
require 'chewy/index/import'
require 'chewy/index/mapping'
require 'chewy/index/observe'
require 'chewy/index/settings'
require... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/journal.rb | lib/chewy/journal.rb | module Chewy
# A class to perform journal-related actions for the specified indexes/types.
#
# @example
# journal = Chewy::Journal.new('places', UsersIndex)
# journal.apply(20.minutes.ago)
# journal.clean
#
class Journal
# @param only [Array<String, Chewy::Index>] indexes or string references ... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
toptal/chewy | https://github.com/toptal/chewy/blob/fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4/lib/chewy/rake_helper.rb | lib/chewy/rake_helper.rb | module Chewy
module RakeHelper
IMPORT_CALLBACK = lambda do |output, _name, start, finish, _id, payload|
duration = (finish - start).ceil
stats = payload.fetch(:import, {}).map { |key, count| "#{key} #{count}" }.join(', ')
output.puts " Imported #{payload[:index]} in #{human_duration(duration)},... | ruby | MIT | fde2fdc1e009ce8f24f622ee03efc85d2cbe6aa4 | 2026-01-04T16:00:03.341084Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.