Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions spec/integration/protected_branches_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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'

Expand Down