diff options
author | Stan Hu <stanhu@gmail.com> | 2017-03-20 22:17:46 -0700 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2017-03-20 22:17:46 -0700 |
commit | 07415e474ed4dc3b6bd1bcfa874c8cdb393855f4 (patch) | |
tree | 3aa3721afd90641e693d55deee8a4085a9fd702a /spec/controllers/import | |
parent | 608538437d92902838ff91a6da577f5f3f76c4e6 (diff) | |
download | gitlab-ce-07415e474ed4dc3b6bd1bcfa874c8cdb393855f4.tar.gz |
Fix Error 500 when Bitbucket importer does not have authorization
Closes #29739
Diffstat (limited to 'spec/controllers/import')
-rw-r--r-- | spec/controllers/import/bitbucket_controller_spec.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/spec/controllers/import/bitbucket_controller_spec.rb b/spec/controllers/import/bitbucket_controller_spec.rb index fa4cc0ebbe0..51f23e4eeb9 100644 --- a/spec/controllers/import/bitbucket_controller_spec.rb +++ b/spec/controllers/import/bitbucket_controller_spec.rb @@ -112,6 +112,17 @@ describe Import::BitbucketController do post :create, format: :js end end + + context 'when the Bitbucket user is unauthorized' do + render_views + + it 'returns unauthorized' do + allow(controller).to receive(:current_user).and_return(user) + allow(user).to receive(:can?).and_return(false) + + post :create, format: :js + end + end end context "when the repository owner is not the Bitbucket user" do |