diff options
author | Phil Hughes <me@iamphill.com> | 2017-06-30 12:31:41 +0100 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2017-06-30 12:37:35 +0100 |
commit | 531a4d124b0a17280b4118d7fa7c66f11042917b (patch) | |
tree | a2ee668d403ed538d6046f942f31bce2c1224563 /spec/controllers/abuse_reports_controller_spec.rb | |
parent | f5681fb55a762c9b9bb35c80bf87d727d8d8fd06 (diff) | |
parent | 81dba76b9d7d120cd22e3619a4058bd4885be9bc (diff) | |
download | gitlab-ce-531a4d124b0a17280b4118d7fa7c66f11042917b.tar.gz |
Merge branch 'master' into experimental-breadcrumbsexperimental-breadcrumbs
Diffstat (limited to 'spec/controllers/abuse_reports_controller_spec.rb')
-rw-r--r-- | spec/controllers/abuse_reports_controller_spec.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/controllers/abuse_reports_controller_spec.rb b/spec/controllers/abuse_reports_controller_spec.rb index 80a418feb3e..ada011e7595 100644 --- a/spec/controllers/abuse_reports_controller_spec.rb +++ b/spec/controllers/abuse_reports_controller_spec.rb @@ -13,6 +13,31 @@ describe AbuseReportsController do sign_in(reporter) end + describe 'GET new' do + context 'when the user has already been deleted' do + it 'redirects the reporter to root_path' do + user_id = user.id + user.destroy + + get :new, { user_id: user_id } + + expect(response).to redirect_to root_path + expect(flash[:alert]).to eq('Cannot create the abuse report. The user has been deleted.') + end + end + + context 'when the user has already been blocked' do + it 'redirects the reporter to the user\'s profile' do + user.block + + get :new, { user_id: user.id } + + expect(response).to redirect_to user + expect(flash[:alert]).to eq('Cannot create the abuse report. This user has been blocked.') + end + end + end + describe 'POST create' do context 'with valid attributes' do it 'saves the abuse report' do |