Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 27 additions & 12 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
# 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
# versions of RuboCop, may require this file to be generated again.

# 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'

Expand All @@ -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.
Expand Down Expand Up @@ -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.
Expand All @@ -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
Expand All @@ -99,7 +107,7 @@ Metrics/ModuleLength:
# Offense count: 8
# Configuration parameters: IgnoredMethods.
Metrics/PerceivedComplexity:
Max: 34
Max: 35

# Offense count: 1
Naming/AccessorMethodName:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion lib/meilisearch-rails.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions spec/meilisearch/activation_spec.rb
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down