Sha256: 502fb0cbd206a0a609ff87aefa142fe2a3b6e89043832461f7f4119845f77278

Contents?: true

Size: 791 Bytes

Versions: 32

Compression:

Stored size: 791 Bytes

Contents

require 'spec_helper'

module Spree
  describe Order, type: :model do
    let(:order) { create(:order) }
    let(:shirt) { create(:variant) }

    context "adds item to cart and activates promo" do
      let(:promotion) { Promotion.create name: 'Huhu', apply_automatically: true }
      let(:calculator) { Calculator::FlatPercentItemTotal.new(preferred_flat_percent: 10) }
      let!(:action) { Promotion::Actions::CreateAdjustment.create(promotion: promotion, calculator: calculator) }

      before { order.contents.add(shirt, 1) }

      context "item quantity changes" do
        it "recalculates order adjustments" do
          expect {
            order.contents.add(shirt, 3)
          }.to change { order.adjustments.eligible.pluck(:amount) }
        end
      end
    end
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
solidus_core-2.3.1 spec/models/spree/order/totals_spec.rb
solidus_core-2.2.2 spec/models/spree/order/totals_spec.rb
solidus_core-2.1.1 spec/models/spree/order/totals_spec.rb
solidus_core-2.0.3 spec/models/spree/order/totals_spec.rb
solidus_core-1.4.2 spec/models/spree/order/totals_spec.rb
solidus_core-1.3.2 spec/models/spree/order/totals_spec.rb
solidus_core-2.3.0 spec/models/spree/order/totals_spec.rb
solidus_core-2.3.0.rc3 spec/models/spree/order/totals_spec.rb
solidus_core-2.3.0.rc2 spec/models/spree/order/totals_spec.rb
solidus_core-2.3.0.rc1 spec/models/spree/order/totals_spec.rb
solidus_core-2.3.0.beta1 spec/models/spree/order/totals_spec.rb
solidus_core-2.0.2 spec/models/spree/order/totals_spec.rb
solidus_core-1.4.1 spec/models/spree/order/totals_spec.rb
solidus_core-2.2.1 spec/models/spree/order/totals_spec.rb
solidus_core-2.2.0 spec/models/spree/order/totals_spec.rb
solidus_core-2.2.0.rc1 spec/models/spree/order/totals_spec.rb
solidus_core-2.2.0.beta1 spec/models/spree/order/totals_spec.rb
solidus_core-2.1.0 spec/models/spree/order/totals_spec.rb
solidus_core-2.1.0.rc1 spec/models/spree/order/totals_spec.rb
solidus_core-2.0.1 spec/models/spree/order/totals_spec.rb