diff options
author | Zeger-Jan van de Weg <mail@zjvandeweg.nl> | 2016-02-04 13:51:12 +0300 |
---|---|---|
committer | Zeger-Jan van de Weg <mail@zjvandeweg.nl> | 2016-02-04 13:56:23 +0300 |
commit | c6e0228ca9937b10ad8e2620501d4fe221108d9a (patch) | |
tree | 4393a8699f98da3d172246f8d392589855d80fd7 /spec | |
parent | 8d948744461619ac3561be93d545d72343efa0cd (diff) |
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
Diffstat (limited to 'spec')
-rw-r--r-- | spec/models/merge_request_spec.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/spec/models/merge_request_spec.rb b/spec/models/merge_request_spec.rb index 46f2f20b986..f9d0e1029d6 100644 --- a/spec/models/merge_request_spec.rb +++ b/spec/models/merge_request_spec.rb @@ -226,9 +226,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 |