Sha256: 34ccd4c91da339496440c12a0a5c7d897476c0dd5f1839908ca21d9ec4beec5c

Contents?: true

Size: 1.15 KB

Versions: 3

Compression:

Stored size: 1.15 KB

Contents

require 'rails_helper'

module BloomRemit
  module Txns
    module Operations
      RSpec.describe Create, cleaning_strategy: :truncation do

        let(:user) { create(:bloom_remit_dummy_sub_user) }
        let(:biller) { create(:bloom_remit_dummy_biller, slug: "PLDT") }
        let(:payment) { create(:bloom_remit_dummy_sub_payment) }

        it "creates a txn with a secret and enqueues the PayoutJob" do
          op = described_class.(txn: {
            target_slug: biller.slug,
            sender_id: user.id,
            sender_type: user.class.base_class.name,
            amount: 800.0,
            account_name: "028109090",
            account_id: "Hooli X",
            owner_id: payment.id,
            owner_type: payment.class.base_class.name,
          })
          txn = op.model
          expect(txn.target_slug).to eq biller.slug
          expect(txn.sender).to eq user
          expect(txn.amount).to eq 800.0
          expect(txn.account_name).to eq "028109090"
          expect(txn.account_id).to eq "Hooli X"
          expect(txn.owner).to eq payment
          expect(PayoutJob).to have_enqueued_job(txn.id)
        end

      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
bloom_remit-0.2.1 spec/concepts/bloom_remit/txns/operations/create_spec.rb
bloom_remit-0.2.0 spec/concepts/bloom_remit/txns/operations/create_spec.rb
bloom_remit-0.1.0 spec/concepts/bloom_remit/txns/operations/create_spec.rb