feat: Ability for the logged in user to create a new account (#985)

Co-authored-by: Divyesh <dkothari@box8.in>
Co-authored-by: Pranav Raj S <pranav@thoughtwoot.com>
This commit is contained in:
Divyesh Kothari
2020-07-26 12:54:50 +05:30
committed by GitHub
parent 858b72a404
commit 89ed0b425b
13 changed files with 219 additions and 28 deletions

View File

@@ -15,9 +15,9 @@ RSpec.describe 'Accounts API', type: :request do
end
it 'calls account builder' do
allow(account_builder).to receive(:perform).and_return(user)
allow(account_builder).to receive(:perform).and_return([user, account])
params = { account_name: 'test', email: email }
params = { account_name: 'test', email: email, user: nil }
post api_v1_accounts_url,
params: params,
@@ -31,7 +31,7 @@ RSpec.describe 'Accounts API', type: :request do
it 'renders error response on invalid params' do
allow(account_builder).to receive(:perform).and_return(nil)
params = { account_name: nil, email: nil }
params = { account_name: nil, email: nil, user: nil }
post api_v1_accounts_url,
params: params,
@@ -46,7 +46,7 @@ RSpec.describe 'Accounts API', type: :request do
it 'ignores confirmed param when called with out super admin token' do
allow(account_builder).to receive(:perform).and_return(nil)
params = { account_name: 'test', email: email, confirmed: true }
params = { account_name: 'test', email: email, confirmed: true, user: nil }
post api_v1_accounts_url,
params: params,