Sha256: bacc423ab83c454fd4813e01515a2eea298f65e51803ce273ef6cb803baa4759

Contents?: true

Size: 938 Bytes

Versions: 70

Compression:

Stored size: 938 Bytes

Contents

require 'spec_helper'

describe Spree::ReturnItem::EligibilityValidator::OrderCompleted do
  let(:inventory_unit) { create(:inventory_unit, order: order) }
  let(:return_item)    { create(:return_item, inventory_unit: inventory_unit) }
  let(:validator)      { Spree::ReturnItem::EligibilityValidator::OrderCompleted.new(return_item) }

  describe "#eligible_for_return?" do
    subject { validator.eligible_for_return? }

    context "the order was completed" do
      let(:order) { create(:completed_order_with_totals) }

      it "returns true" do
        expect(subject).to be true
      end
    end

    context "the order is not completed" do
      let(:order) { create(:order) }

      it "returns false" do
        expect(subject).to be false
      end

      it "sets an error" do
        subject
        expect(validator.errors[:order_not_completed]).to eq Spree.t('return_item_order_not_completed')
      end
    end
  end
end

Version data entries

70 entries across 70 versions & 2 rubygems

Version Path
solidus_core-2.2.0.beta1 spec/models/spree/return_item/eligibility_validator/order_completed_spec.rb
spree_core-3.1.5 spec/models/spree/return_item/eligibility_validator/order_completed_spec.rb
spree_core-3.2.1 spec/models/spree/return_item/eligibility_validator/order_completed_spec.rb
spree_core-3.2.0 spec/models/spree/return_item/eligibility_validator/order_completed_spec.rb
spree_core-3.1.4 spec/models/spree/return_item/eligibility_validator/order_completed_spec.rb
spree_core-3.2.0.rc3 spec/models/spree/return_item/eligibility_validator/order_completed_spec.rb
solidus_core-2.1.0 spec/models/spree/return_item/eligibility_validator/order_completed_spec.rb
solidus_core-2.1.0.rc1 spec/models/spree/return_item/eligibility_validator/order_completed_spec.rb
solidus_core-2.0.1 spec/models/spree/return_item/eligibility_validator/order_completed_spec.rb
spree_core-3.2.0.rc2 spec/models/spree/return_item/eligibility_validator/order_completed_spec.rb
spree_core-3.2.0.rc1 spec/models/spree/return_item/eligibility_validator/order_completed_spec.rb
solidus_core-2.1.0.beta1 spec/models/spree/return_item/eligibility_validator/order_completed_spec.rb
spree_core-3.1.3 spec/models/spree/return_item/eligibility_validator/order_completed_spec.rb
spree_core-3.1.2 spec/models/spree/return_item/eligibility_validator/order_completed_spec.rb
solidus_core-2.0.0 spec/models/spree/return_item/eligibility_validator/order_completed_spec.rb
solidus_core-1.4.0 spec/models/spree/return_item/eligibility_validator/order_completed_spec.rb
solidus_core-2.0.0.rc1 spec/models/spree/return_item/eligibility_validator/order_completed_spec.rb
solidus_core-1.4.0.rc1 spec/models/spree/return_item/eligibility_validator/order_completed_spec.rb
solidus_core-2.0.0.beta1 spec/models/spree/return_item/eligibility_validator/order_completed_spec.rb
solidus_core-1.4.0.beta1 spec/models/spree/return_item/eligibility_validator/order_completed_spec.rb