Sha256: a441fa14cb32f652af6cef68fd08ede3b37a259b8c70f5d7deb023748fea3cb0

Contents?: true

Size: 1.15 KB

Versions: 14

Compression:

Stored size: 1.15 KB

Contents

# frozen_string_literal: true

require 'rails_helper'
require 'spree/testing_support/factories/shipping_method_factory'

RSpec.describe 'shipping method factory' do
  let(:factory_class) { Spree::ShippingMethod }

  describe 'plain shipping method' do
    let(:factory) { :shipping_method }

    it_behaves_like 'a working factory'

    it "should set calculable correctly" do
      shipping_method = create(factory)
      expect(shipping_method.calculator.calculable).to eq(shipping_method)
    end

    context 'store using alternate currency' do
      before { stub_spree_preferences(currency: 'CAD') }

      it "should configure the calculator correctly" do
        shipping_method = create(factory)
        expect(shipping_method.calculator.preferences[:currency]).to eq('CAD')
      end
    end
  end

  describe 'base shipping method' do
    let(:factory) { :base_shipping_method }

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

    # No test for create, as that is not intended somehow
  end

  describe 'free shipping method' do
    let(:factory) { :free_shipping_method }

    it_behaves_like 'a working factory'
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
solidus_core-2.10.5 spec/lib/spree/core/testing_support/factories/shipping_method_factory_spec.rb
solidus_core-2.10.3 spec/lib/spree/core/testing_support/factories/shipping_method_factory_spec.rb
solidus_core-2.10.2 spec/lib/spree/core/testing_support/factories/shipping_method_factory_spec.rb
solidus_core-2.9.6 spec/lib/spree/core/testing_support/factories/shipping_method_factory_spec.rb
solidus_core-2.10.1 spec/lib/spree/core/testing_support/factories/shipping_method_factory_spec.rb
solidus_core-2.9.5 spec/lib/spree/core/testing_support/factories/shipping_method_factory_spec.rb
solidus_core-2.10.0 spec/lib/spree/core/testing_support/factories/shipping_method_factory_spec.rb
solidus_core-2.9.4 spec/lib/spree/core/testing_support/factories/shipping_method_factory_spec.rb
solidus_core-2.9.3 spec/lib/spree/core/testing_support/factories/shipping_method_factory_spec.rb
solidus_core-2.9.2 spec/lib/spree/core/testing_support/factories/shipping_method_factory_spec.rb
solidus_core-2.10.0.beta1 spec/lib/spree/core/testing_support/factories/shipping_method_factory_spec.rb
solidus_core-2.9.1 spec/lib/spree/core/testing_support/factories/shipping_method_factory_spec.rb
solidus_core-2.9.0 spec/lib/spree/core/testing_support/factories/shipping_method_factory_spec.rb
solidus_core-2.9.0.rc.1 spec/lib/spree/core/testing_support/factories/shipping_method_factory_spec.rb