mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-01 02:03:22 +00:00
Style numeric predicate use with Rubocop
This commit is contained in:
@@ -22,7 +22,7 @@ FactoryBot.define do
|
||||
shipping_category { DefaultShippingCategory.find_or_create }
|
||||
|
||||
# ensure stock item will be created for this products master
|
||||
before(:create) { create(:stock_location) if Spree::StockLocation.count == 0 }
|
||||
before(:create) { create(:stock_location) if Spree::StockLocation.count.zero? }
|
||||
|
||||
factory :product do
|
||||
transient do
|
||||
|
||||
@@ -15,7 +15,7 @@ FactoryBot.define do
|
||||
option_values { [create(:option_value)] }
|
||||
|
||||
# ensure stock item will be created for this variant
|
||||
before(:create) { create(:stock_location) if Spree::StockLocation.count == 0 }
|
||||
before(:create) { create(:stock_location) if Spree::StockLocation.count.zero? }
|
||||
|
||||
factory :variant do
|
||||
transient do
|
||||
|
||||
@@ -75,7 +75,7 @@ feature '
|
||||
|
||||
def adjustments_in_print_data
|
||||
checkout_adjustments_for(order, exclude: [:line_item]).
|
||||
reject { |a| a.amount == 0 }.
|
||||
reject { |a| a.amount.zero? }.
|
||||
map do |adjustment|
|
||||
[raw(adjustment.label),
|
||||
display_adjustment_amount(adjustment).format(symbol: false, with_currency: false)]
|
||||
|
||||
@@ -186,7 +186,7 @@ module Spree
|
||||
end
|
||||
|
||||
it "has tax included" do
|
||||
expect(adjustment.amount).to be > 0
|
||||
expect(adjustment.amount).to be_positive
|
||||
expect(adjustment.included).to be true
|
||||
end
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ describe InjectionHelper, type: :helper, performance: true do
|
||||
ActiveRecord::Base.connection.query_cache.clear
|
||||
Rails.cache.delete_matched('api\/cached_enterprise_serializer\/enterprises')
|
||||
result = Benchmark.measure { helper.inject_enterprises }
|
||||
results << result.total if i > 0
|
||||
results << result.total if i.positive?
|
||||
puts result
|
||||
end
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ module UIComponentHelper
|
||||
|
||||
def wait_for_ajax
|
||||
counter = 0
|
||||
while page.execute_script("return $.active").to_i > 0
|
||||
while page.execute_script("return $.active").to_i.positive?
|
||||
counter += 1
|
||||
sleep(0.1)
|
||||
raise "AJAX request took longer than 5 seconds." if counter >= 50
|
||||
|
||||
@@ -157,6 +157,6 @@ module WebHelper
|
||||
end
|
||||
|
||||
def wait_for_ajax
|
||||
wait_until { page.evaluate_script("$.active") == 0 }
|
||||
wait_until { page.evaluate_script("$.active").zero? }
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user