summaryrefslogtreecommitdiff
path: root/spec/models/issue_spec.rb
diff options
context:
space:
mode:
authorFelipe Artur <felipefac@gmail.com>2018-10-03 17:45:39 -0300
committerFelipe Artur <felipefac@gmail.com>2018-10-04 15:59:14 -0300
commit0ae48e068794a732f728de76ffbf3f95e702ba9a (patch)
treee63047572f6dfc7533af377f7329dd242b7f396d /spec/models/issue_spec.rb
parent8a8ae2f57fe0db9b33f100e9a68c9eac4fd71c4d (diff)
downloadgitlab-ce-0ae48e068794a732f728de76ffbf3f95e702ba9a.tar.gz
Move issue related_branches to service
Moves the related_branches method from Issue model to RelatedBranchesService
Diffstat (limited to 'spec/models/issue_spec.rb')
-rw-r--r--spec/models/issue_spec.rb39
1 files changed, 0 insertions, 39 deletions
diff --git a/spec/models/issue_spec.rb b/spec/models/issue_spec.rb
index 19bc2713ef5..6f900a60213 100644
--- a/spec/models/issue_spec.rb
+++ b/spec/models/issue_spec.rb
@@ -268,45 +268,6 @@ describe Issue do
end
end
- describe '#related_branches' do
- let(:user) { create(:admin) }
-
- before do
- allow(subject.project.repository).to receive(:branch_names)
- .and_return(["mpempe", "#{subject.iid}mepmep", subject.to_branch_name, "#{subject.iid}-branch"])
-
- # Without this stub, the `create(:merge_request)` above fails because it can't find
- # the source branch. This seems like a reasonable compromise, in comparison with
- # setting up a full repo here.
- allow_any_instance_of(MergeRequest).to receive(:create_merge_request_diff)
- end
-
- it "selects the right branches when there are no referenced merge requests" do
- expect(subject.related_branches(user)).to eq([subject.to_branch_name, "#{subject.iid}-branch"])
- end
-
- it "selects the right branches when there is a referenced merge request" do
- merge_request = create(:merge_request, { description: "Closes ##{subject.iid}",
- source_project: subject.project,
- source_branch: "#{subject.iid}-branch" })
- merge_request.create_cross_references!(user)
-
- referenced_merge_requests = Issues::ReferencedMergeRequestsService
- .new(subject.project, user)
- .referenced_merge_requests(subject)
-
- expect(referenced_merge_requests).not_to be_empty
- expect(subject.related_branches(user)).to eq([subject.to_branch_name])
- end
-
- it 'excludes stable branches from the related branches' do
- allow(subject.project.repository).to receive(:branch_names)
- .and_return(["#{subject.iid}-0-stable"])
-
- expect(subject.related_branches(user)).to eq []
- end
- end
-
describe '#suggested_branch_name' do
let(:repository) { double }