Sha256: 6b329b8a433f1d8e58339a7084c75648ae309898a6cf64a385b97d88e8e40985

Contents?: true

Size: 957 Bytes

Versions: 1

Compression:

Stored size: 957 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'

describe SolidusAfterpay::ShippingRatePresenter do
  let(:order) { create(:order_with_line_items ) }
  let(:shipment) { create(:shipment, order: order) }
  let(:shipping_rate) { create(:shipping_rate, cost: 5, shipment: shipment) }
  let(:shipping_rate_tax) { ::Spree::ShippingRateTax.create(amount: 0.75, shipping_rate: shipping_rate) }

  before { shipping_rate.taxes << shipping_rate_tax }

  describe '#order_amount' do
    subject(:order_amount) { described_class.new(shipping_rate: shipping_rate).order_amount }

    it 'returns the order total including the shipping rate' do
      expect(order_amount.to_f).to eq(15.75)
    end
  end

  describe '#amount_with_taxes' do
    subject(:amount_with_taxes) { described_class.new(shipping_rate: shipping_rate).amount_with_taxes }

    it 'returns the total amount including taxes' do
      expect(amount_with_taxes.to_f).to eq(5.75)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
solidus_afterpay-0.2.0 spec/presenters/solidus_afterpay/shipping_rate_presenter_spec.rb