diff --git a/app/models/issue.rb b/app/models/issue.rb index 5347d4fa1be68e9abc4a868fcbfe80c7f7fdfc9f..af80dee1dc4cb42f458ee884aba9f2d1935d69d5 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -105,9 +105,9 @@ class Issue < ActiveRecord::Base end def related_branches - return [] if self.project.empty_repo? - - self.project.repository.branch_names.select { |branch| branch.end_with?("-#{iid}") } + project.repository.branch_names.select do |branch| + branch.end_with?("-#{iid}") + end end # Reset issue events cache diff --git a/spec/models/issue_spec.rb b/spec/models/issue_spec.rb index 540a62eb1f84f6f0a53f4c8c98e865d6b5c17bb7..77d046fb0eb38f2929605cb7083e162ff672d444 100644 --- a/spec/models/issue_spec.rb +++ b/spec/models/issue_spec.rb @@ -133,9 +133,9 @@ describe Issue, models: true do describe '#related_branches' do it "selects the right branches" do allow(subject.project.repository).to receive(:branch_names). - and_return(["mpempe", "#{subject.iid}mepmep", subject.to_branch_name]) + and_return(["mpempe", "#{subject.iid}mepmep", subject.to_branch_name]) - expect(subject.related_branches).to eq [subject.to_branch_name] + expect(subject.related_branches).to eq([subject.to_branch_name]) end end