Merge pull request 'Fix exception during signup' (#56) from bugfix/signup_lndhub into master
All checks were successful
continuous-integration/drone/push Build is passing

Reviewed-on: #56
This commit is contained in:
Râu Cao 2022-01-10 15:31:10 +00:00
commit f22ffe373c
2 changed files with 25 additions and 2 deletions

View File

@ -10,7 +10,7 @@ class CreateAccount < ApplicationService
def call
user = create_user_in_database
add_ldap_document
create_lndhub_wallet
create_lndhub_wallet(user)
if @invitation.present?
update_invitation(user.id)
@ -46,7 +46,7 @@ class CreateAccount < ApplicationService
ExchangeXmppContactsJob.perform_later(@invitation.user, @username, @domain)
end
def create_lndhub_wallet
def create_lndhub_wallet(user)
CreateLndhubWalletJob.perform_later(user)
end
end

View File

@ -92,4 +92,27 @@ RSpec.describe CreateAccount, type: :model do
clear_enqueued_jobs
end
end
describe "#create_lndhub_wallet" do
include ActiveJob::TestHelper
let(:service) { CreateAccount.new(
username: 'halfinney', email: 'halfinney@example.com',
password: 'bright-ideas-in-winter'
)}
let(:new_user) { create :user, cn: "halfinney", ou: "kosmos.org" }
it "enqueues a job to create an LndHub wallet" do
service.send(:create_lndhub_wallet, new_user)
expect(enqueued_jobs.size).to eq(1)
args = enqueued_jobs.first['arguments']
expect(args[0]['_aj_globalid']).to match('gid://akkounts/User')
end
after do
clear_enqueued_jobs
end
end
end