Sha256: b5006be12c8e396ff5a36e7797b8f652f300c345209e52a065a6bb962a337122

Contents?: true

Size: 972 Bytes

Versions: 1

Compression:

Stored size: 972 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'

describe SolidusAfterpay::OrderPresenter do
  describe '#line_items_tax_amount' do
    subject(:line_items_tax_amount) { described_class.new(order: order).line_items_tax_amount }

    describe '#line_items_tax_amount' do
      before do
        country = create(:country)
        state = create(:state, country: country)
        zone = create(:zone, country_ids: [country.id], state_ids: [state.id])
        create(:tax_rate, zone: zone)
      end

      context 'when the order has line items' do
        let(:order) { create(:order_with_line_items, line_items_count: 2) }

        it 'returns the line items tax total amout' do
          expect(line_items_tax_amount).to eq(2.0)
        end
      end

      context 'when the order does not have line items' do
        let(:order) { create(:order) }

        it 'returns 0' do
          expect(line_items_tax_amount).to eq(0)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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