summaryrefslogtreecommitdiff
path: root/spec/models
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2016-02-04 11:56:58 +0000
committerDouwe Maan <douwe@gitlab.com>2016-02-04 11:56:58 +0000
commitb5befc734be55a4a7a07519baf03e0ba29c0f8c5 (patch)
tree5a40c945a29faf868e52ff52a4e7c66f15f5f2ed /spec/models
parent9ae125e7e2c02ef6861f6fa09cc2d5048052a8ed (diff)
parentc6e0228ca9937b10ad8e2620501d4fe221108d9a (diff)
downloadgitlab-ce-b5befc734be55a4a7a07519baf03e0ba29c0f8c5.tar.gz
Merge branch 'disable-remove-source-branch' into 'master'
Hide remove source branch button when new commit is added to branch Fixes #3339 This MR hides the 'Remove source branch' button when a new commit is added to the source branch /cc @DouweM See merge request !2701
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/merge_request_spec.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/spec/models/merge_request_spec.rb b/spec/models/merge_request_spec.rb
index cd1953bfc5e..c61ddf01118 100644
--- a/spec/models/merge_request_spec.rb
+++ b/spec/models/merge_request_spec.rb
@@ -231,9 +231,15 @@ describe MergeRequest, models: true do
expect(subject.can_remove_source_branch?(user2)).to be_falsey
end
- it "is can be removed in all other cases" do
+ it "can be removed if the last commit is the head of the source branch" do
+ allow(subject.source_project).to receive(:commit).and_return(subject.last_commit)
+
expect(subject.can_remove_source_branch?(user)).to be_truthy
end
+
+ it "cannot be removed if the last commit is not also the head of the source branch" do
+ expect(subject.can_remove_source_branch?(user)).to be_falsey
+ end
end
describe "#reset_merge_when_build_succeeds" do