From 2e770be979e904e10d3b2ffde09d00296e299bd9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 5 Jun 2024 07:45:16 +0000 Subject: [PATCH 1/2] Update rubocop requirement from 1.63.5 to 1.64.1 Updates the requirements on [rubocop](https://github.com/rubocop/rubocop) to permit the latest version. - [Release notes](https://github.com/rubocop/rubocop/releases) - [Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md) - [Commits](https://github.com/rubocop/rubocop/compare/v1.63.5...v1.64.1) --- updated-dependencies: - dependency-name: rubocop dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- gemfiles/base.gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gemfiles/base.gemfile b/gemfiles/base.gemfile index ed4fbf8f..d537eb66 100644 --- a/gemfiles/base.gemfile +++ b/gemfiles/base.gemfile @@ -6,7 +6,7 @@ gem 'redis', require: false gem 'rspec', '>= 3.7.0' gem 'rspec-collection_matchers' gem 'rspec-its' -gem 'rubocop', '1.63.5' +gem 'rubocop', '1.64.1' gem 'sqlite3', '~> 1.4' gem 'timecop' gem 'unparser' From c7a6c0d15a1f57ef9826ca4aae44fe1030e31980 Mon Sep 17 00:00:00 2001 From: Samuel Ebeagu Date: Thu, 6 Jun 2024 13:40:55 +0100 Subject: [PATCH 2/2] Fix rubocop --- lib/chewy/fields/root.rb | 2 +- spec/chewy/fields/base_spec.rb | 4 ++-- spec/chewy/index/observe/callback_spec.rb | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/chewy/fields/root.rb b/lib/chewy/fields/root.rb index d6e125ba..e821cb9c 100644 --- a/lib/chewy/fields/root.rb +++ b/lib/chewy/fields/root.rb @@ -4,7 +4,7 @@ class Root < Chewy::Fields::Base attr_reader :dynamic_templates, :id def initialize(name, **options) - super(name, **options) + super @value ||= -> { self } @dynamic_templates = [] diff --git a/spec/chewy/fields/base_spec.rb b/spec/chewy/fields/base_spec.rb index bd8149bd..cf82bde2 100644 --- a/spec/chewy/fields/base_spec.rb +++ b/spec/chewy/fields/base_spec.rb @@ -5,7 +5,7 @@ specify { expect(described_class.new('name', type: 'integer').options[:type]).to eq('integer') } describe '#compose' do - let(:field) { described_class.new(:name, value: ->(o) { o.value }) } + let(:field) { described_class.new(:name, value: lambda(&:value)) } specify { expect(field.compose(double(value: 'hello'))).to eq(name: 'hello') } specify { expect(field.compose(double(value: %w[hello world]))).to eq(name: %w[hello world]) } @@ -23,7 +23,7 @@ context 'nested fields' do before do - field.children.push(described_class.new(:subname1, value: ->(o) { o.subvalue1 })) + field.children.push(described_class.new(:subname1, value: lambda(&:subvalue1))) field.children.push(described_class.new(:subname2, value: -> { subvalue2 })) field.children.push(described_class.new(:subname3)) end diff --git a/spec/chewy/index/observe/callback_spec.rb b/spec/chewy/index/observe/callback_spec.rb index 825e3b40..84cd6219 100644 --- a/spec/chewy/index/observe/callback_spec.rb +++ b/spec/chewy/index/observe/callback_spec.rb @@ -21,7 +21,7 @@ end context 'when executable is has arity 1' do - let(:executable) { ->(record) { record.population } } + let(:executable) { lambda(&:population) } it 'calls exectuable within context' do expect(callback.call(city)).to eq(city.population)