Booth invitation to invited users
User will enter email of users to invite to become booth responsible, which will create a user in User db with that email and a new booth request will be created.
This commit is contained in:
parent
04c3859526
commit
29c15c5d93
6 changed files with 80 additions and 3 deletions
|
|
@ -77,6 +77,18 @@ describe Admin::BoothsController do
|
|||
it 'shows success message' do
|
||||
expect(flash[:notice]).to match('Booth successfully created.')
|
||||
end
|
||||
|
||||
it 'creates a new user on inviting booth responsible' do
|
||||
expect(User.where(email: 'user@example.com')).to exist
|
||||
end
|
||||
|
||||
it 'does not create a user with invalid email on inviting booth responsible' do
|
||||
expect(User.where(email: 'example')).not_to exist
|
||||
end
|
||||
|
||||
it 'invited user should be a part of booth responsibles' do
|
||||
expect(Booth.last.responsibles.ids).to include(User.find_by(email: 'user@example.com').id)
|
||||
end
|
||||
end
|
||||
|
||||
context 'create action fails' do
|
||||
|
|
@ -113,7 +125,7 @@ describe Admin::BoothsController do
|
|||
|
||||
describe 'PATCH #update' do
|
||||
context 'updates suchessfully' do
|
||||
before { patch :update, params: { id: booth.id, booth: attributes_for(:booth, title: 'different'), conference_id: conference.short_title } }
|
||||
before { patch :update, params: { id: booth.id, booth: attributes_for(:booth, title: 'different', invited_users: 'user@example.com, example'), conference_id: conference.short_title } }
|
||||
it 'redirects to admin booth index path' do
|
||||
expect(response).to redirect_to admin_conference_booths_path
|
||||
end
|
||||
|
|
@ -126,6 +138,19 @@ describe Admin::BoothsController do
|
|||
booth.reload
|
||||
expect(booth.title).to eq('different')
|
||||
end
|
||||
|
||||
it 'creates a new user on inviting booth responsible' do
|
||||
expect(User.where(email: 'user@example.com')).to exist
|
||||
end
|
||||
|
||||
it 'does not create a user with invalid email on inviting booth responsible' do
|
||||
expect(User.where(email: 'example')).not_to exist
|
||||
end
|
||||
|
||||
it 'invited user should be a part of booth responsibles' do
|
||||
booth.reload
|
||||
expect(booth.responsibles.ids).to include(User.find_by(email: 'user@example.com').id)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue