Sha256: aeedfad57e19d457ac4a7439758154f482a9c97f8aa11c22b275aef0a0eba9a3

Contents?: true

Size: 1.13 KB

Versions: 19

Compression:

Stored size: 1.13 KB

Contents

require "spec_helper"

describe Myfinance::Resources::Reconcile, vcr: true do
  let(:entity_id) { 3798 }
  let(:da_id) { 14268 }
  let(:date) { "2017-01-01" }
  let(:ft) { client.financial_transactions.create(entity_id, da_id, type: "Credit", amount: 150.0, occurred_at: date) }
  let(:ra_params) do
    { due_date: "2017-01-01", amount: 150.0, occurred_at: "2017-01-01", total_amount: 150.0 }
  end
  let(:ra) { client.receivable_accounts.create(entity_id, ra_params) }

  describe "#reconcile" do
    subject { client.reconciles.reconcile(entity_id, [ra.id], [ft.id]) }
    it "returns 200 OK response code" do
      expect(subject.response.code).to eq(200)
    end

    it "returns the selected FAs and FTs" do
      expect(subject.collection.first.id).to eq(ft.id)
      expect(subject.collection.last.id).to eq(ra.id)
    end

    it "expects FT to be reconciled" do
      expect(subject.collection.first.reconciled).to be_truthy
    end

    it "expects FA to be reconciled with FT" do
      reconciliation = subject.collection.last.reconciliations["financial_transactions"].first
      expect(reconciliation["id"]).to eq(ft.id)
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
myfinance-1.8.2 spec/lib/myfinance/resources/reconcile_spec.rb
myfinance-1.8.1 spec/lib/myfinance/resources/reconcile_spec.rb
myfinance-1.8.0 spec/lib/myfinance/resources/reconcile_spec.rb
myfinance-1.7.0 spec/lib/myfinance/resources/reconcile_spec.rb
myfinance-1.6.6 spec/lib/myfinance/resources/reconcile_spec.rb
myfinance-1.6.5 spec/lib/myfinance/resources/reconcile_spec.rb
myfinance-1.6.4 spec/lib/myfinance/resources/reconcile_spec.rb
myfinance-1.6.3 spec/lib/myfinance/resources/reconcile_spec.rb
myfinance-1.6.1 spec/lib/myfinance/resources/reconcile_spec.rb
myfinance-1.6.0 spec/lib/myfinance/resources/reconcile_spec.rb
myfinance-1.5.0 spec/lib/myfinance/resources/reconcile_spec.rb
myfinance-1.4.1 spec/lib/myfinance/resources/reconcile_spec.rb
myfinance-1.4.0 spec/lib/myfinance/resources/reconcile_spec.rb
myfinance-1.3.1 spec/lib/myfinance/resources/reconcile_spec.rb
myfinance-1.3.0 spec/lib/myfinance/resources/reconcile_spec.rb
myfinance-1.2.1 spec/lib/myfinance/resources/reconcile_spec.rb
myfinance-1.2.0 spec/lib/myfinance/resources/reconcile_spec.rb
myfinance-1.1.0 spec/lib/myfinance/resources/reconcile_spec.rb
myfinance-1.0.0 spec/lib/myfinance/resources/reconcile_spec.rb