mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Use ruboccop autocorrect to fix issues
This commit is contained in:
@@ -127,7 +127,7 @@ class CartService
|
||||
li = line_item_for_variant loaded_variant
|
||||
|
||||
li_added = li.nil? && (variant_data[:quantity].to_i > 0 || variant_data[:max_quantity].to_i > 0)
|
||||
li_quantity_changed = li.present? && li.quantity.to_i != variant_data[:quantity].to_i
|
||||
li_quantity_changed = li.present? && li.quantity.to_i != variant_data[:quantity].to_i
|
||||
li_max_quantity_changed = li.present? && li.max_quantity.to_i != variant_data[:max_quantity].to_i
|
||||
|
||||
li_added || li_quantity_changed || li_max_quantity_changed
|
||||
|
||||
@@ -69,7 +69,6 @@ module Api
|
||||
|
||||
it "retrieves a list of orders with appropriate attributes,
|
||||
including line items with appropriate attributes" do
|
||||
|
||||
returns_orders(json_response)
|
||||
end
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ RSpec.describe OpenFoodNetwork::OrdersAndFulfillmentsReport::CustomerTotalsRepor
|
||||
context "viewing the report" do
|
||||
let!(:order) do
|
||||
create(:completed_order_with_totals, line_items_count: 1, user: customer.user,
|
||||
customer: customer, distributor: distributor)
|
||||
customer: customer, distributor: distributor)
|
||||
end
|
||||
|
||||
it "generates the report" do
|
||||
@@ -65,7 +65,7 @@ RSpec.describe OpenFoodNetwork::OrdersAndFulfillmentsReport::CustomerTotalsRepor
|
||||
}
|
||||
let!(:order) do
|
||||
create(:completed_order_with_totals, line_items_count: 1, user: customer.user,
|
||||
customer: customer, distributor: distributor)
|
||||
customer: customer, distributor: distributor)
|
||||
end
|
||||
|
||||
before do
|
||||
@@ -82,7 +82,7 @@ RSpec.describe OpenFoodNetwork::OrdersAndFulfillmentsReport::CustomerTotalsRepor
|
||||
context 'when a variant override applies' do
|
||||
let!(:order) do
|
||||
create(:completed_order_with_totals, line_items_count: 1, user: customer.user,
|
||||
customer: customer, distributor: distributor)
|
||||
customer: customer, distributor: distributor)
|
||||
end
|
||||
let(:overidden_sku) { 'magical_sku' }
|
||||
|
||||
|
||||
@@ -18,10 +18,10 @@ module Spree
|
||||
|
||||
failure_message do |user|
|
||||
ability_hash, options = expected
|
||||
ability_hash = { ability_hash => true } if ability_hash.is_a? Symbol # e.g.: :create
|
||||
ability_hash = ability_hash.inject({}){ |_, i| _.merge(i => true) } if ability_hash.is_a? Array # e.g.: [:create, :read] => {:create=>true, :read=>true}
|
||||
target = options[:for]
|
||||
message = "expected User:#{user} to have ability:#{ability_hash} for #{target}, but actual result is #{@ability_result}"
|
||||
ability_hash = { ability_hash => true } if ability_hash.is_a? Symbol # e.g.: :create
|
||||
ability_hash = ability_hash.inject({}){ |_, i| _.merge(i => true) } if ability_hash.is_a? Array # e.g.: [:create, :read] => {:create=>true, :read=>true}
|
||||
target = options[:for]
|
||||
message = "expected User:#{user} to have ability:#{ability_hash} for #{target}, but actual result is #{@ability_result}"
|
||||
end
|
||||
|
||||
# to clean up output of RSpec Documentation format
|
||||
|
||||
Reference in New Issue
Block a user