Skip to content

Commit

Permalink
Merge pull request #8653 from vpereira/mbranch_dryrun_issue
Browse files Browse the repository at this point in the history
Make sure that possible_package isn't nil
  • Loading branch information
hennevogel committed Nov 4, 2019
2 parents 2e5819d + bd2f39b commit b465b43
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def package
end.flatten
pkg = nil
# choose the last one based on the incident number (incremental sequence)
possible_packages.each do |possible_package|
possible_packages.reject(&:nil?).each do |possible_package|
pkg = possible_package if pkg.nil? || possible_package.project.incident_id > pkg.project.incident_id
end
pkg
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,13 @@
subject { lookup_incident_package.package }

it { expect(subject).to eq(package_1) }

context 'possible packages are nil' do
before do
allow_any_instance_of(BranchPackage::LookupIncidentPackage).to receive(:possible_packages).and_return([[package_1], [nil]])
end

it { expect(subject).to eq(package_1) }
end
end
end

0 comments on commit b465b43

Please sign in to comment.