diff --git a/spec/integration/protected_branches_spec.rb b/spec/integration/protected_branches_spec.rb index 115be29d..ef1b9201 100644 --- a/spec/integration/protected_branches_spec.rb +++ b/spec/integration/protected_branches_spec.rb @@ -23,15 +23,17 @@ ProtectedBranches: enabled: true branches: - - protected - - protected_for_destructive_only: - destructive_only: true + - protected_for_destructive_only + - protected: + destructive_only: false + YML around do |example| remote_repo = repo do - `git checkout -b protected > #{File::NULL} 2>&1` + `git checkout -b protected_for_destructive_only > #{File::NULL} 2>&1` `git commit --allow-empty -m "Remote commit"` + `git checkout -b protected > #{File::NULL} 2>&1` `git checkout -b unprotected > #{File::NULL} 2>&1` `git checkout -b dummy > #{File::NULL} 2>&1` end @@ -155,6 +157,17 @@ context 'when pushing to a protected branch' do let(:remote_ref) { 'protected' } + context 'when pushing' do + context 'with ProtectedBranches enabled' do + include_context 'ProtectedBranches enabled' + include_examples 'push fails' + end + end + end + + context 'when pushing to a protected for destructive only branch' do + let(:remote_ref) { 'protected_for_destructive_only' } + context 'when force-pushing' do include_context 'force-pushing'