Sha256: a554ce2aceb1eb52cd78df681275f5f79e958f99efc5f5a56d89d5eae3beb8ad

Contents?: true

Size: 1.06 KB

Versions: 32

Compression:

Stored size: 1.06 KB

Contents

require 'spec_helper'
require 'spree/testing_support/factories/customer_return_factory'

RSpec.describe 'customer return factory' do
  let(:factory_class) { Spree::CustomerReturn }

  describe 'customer return' do
    let(:factory) { :customer_return }

    it_behaves_like 'a working factory'

    # Regression test for https://github.com/solidusio/solidus/pull/697
    it "creates only one of dependent records" do
      create(:customer_return, line_items_count: 2)
      aggregate_failures "items created" do
        expect(Spree::Order.count).to eq(1)
        expect(Spree::ReturnAuthorization.count).to eq(1)
      end
    end
  end

  describe 'customer return with accepted items' do
    let(:factory) { :customer_return_with_accepted_items }

    it_behaves_like 'a working factory'
  end

  describe 'customer return without return items' do
    let(:factory) { :customer_return_without_return_items }

    it "builds successfully" do
      expect(build(factory)).to be_a(factory_class)
    end

    # No create test, because this factory is (intentionally) invalid
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
solidus_core-2.3.1 spec/lib/spree/core/testing_support/factories/customer_return_factory_spec.rb
solidus_core-2.2.2 spec/lib/spree/core/testing_support/factories/customer_return_factory_spec.rb
solidus_core-2.1.1 spec/lib/spree/core/testing_support/factories/customer_return_factory_spec.rb
solidus_core-2.0.3 spec/lib/spree/core/testing_support/factories/customer_return_factory_spec.rb
solidus_core-1.4.2 spec/lib/spree/core/testing_support/factories/customer_return_factory_spec.rb
solidus_core-1.3.2 spec/lib/spree/core/testing_support/factories/customer_return_factory_spec.rb
solidus_core-2.3.0 spec/lib/spree/core/testing_support/factories/customer_return_factory_spec.rb
solidus_core-2.3.0.rc3 spec/lib/spree/core/testing_support/factories/customer_return_factory_spec.rb
solidus_core-2.3.0.rc2 spec/lib/spree/core/testing_support/factories/customer_return_factory_spec.rb
solidus_core-2.3.0.rc1 spec/lib/spree/core/testing_support/factories/customer_return_factory_spec.rb
solidus_core-2.3.0.beta1 spec/lib/spree/core/testing_support/factories/customer_return_factory_spec.rb
solidus_core-2.0.2 spec/lib/spree/core/testing_support/factories/customer_return_factory_spec.rb
solidus_core-1.4.1 spec/lib/spree/core/testing_support/factories/customer_return_factory_spec.rb
solidus_core-2.2.1 spec/lib/spree/core/testing_support/factories/customer_return_factory_spec.rb
solidus_core-2.2.0 spec/lib/spree/core/testing_support/factories/customer_return_factory_spec.rb
solidus_core-2.2.0.rc1 spec/lib/spree/core/testing_support/factories/customer_return_factory_spec.rb
solidus_core-2.2.0.beta1 spec/lib/spree/core/testing_support/factories/customer_return_factory_spec.rb
solidus_core-2.1.0 spec/lib/spree/core/testing_support/factories/customer_return_factory_spec.rb
solidus_core-2.1.0.rc1 spec/lib/spree/core/testing_support/factories/customer_return_factory_spec.rb
solidus_core-2.0.1 spec/lib/spree/core/testing_support/factories/customer_return_factory_spec.rb