Skip to content

Commit

Permalink
Merge pull request #94 from doximity/rails-7.2-compatibility
Browse files Browse the repository at this point in the history
Rails 7.2 compatibility
  • Loading branch information
davidbl authored Dec 4, 2024
2 parents 57cf414 + 033b52a commit 0d79b3a
Show file tree
Hide file tree
Showing 61 changed files with 387 additions and 263 deletions.
405 changes: 246 additions & 159 deletions .circleci/config.yml

Large diffs are not rendered by default.

23 changes: 0 additions & 23 deletions .rubocop.yml

This file was deleted.

4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.2.1] - 2024-12-03
### Changed
- Compatibility with Rails 7.2 and beyond

## [1.1.0] - 2023-05-02
### Changed
- Updated the max elasticsearch dependency version to < 8.7
Expand Down
111 changes: 67 additions & 44 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,32 +1,46 @@
PATH
remote: .
specs:
es-elasticity (1.1.0)
activemodel (>= 5.2.0, < 7.1)
activerecord (>= 5.2.0, < 7.1)
activesupport (>= 5.2.0, < 7.1)
es-elasticity (1.2.1)
activemodel (>= 5.2.0, < 8)
activerecord (>= 5.2.0, < 8)
activesupport (>= 5.2.0, < 8)
elastic-transport (>= 8.0, < 8.7)
elasticsearch (>= 7, < 8.7)

GEM
remote: https://artifacts.dox.support/repository/gems/
specs:
activemodel (7.0.4.3)
activesupport (= 7.0.4.3)
activerecord (7.0.4.3)
activemodel (= 7.0.4.3)
activesupport (= 7.0.4.3)
activesupport (7.0.4.3)
concurrent-ruby (~> 1.0, >= 1.0.2)
activemodel (7.2.2)
activesupport (= 7.2.2)
activerecord (7.2.2)
activemodel (= 7.2.2)
activesupport (= 7.2.2)
timeout (>= 0.4.0)
activesupport (7.2.2)
base64
benchmark (>= 0.3)
bigdecimal
concurrent-ruby (~> 1.0, >= 1.3.1)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
logger (>= 1.4.2)
minitest (>= 5.1)
tzinfo (~> 2.0)
byebug (11.0.1)
codeclimate-test-reporter (1.0.9)
simplecov (<= 0.13)
coderay (1.1.2)
concurrent-ruby (1.2.2)
diff-lcs (1.3)
securerandom (>= 0.3)
tzinfo (~> 2.0, >= 2.0.5)
base64 (0.2.0)
benchmark (0.4.0)
bigdecimal (3.1.8)
byebug (11.1.3)
codeclimate-test-reporter (1.0.7)
simplecov
coderay (1.1.3)
concurrent-ruby (1.3.4)
connection_pool (2.4.1)
diff-lcs (1.5.1)
docile (1.4.1)
drb (2.2.1)
elastic-transport (8.2.1)
faraday (< 3)
multi_json
Expand All @@ -39,56 +53,65 @@ GEM
faraday-net_http (>= 2.0, < 3.1)
ruby2_keywords (>= 0.0.4)
faraday-net_http (3.0.2)
i18n (1.13.0)
i18n (1.14.6)
concurrent-ruby (~> 1.0)
method_source (0.9.2)
minitest (5.18.0)
logger (1.6.1)
method_source (1.1.0)
minitest (5.25.1)
multi_json (1.15.0)
oj (3.10.0)
pry (0.12.2)
coderay (~> 1.1.0)
method_source (~> 0.9.0)
oj (3.16.7)
bigdecimal (>= 3.0)
ostruct (>= 0.2)
ostruct (0.6.0)
pry (0.14.2)
coderay (~> 1.1)
method_source (~> 1.0)
rake (10.5.0)
redis (4.1.3)
rspec (3.1.0)
rspec-core (~> 3.1.0)
rspec-expectations (~> 3.1.0)
rspec-mocks (~> 3.1.0)
rspec-core (3.1.7)
rspec-support (~> 3.1.0)
rspec-expectations (3.1.2)
rspec (3.13.0)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
rspec-mocks (~> 3.13.0)
rspec-core (3.13.2)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.1.0)
rspec-mocks (3.1.3)
rspec-support (~> 3.1.0)
rspec-support (3.1.2)
rspec-support (~> 3.13.0)
rspec-mocks (3.13.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-support (3.13.1)
rspec_junit_formatter (0.4.1)
rspec-core (>= 2, < 4, != 2.12.0)
ruby2_keywords (0.0.5)
simplecov (0.7.1)
multi_json (~> 1.0)
simplecov-html (~> 0.7.1)
simplecov-html (0.7.1)
securerandom (0.3.1)
simplecov (0.22.0)
docile (~> 1.1)
simplecov-html (~> 0.11)
simplecov_json_formatter (~> 0.1)
simplecov-html (0.13.1)
simplecov_json_formatter (0.1.4)
timecop (0.9.5)
timeout (0.4.2)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)

PLATFORMS
ruby

DEPENDENCIES
bundler (~> 2.3.4)
bundler (~> 2.5)
byebug
codeclimate-test-reporter
es-elasticity!
oj
pry
rake (~> 10.0)
redis
rspec (~> 3.1.0)
rspec (~> 3.13.0)
rspec_junit_formatter
simplecov (~> 0.7.1)
simplecov (~> 0.22.0)
timecop

