Sha256: 92166df95782642f8a9b89dd0faad14903241a73bb8f1d4ad4adc760297de94d
Contents?: true
Size: 1.21 KB
Versions: 1
Compression:
Stored size: 1.21 KB
Contents
# frozen_string_literal: true RSpec.describe SolidusEasypost::Calculator::WeightDimensionCalculator do describe '#compute' do subject(:compute) { described_class.new.compute(resource) } context 'when a wrong resource is passed' do let(:resource) { create(:shipment) } it 'raises an unknown partial resource error' do expect { compute }.to raise_error(SolidusEasypost::Errors::UnknownPartialResourceError) end end context 'when a Spree::Stock::Package is passed' do let(:resource) { create(:shipment).to_package } before { allow(SolidusEasypost::ParcelDimension).to receive(:new) } it 'build a parcel dimension' do compute expect(SolidusEasypost::ParcelDimension).to have_received(:new).with({ weight: 10.to_f }) end end context 'when a SolidusEasypost::ReturnAuthorization is passed' do let(:resource) { SolidusEasypost::ReturnAuthorization.new(create(:return_authorization)) } before { allow(SolidusEasypost::ParcelDimension).to receive(:new) } it 'build a parcel dimension' do compute expect(SolidusEasypost::ParcelDimension).to have_received(:new).with({ weight: 0.to_f }) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
solidus_easypost-3.0.0 | spec/solidus_easypost/calculator/weight_dimension_calculator_spec.rb |