debian-mirror-gitlab/spec/lib/gitlab/checks/force_push_spec.rb
2020-04-08 14:13:33 +05:30

19 lines
523 B
Ruby

# frozen_string_literal: true
require 'spec_helper'
describe Gitlab::Checks::ForcePush do
let_it_be(:project) { create(:project, :repository) }
describe '.force_push?' do
it 'returns false if the repo is empty' do
allow(project).to receive(:empty_repo?).and_return(true)
expect(described_class.force_push?(project, 'HEAD', 'HEAD~')).to be(false)
end
it 'checks if old rev is an anchestor' do
expect(described_class.force_push?(project, 'HEAD', 'HEAD~')).to be(true)
end
end
end