Sha256: bb74bedfa3b3d87579fbb2bdc6e9217cb8a7103ffac8029de86f724ebe2b3538

Contents?: true

Size: 936 Bytes

Versions: 2

Compression:

Stored size: 936 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'

module Payday

  describe LineItem do
    it 'is able to be initialized with a price' do
      li = described_class.new(price: BigDecimal(20))
      expect(li.price).to eq(BigDecimal(20))
    end

    it 'is able to be initialized with a quantity' do
      li = described_class.new(quantity: 30)
      expect(li.quantity).to eq(BigDecimal(30))
    end

    it 'is able to be initialized with a description' do
      li = described_class.new(description: '12 Pairs of Pants')
      expect(li.description).to eq('12 Pairs of Pants')
    end

    it 'returns the correct amount' do
      li = described_class.new(price: 10, quantity: 12)
      expect(li.amount).to eq(BigDecimal(120))
    end

    it 'returns the correct amount when using a predefined amount' do
      li = described_class.new(predefined_amount: 244)
      expect(li.amount).to eq(BigDecimal(244))
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
webtranslateit-payday-1.6.8 spec/line_item_spec.rb
webtranslateit-payday-1.6.7 spec/line_item_spec.rb