BUNDLED WITH
2.4.3
2.5.23
12 changes: 6 additions & 6 deletions es-elasticity.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,21 @@ Gem::Specification.new do |spec|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]

spec.add_development_dependency "bundler", "~> 2.3.4"
spec.add_development_dependency "bundler", "~> 2.5"
spec.add_development_dependency "byebug"
spec.add_development_dependency "codeclimate-test-reporter"
spec.add_development_dependency "oj"
spec.add_development_dependency "pry"
spec.add_development_dependency "rake", "~> 10.0"
spec.add_development_dependency "redis"
spec.add_development_dependency "rspec", "~> 3.1.0"
spec.add_development_dependency "rspec", "~> 3.13.0"
spec.add_development_dependency "rspec_junit_formatter"
spec.add_development_dependency "simplecov", "~> 0.7.1"
spec.add_development_dependency "simplecov", "~> 0.22.0"
spec.add_development_dependency "timecop"

spec.add_dependency "activemodel", ">= 5.2.0", "< 7.1"
spec.add_dependency "activerecord", ">= 5.2.0", "< 7.1"
spec.add_dependency "activesupport", ">= 5.2.0", "< 7.1"
spec.add_dependency "activemodel", ">= 5.2.0", "< 8"
spec.add_dependency "activerecord", ">= 5.2.0", "< 8"
spec.add_dependency "activesupport", ">= 5.2.0", "< 8"
spec.add_dependency "elasticsearch", ">= 7", "< 8.7"
spec.add_dependency "elastic-transport", ">= 8.0", "< 8.7"
end
3 changes: 2 additions & 1 deletion lib/elasticity/index_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,9 @@ def merge_settings
end

def warn_deprecated_config
deprecation = ActiveSupport::Deprecation.new("next major release", "es-elasticity")
DEPRECATED_ATTRS.each do |attr|
ActiveSupport::Deprecation.warn(
deprecation.warn(
"#{attr} is deprecated and will be "\
"removed in the next major release."
) if public_send(attr).present?
Expand Down
2 changes: 1 addition & 1 deletion lib/elasticity/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Elasticity
VERSION = "1.1.0"
VERSION = "1.2.1"
end
2 changes: 1 addition & 1 deletion spec/units/document_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def to_document
end

let :strategy do
double(:strategy)
instance_double(Elasticity::Strategies::AliasIndex)
end

before :each do
Expand Down
41 changes: 28 additions & 13 deletions spec/units/multi_search_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,15 @@ def ==(other)
subject.add(:first, Elasticity::Search::Facade.new(client, Elasticity::Search::Definition.new("index_first", "document_first", { search: :first, size: 2 })), documents: klass)
subject.add(:second, Elasticity::Search::Facade.new(client, Elasticity::Search::Definition.new("index_second", "document_second", { search: :second })), documents: klass)

expect(Elasticity.config.client).to receive(:msearch).with(body: [
{ index: "index_first", search: { search: :first, size: 2 } },
{ index: "index_second", search: { search: :second } },
]).and_return(response)
expect(Elasticity.config.client).to receive(:msearch).
with(
hash_including(
body: [
{ index: "index_first", search: { search: :first, size: 2 } },
{ index: "index_second", search: { search: :second } },
]
)
).and_return(response)

expect(Array(subject[:first])).to eq [klass.new(_id: 1, name: "foo"), klass.new(_id: 2, name: "bar")]
expect(Array(subject[:second])).to eq [klass.new(_id: 3, name: "baz")]
Expand All @@ -103,10 +108,15 @@ def ==(other)
subject.add(:first, Elasticity::Search::Facade.new(client, Elasticity::Search::Definition.new("index_first", "document_first", { search: :first, size: 2 })), documents: klass)
subject.add(:second, Elasticity::Search::Facade.new(client, Elasticity::Search::Definition.new("index_second", "document_second", { search: :second })), documents: klass)

expect(Elasticity.config.client).to receive(:msearch).with(search_type: :dfs_query_then_fetch, body: [
{ index: "index_first", search: { search: :first, size: 2 } },
{ index: "index_second", search: { search: :second } },
]).and_return(response)
expect(Elasticity.config.client).to receive(:msearch).
with(
hash_including(
search_type: :dfs_query_then_fetch, body: [
{ index: "index_first", search: { search: :first, size: 2 } },
{ index: "index_second", search: { search: :second } },
]
)
).and_return(response)

expect(Array(subject[:first])).to eq([klass.new(_id: 1, name: "foo"), klass.new(_id: 2, name: "bar")])
end
Expand Down Expand Up @@ -139,11 +149,16 @@ def ==(other)
end

before do
expect(Elasticity.config.client).to receive(:msearch).with(body: [
{ index: "index_first", search: { search: :first, size: 2 } },
{ index: "index_second", search: { search: :second } },
{ index: "index_third", search: { search: :third } },
]).and_return(response)
expect(Elasticity.config.client).to receive(:msearch).
with(
hash_including(
body: [
{ index: "index_first", search: { search: :first, size: 2 } },
{ index: "index_second", search: { search: :second } },
{ index: "index_third", search: { search: :third } },
]
)
).and_return(response)
end

it "raises an error while trying to access the query result" do
Expand Down
Loading

0 comments on commit 0d79b3a

Please # to comment.