FIX: Incorrect error raised.
This commit is contained in:
parent
644c15926a
commit
6f7c6b0fd0
|
@ -8,7 +8,7 @@ class NotificationsController < ApplicationController
|
|||
user =
|
||||
if params[:username] && !params[:recent]
|
||||
user_record = User.find_by(username: params[:username].to_s)
|
||||
raise Discourse::InvalidParameters.new(:username) if !user_record
|
||||
raise Discourse::NotFound if !user_record
|
||||
user_record
|
||||
else
|
||||
current_user
|
||||
|
|
|
@ -36,8 +36,10 @@ describe NotificationsController do
|
|||
|
||||
context 'when username params is not valid' do
|
||||
it 'should raise the right error' do
|
||||
expect { xhr :get, :index, username: 'somedude' }
|
||||
.to raise_error(Discourse::InvalidParameters)
|
||||
xhr :get, :index, username: 'somedude'
|
||||
|
||||
expect(response).to_not be_success
|
||||
expect(response.status).to eq(404)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue