diff options
author | Alejandro RodrÃguez <alejorro70@gmail.com> | 2018-10-02 06:21:46 +0300 |
---|---|---|
committer | Alejandro RodrÃguez <alejorro70@gmail.com> | 2018-10-02 22:34:28 +0300 |
commit | a99bf447a24957cf11b89d4f04a2b84613367ef2 (patch) | |
tree | 68821625f3e39e81f495d89537b55334180b0f77 /spec/models/repository_spec.rb | |
parent | 0ef1060e14b8ac09159e466fe5f4ca3195e080c2 (diff) |
Remove Gitlab::Git::Repository#rugged and Gollum code
Cleanup code, and refactor tests that still use Rugged. After this, there should
be no Rugged code that access the instance's repositories on non-test
environments. There is still some rugged code for other tasks like the
repository import task, but since it doesn't access any repository storage path
it can stay.
Diffstat (limited to 'spec/models/repository_spec.rb')
-rw-r--r-- | spec/models/repository_spec.rb | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/spec/models/repository_spec.rb b/spec/models/repository_spec.rb index 784d17e271e..77e549d9528 100644 --- a/spec/models/repository_spec.rb +++ b/spec/models/repository_spec.rb @@ -2,6 +2,8 @@ require 'spec_helper' describe Repository do include RepoHelpers + include GitHelpers + TestBlob = Struct.new(:path) let(:project) { create(:project, :repository) } @@ -137,9 +139,7 @@ describe Repository do options = { message: 'test tag message\n', tagger: { name: 'John Smith', email: 'john@gmail.com' } } - Gitlab::GitalyClient::StorageSettings.allow_disk_access do - repository.rugged.tags.create(annotated_tag_name, 'a48e4fc218069f68ef2e769dd8dfea3991362175', options) - end + rugged_repo(repository).tags.create(annotated_tag_name, 'a48e4fc218069f68ef2e769dd8dfea3991362175', options) double_first = double(committed_date: Time.now - 1.second) double_last = double(committed_date: Time.now) @@ -151,9 +151,7 @@ describe Repository do it { is_expected.to eq(['v1.1.0', 'v1.0.0', annotated_tag_name]) } after do - Gitlab::GitalyClient::StorageSettings.allow_disk_access do - repository.rugged.tags.delete(annotated_tag_name) - end + rugged_repo(repository).tags.delete(annotated_tag_name) end end end @@ -1678,10 +1676,7 @@ describe Repository do it 'returns the number of branches' do expect(repository.branch_count).to be_an(Integer) - # NOTE: Until rugged goes away, make sure rugged and gitaly are in sync - rugged_count = Gitlab::GitalyClient::StorageSettings.allow_disk_access do - repository.raw_repository.rugged.branches.count - end + rugged_count = rugged_repo(repository).branches.count expect(repository.branch_count).to eq(rugged_count) end @@ -1691,10 +1686,7 @@ describe Repository do it 'returns the number of tags' do expect(repository.tag_count).to be_an(Integer) - # NOTE: Until rugged goes away, make sure rugged and gitaly are in sync - rugged_count = Gitlab::GitalyClient::StorageSettings.allow_disk_access do - repository.raw_repository.rugged.tags.count - end + rugged_count = rugged_repo(repository).tags.count expect(repository.tag_count).to eq(rugged_count) end @@ -2184,9 +2176,7 @@ describe Repository do end def create_remote_branch(remote_name, branch_name, target) - rugged = Gitlab::GitalyClient::StorageSettings.allow_disk_access do - repository.rugged - end + rugged = rugged_repo(repository) rugged.references.create("refs/remotes/#{remote_name}/#{branch_name}", target.id) end |