diff --git a/api/app/controllers/mno_enterprise/jpi/v1/admin/organizations_controller.rb b/api/app/controllers/mno_enterprise/jpi/v1/admin/organizations_controller.rb index f928d4937..070231789 100644 --- a/api/app/controllers/mno_enterprise/jpi/v1/admin/organizations_controller.rb +++ b/api/app/controllers/mno_enterprise/jpi/v1/admin/organizations_controller.rb @@ -81,7 +81,7 @@ def invite_member organization_id: @organization.id ) - if invite.save + if invite.persisted? @user = user.confirmed? ? invite : user.reload else render json: invite.errors, status: :bad_request diff --git a/api/spec/controllers/mno_enterprise/jpi/v1/admin/organizations_controller_spec.rb b/api/spec/controllers/mno_enterprise/jpi/v1/admin/organizations_controller_spec.rb index 882183970..50b5524dc 100644 --- a/api/spec/controllers/mno_enterprise/jpi/v1/admin/organizations_controller_spec.rb +++ b/api/spec/controllers/mno_enterprise/jpi/v1/admin/organizations_controller_spec.rb @@ -157,7 +157,7 @@ def partial_hash_for_arrears(arrear) # Track the api call @api_call = false stub = -> { @api_call = true; from_api(org_invite) } - api_stub_for(post: "/organizations/#{organization.id}/org_invites", response: stub) + api_stub_for(post: "/org_invites", response: stub) end let(:params) { FactoryGirl.attributes_for(:user) }