BigW Consortium Gitlab

Fix branch validation for GitHub PR where repo/fork was renamed/deleted

parent 24e5a1e8
......@@ -8,7 +8,7 @@ module Gitlab
end
def valid?
repo.present?
sha.present? && ref.present?
end
private
......
......@@ -49,14 +49,20 @@ describe Gitlab::GithubImport::BranchFormatter, lib: true do
end
describe '#valid?' do
it 'returns true when raw repo is present' do
it 'returns true when raw sha and ref are present' do
branch = described_class.new(project, double(raw))
expect(branch.valid?).to eq true
end
it 'returns false when raw repo is blank' do
branch = described_class.new(project, double(raw.merge(repo: nil)))
it 'returns false when raw sha is blank' do
branch = described_class.new(project, double(raw.merge(sha: nil)))
expect(branch.valid?).to eq false
end
it 'returns false when raw ref is blank' do
branch = described_class.new(project, double(raw.merge(ref: nil)))
expect(branch.valid?).to eq false
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment