Merge pull request #12491 from openfoodfoundation/dependabot/bundler/rubocop-rails-2.25.0

chore(deps-dev): bump rubocop-rails from 2.24.1 to 2.28.0
This commit is contained in:
Maikel
2025-01-10 13:03:25 +11:00
committed by GitHub
9 changed files with 16 additions and 18 deletions

View File

@@ -683,10 +683,10 @@ GEM
rubocop (~> 1.41)
rubocop-factory_bot (2.25.1)
rubocop (~> 1.41)
rubocop-rails (2.24.1)
rubocop-rails (2.28.0)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 1.33.0, < 2.0)
rubocop (>= 1.52.0, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rspec (2.29.2)
rubocop (~> 1.40)

View File

@@ -32,6 +32,6 @@ class Invoice < ApplicationRecord
end
def previous_invoice
order.invoices.where("id < ?", id).first
order.invoices.where(id: ...id).first
end
end

View File

@@ -53,7 +53,7 @@ class OrderCycle < ApplicationRecord
Time.zone.now,
Time.zone.now)
}
scope :active_or_complete, lambda { where('order_cycles.orders_open_at <= ?', Time.zone.now) }
scope :active_or_complete, lambda { where(order_cycles: { orders_open_at: ..Time.zone.now }) }
scope :inactive, lambda {
where('order_cycles.orders_open_at > ? OR order_cycles.orders_close_at < ?',
Time.zone.now,
@@ -64,8 +64,8 @@ class OrderCycle < ApplicationRecord
where('order_cycles.orders_close_at > ? OR order_cycles.orders_close_at IS NULL', Time.zone.now)
}
scope :closed, lambda {
where('order_cycles.orders_close_at < ?',
Time.zone.now).order("order_cycles.orders_close_at DESC")
where(order_cycles: { orders_close_at: ...Time.zone.now })
.order("order_cycles.orders_close_at DESC")
}
scope :unprocessed, -> { where(processed_at: nil) }
scope :undated, -> { where('order_cycles.orders_open_at IS NULL OR orders_close_at IS NULL') }

View File

@@ -126,7 +126,7 @@ module Spree
end
def address_and_city
[address1, address2, city].select(&:present?).join(' ')
[address1, address2, city].compact_blank.join(' ')
end
private
@@ -176,7 +176,7 @@ module Spree
end
def render_address(parts)
parts.select(&:present?).join(', ')
parts.compact_blank.join(', ')
end
end
end

View File

@@ -18,7 +18,7 @@ class AddressGeocoder
attr_reader :address
def geocode_address
address_parts.select(&:present?).join(', ')
address_parts.compact_blank.join(', ')
end
def address_parts

View File

@@ -90,9 +90,7 @@ module OrderManagement
end
def in_range_order_cycles
order_cycles.where("orders_close_at >= ? AND orders_close_at <= ?",
begins_at,
ends_at || 100.years.from_now)
order_cycles.where(orders_close_at: begins_at..ends_at)
end
end
end

View File

@@ -18,9 +18,9 @@ class RemoveTransientData
def call
Rails.logger.info("#{self.class.name}: processing")
Spree::StateChange.where("created_at < ?", expiration_date).delete_all
Spree::LogEntry.where("created_at < ?", expiration_date).delete_all
Session.where("updated_at < ?", expiration_date).delete_all
Spree::StateChange.where(created_at: ...expiration_date).delete_all
Spree::LogEntry.where(created_at: ...expiration_date).delete_all
Session.where(updated_at: ...expiration_date).delete_all
clear_old_cart_data!
end

View File

@@ -44,7 +44,7 @@ WebMock.disable_net_connect!(
# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
Dir[Rails.root.join("spec/support/**/*.rb")].sort.each { |f| require f }
Rails.root.glob("spec/support/**/*.rb").sort.each { |f| require f }
Capybara.server = :puma
Capybara.disable_animation = true

View File

@@ -37,7 +37,7 @@ module Reporting
order.line_items[0].variant.product.update(name: "Cucumber")
order.line_items[1].variant.product.update(name: "Apple")
order.line_items[2].variant.product.update(name: "Banane")
product_names = report.rows.map(&:product).filter(&:present?)
product_names = report.rows.map(&:product).compact_blank
expect(product_names).to eq(["Apple", "Banane", "Cucumber"])
end
end
@@ -84,7 +84,7 @@ module Reporting
order.line_items[0].variant.product.update(name: "Cucumber")
order.line_items[1].variant.product.update(name: "Apple")
order.line_items[2].variant.product.update(name: "Banane")
product_names = report.rows.map(&:product).filter(&:present?)
product_names = report.rows.map(&:product).compact_blank
# only the supplier's variant is displayed
expect(product_names).to include("Cucumber")
expect(product_names).not_to include("Apple", "Banane")