Commit 1e0efc7e authored by Georges Racinet's avatar Georges Racinet 🦑

RSpec tests for hg_access: using an empty repo for main tests

Thanks to this, the running time goes down from about 3mn to
1mn and 50s on my system.

The LFS tests are probably irrelevant: the day we activate Mercurial's
version of LFS, we will certainly have to perform other types of checks.
But then, they will perhaps serve as reminders that there is
something to adapt.

branch : heptapod-stable
parent 84b0544435e7
......@@ -9,7 +9,7 @@
let(:user) { create(:user) }
let(:actor) { user }
let(:project) { create(:hg_git_project, :hg_repository) }
let(:project) { create(:hg_git_project, :empty_repo) }
let(:project_path) { project&.path }
let(:namespace_path) { project&.namespace&.path }
let(:protocol) { 'ssh' }
......@@ -637,6 +637,10 @@ def disable_protocol(protocol)
context 'when LFS is not enabled' do
it 'does not run LFSIntegrity check' do
# that the general branch push check would refuse for lack of a
# default branch is not what is tested here.
.to receive(:protected_branch_push_checks).and_return(nil)
expect(Gitlab::Checks::LfsIntegrity).not_to receive(:new)
......@@ -645,6 +649,9 @@ def disable_protocol(protocol)
context 'when LFS is enabled' do
it 'checks LFS integrity only for first change' do
# see comment for when LFS is not enabled
.to receive(:protected_branch_push_checks).and_return(nil)
allow(project).to receive(:lfs_enabled?).and_return(true)
expect_next_instance_of(Gitlab::Checks::LfsIntegrity) do |instance|
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