diff --git a/app/services/cart_service.rb b/app/services/cart_service.rb index 9df85cfe45..d46e2478ca 100644 --- a/app/services/cart_service.rb +++ b/app/services/cart_service.rb @@ -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 diff --git a/spec/controllers/api/orders_controller_spec.rb b/spec/controllers/api/orders_controller_spec.rb index 69438ec2da..4189ccc650 100644 --- a/spec/controllers/api/orders_controller_spec.rb +++ b/spec/controllers/api/orders_controller_spec.rb @@ -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 diff --git a/spec/lib/open_food_network/orders_and_fulfillments_report/customer_totals_report_spec.rb b/spec/lib/open_food_network/orders_and_fulfillments_report/customer_totals_report_spec.rb index 8bf50cf6d0..6bae6da8a1 100644 --- a/spec/lib/open_food_network/orders_and_fulfillments_report/customer_totals_report_spec.rb +++ b/spec/lib/open_food_network/orders_and_fulfillments_report/customer_totals_report_spec.rb @@ -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' } diff --git a/spec/support/cancan_helper.rb b/spec/support/cancan_helper.rb index 332c93a19f..c1f59e54cc 100644 --- a/spec/support/cancan_helper.rb +++ b/spec/support/cancan_helper.rb @@ -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