Commit 931af7d6f995cd889d553659fea0d77102aa62a3
1 parent
1640860f
Exists in
colab
and in
2 other branches
Add unit test for invalid request on notify_push action
Signed-off-by: Heitor Reis <marcheing@gmail.com>
Showing
1 changed file
with
10 additions
and
0 deletions
Show diff stats
spec/controllers/repositories_controller_spec.rb
... | ... | @@ -556,5 +556,15 @@ describe RepositoriesController, :type => :controller do |
556 | 556 | |
557 | 557 | it { is_expected.to respond_with(:not_found) } |
558 | 558 | end |
559 | + | |
560 | + context 'with an invalid request' do | |
561 | + before :each do | |
562 | + Repository.expects(:find).with(repository.id).returns(repository) | |
563 | + Webhooks::GitLab.any_instance.expects(:valid_request?).returns(false) | |
564 | + post_push | |
565 | + end | |
566 | + | |
567 | + it { is_expected.to respond_with(:unprocessable_entity) } | |
568 | + end | |
559 | 569 | end |
560 | 570 | end | ... | ... |