2021-02-02 21:04:53 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
# License: AGPL-3.0-or-later WITH WTO-AP-3.0-or-later
|
|
|
|
# Full license explanation at https://github.com/houdiniproject/houdini/blob/master/LICENSE
|
|
|
|
require 'rails_helper'
|
|
|
|
|
|
|
|
RSpec.describe Transaction, type: :model do
|
|
|
|
include_context :shared_donation_charge_context
|
|
|
|
|
|
|
|
describe 'to_builder' do
|
|
|
|
subject { supporter.transactions.create(amount: 1000).to_builder.attributes!}
|
|
|
|
it 'will create a proper builder result' do
|
|
|
|
expect(subject).to match({
|
|
|
|
'id' => match('trx_[a-zA-Z0-9]{22}'),
|
|
|
|
'nonprofit' => nonprofit.id,
|
|
|
|
'supporter' => supporter.id,
|
|
|
|
'object' => 'transaction',
|
|
|
|
'amount' => {
|
2021-02-24 23:34:59 +00:00
|
|
|
'amount' => 1000,
|
2021-02-02 21:04:53 +00:00
|
|
|
'currency' => 'usd'
|
2021-02-02 23:53:00 +00:00
|
|
|
}
|
2021-02-02 21:04:53 +00:00
|
|
|
})
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|