diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index cff25599..e70bcb10 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2024-09-13 15:45:46 UTC using RuboCop version 1.27.0. +# on 2025-03-08 11:51:39 UTC using RuboCop version 1.27.0. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new @@ -8,16 +8,17 @@ # Offense count: 1 # This cop supports safe auto-correction (--auto-correct). -# Configuration parameters: Include. -# Include: **/*.gemspec -Gemspec/RequireMFA: +# Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation, Include. +# Include: **/*.gemfile, **/Gemfile, **/gems.rb +Bundler/OrderedGems: Exclude: - - 'meilisearch-rails.gemspec' + - 'Gemfile' # Offense count: 1 +# This cop supports safe auto-correction (--auto-correct). # Configuration parameters: Include. # Include: **/*.gemspec -Gemspec/RequiredRubyVersion: +Gemspec/RequireMFA: Exclude: - 'meilisearch-rails.gemspec' @@ -29,6 +30,13 @@ Layout/EmptyLinesAroundModuleBody: Exclude: - 'lib/meilisearch-rails.rb' +# Offense count: 2 +# This cop supports safe auto-correction (--auto-correct). +# Configuration parameters: IndentationWidth. +# SupportedStyles: special_inside_parentheses, consistent, align_brackets +Layout/FirstArrayElementIndentation: + EnforcedStyle: consistent + # Offense count: 1 # This cop supports safe auto-correction (--auto-correct). # Configuration parameters: EnforcedStyle. @@ -65,10 +73,10 @@ Lint/UnusedMethodArgument: Exclude: - 'lib/meilisearch-rails.rb' -# Offense count: 12 +# Offense count: 13 # Configuration parameters: IgnoredMethods, CountRepeatedAttributes. Metrics/AbcSize: - Max: 103 + Max: 105 # Offense count: 1 # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods. @@ -84,9 +92,9 @@ Metrics/ClassLength: # Offense count: 9 # Configuration parameters: IgnoredMethods. Metrics/CyclomaticComplexity: - Max: 27 + Max: 28 -# Offense count: 19 +# Offense count: 20 # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods. Metrics/MethodLength: Max: 102 @@ -99,7 +107,7 @@ Metrics/ModuleLength: # Offense count: 8 # Configuration parameters: IgnoredMethods. Metrics/PerceivedComplexity: - Max: 34 + Max: 35 # Offense count: 1 Naming/AccessorMethodName: @@ -138,7 +146,7 @@ RSpec/ContextWording: - 'spec/options_spec.rb' - 'spec/system/tech_shop_spec.rb' -# Offense count: 55 +# Offense count: 57 # Configuration parameters: CountAsOne. RSpec/ExampleLength: Max: 16 @@ -176,6 +184,13 @@ RSpec/VerifiedDoubles: Exclude: - 'spec/configuration_spec.rb' +# Offense count: 1 +# Configuration parameters: ForbiddenMethods, AllowedMethods. +# ForbiddenMethods: decrement!, decrement_counter, increment!, increment_counter, insert, insert!, insert_all, insert_all!, toggle!, touch, touch_all, update_all, update_attribute, update_column, update_columns, update_counters, upsert, upsert_all +Rails/SkipsModelValidations: + Exclude: + - 'spec/settings_spec.rb' + # Offense count: 2 # This cop supports safe auto-correction (--auto-correct). # Configuration parameters: EnforcedStyle. diff --git a/lib/meilisearch-rails.rb b/lib/meilisearch-rails.rb index a27b03a8..c8dda0eb 100644 --- a/lib/meilisearch-rails.rb +++ b/lib/meilisearch-rails.rb @@ -415,7 +415,7 @@ def meilisearch(options = {}, &block) raise ArgumentError, "Invalid `enqueue` option: #{options[:enqueue]}" end meilisearch_options[:enqueue] = proc do |record, remove| - proc.call(record, remove) unless ms_without_auto_index_scope + proc.call(record, remove) if ::MeiliSearch::Rails.active? && !ms_without_auto_index_scope end end unless options[:auto_index] == false diff --git a/spec/meilisearch/activation_spec.rb b/spec/meilisearch/activation_spec.rb index e81a08a0..9a9a7a27 100644 --- a/spec/meilisearch/activation_spec.rb +++ b/spec/meilisearch/activation_spec.rb @@ -1,3 +1,5 @@ +require 'support/models/queued_models' + describe MeiliSearch::Rails do it 'is active by default' do expect(described_class).to be_active @@ -16,6 +18,12 @@ it 'responds with a black hole' do expect(described_class.client.foo.bar.now.nil.item.issue).to be_nil end + + it 'does not queue tasks' do + expect do + EnqueuedDocument.create! name: 'hello world' + end.not_to raise_error + end end context 'with a block' do