Skip to content

Commit

Permalink
Merge pull request #12491 from openfoodfoundation/dependabot/bundler/…
Browse files Browse the repository at this point in the history
…rubocop-rails-2.25.0

chore(deps-dev): bump rubocop-rails from 2.24.1 to 2.28.0
  • Loading branch information
mkllnk authored Jan 10, 2025
2 parents 7f2266e + f8788d3 commit e2bc86f
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 18 deletions.
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion app/models/invoice.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ def display_number
end

def previous_invoice
order.invoices.where("id < ?", id).first
order.invoices.where(id: ...id).first
end
end
6 changes: 3 additions & 3 deletions app/models/order_cycle.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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') }
Expand Down
4 changes: 2 additions & 2 deletions app/models/spree/address.rb
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def address_part2
end

def address_and_city
[address1, address2, city].select(&:present?).join(' ')
[address1, address2, city].compact_blank.join(' ')
end

private
Expand Down Expand Up @@ -176,7 +176,7 @@ def touch_enterprise
end

def render_address(parts)
parts.select(&:present?).join(', ')
parts.compact_blank.join(', ')
end
end
end
2 changes: 1 addition & 1 deletion app/services/address_geocoder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def geocode
attr_reader :address

def geocode_address
address_parts.select(&:present?).join(', ')
address_parts.compact_blank.join(', ')
end

def address_parts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,7 @@ def not_closed_in_range_order_cycles
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
Expand Down
6 changes: 3 additions & 3 deletions lib/tasks/data/remove_transient_data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ def initialize
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
Expand Down
2 changes: 1 addition & 1 deletion spec/base_spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

# 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ module OrdersAndFulfillment
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
Expand Down Expand Up @@ -84,7 +84,7 @@ module OrdersAndFulfillment
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")
Expand Down

0 comments on commit e2bc86f

Please sign in to comment.