diff --git a/app/controllers/management/user_invites_controller.rb b/app/controllers/management/user_invites_controller.rb index b022e6a86..cbe3d1914 100644 --- a/app/controllers/management/user_invites_controller.rb +++ b/app/controllers/management/user_invites_controller.rb @@ -4,7 +4,7 @@ class Management::UserInvitesController < Management::BaseController end def create - @emails = params[:emails].split + @emails = params[:emails].split(",").map(&:strip) @emails.each do |email| Mailer.user_invite(email).deliver_later end diff --git a/spec/features/emails_spec.rb b/spec/features/emails_spec.rb index dcc90ca27..ac1249fd6 100644 --- a/spec/features/emails_spec.rb +++ b/spec/features/emails_spec.rb @@ -237,7 +237,7 @@ feature 'Emails' do login_as_manager visit new_management_user_invite_path - fill_in "emails", with: "john@example.com, ana@example.com, isable@example.com" + fill_in "emails", with: " john@example.com, ana@example.com,isable@example.com " click_button "Send invites" expect(page).to have_content "3 invitations have been sent."