Sha256: 4c4aeda4f0522844b15f7221daddb5e1af3f4e99ecae65af2aa097ce7e1a9663
Contents?: true
Size: 1.14 KB
Versions: 32
Compression:
Stored size: 1.14 KB
Contents
require 'spec_helper' module Spree describe Reimbursement::Credit, type: :model do context 'class methods' do describe '.total_amount_reimbursed_for' do subject { Spree::Reimbursement::Credit.total_amount_reimbursed_for(reimbursement) } let(:reimbursement) { create(:reimbursement) } let(:credit_double) { double(amount: 99.99) } before { allow(reimbursement).to receive(:credits).and_return([credit_double, credit_double]) } it 'should sum the amounts of all of the reimbursements credits' do expect(subject).to eq BigDecimal.new('199.98') end end end describe '#description' do let(:credit) { Spree::Reimbursement::Credit.new(amount: 100, creditable: mock_model(Spree::PaymentMethod::Check)) } it "should be the creditable's class name" do expect(credit.description).to eq 'Check' end end describe '#display_amount' do let(:credit) { Spree::Reimbursement::Credit.new(amount: 100) } it 'should be a money object' do expect(credit.display_amount).to eq Spree::Money.new(100, currency: "USD") end end end end
Version data entries
32 entries across 32 versions & 1 rubygems