diff options
Diffstat (limited to 'spec/lib')
-rw-r--r-- | spec/lib/backup/repository_spec.rb | 6 | ||||
-rw-r--r-- | spec/lib/gitlab/legacy_github_import/importer_spec.rb | 4 | ||||
-rw-r--r-- | spec/lib/gitlab/shell_spec.rb | 40 |
3 files changed, 10 insertions, 40 deletions
diff --git a/spec/lib/backup/repository_spec.rb b/spec/lib/backup/repository_spec.rb index 2ac1b0d2583..e0afa256581 100644 --- a/spec/lib/backup/repository_spec.rb +++ b/spec/lib/backup/repository_spec.rb @@ -50,9 +50,9 @@ describe Backup::Repository do describe 'command failure' do before do - allow_next_instance_of(Gitlab::Shell) do |instance| - allow(instance).to receive(:create_repository).and_return(false) - end + # Allow us to set expectations on the project directly + expect(Project).to receive(:find_each).and_yield(project) + expect(project.repository).to receive(:create_repository) { raise 'Fail in tests' } end context 'hashed storage' do diff --git a/spec/lib/gitlab/legacy_github_import/importer_spec.rb b/spec/lib/gitlab/legacy_github_import/importer_spec.rb index 7fef763f64d..23df970957a 100644 --- a/spec/lib/gitlab/legacy_github_import/importer_spec.rb +++ b/spec/lib/gitlab/legacy_github_import/importer_spec.rb @@ -173,10 +173,6 @@ describe Gitlab::LegacyGithubImport::Importer do ] } - unless project.gitea_import? - error[:errors] << { type: :release, url: "#{api_root}/repos/octocat/Hello-World/releases/2", errors: "Validation failed: Description can't be blank" } - end - described_class.new(project).execute expect(project.import_state.last_error).to eq error.to_json diff --git a/spec/lib/gitlab/shell_spec.rb b/spec/lib/gitlab/shell_spec.rb index 280d4fba5a2..3ea9f71d3a6 100644 --- a/spec/lib/gitlab/shell_spec.rb +++ b/spec/lib/gitlab/shell_spec.rb @@ -7,18 +7,17 @@ describe Gitlab::Shell do let_it_be(:project) { create(:project, :repository) } let(:repository) { project.repository } let(:gitlab_shell) { described_class.new } - let(:popen_vars) { { 'GIT_TERMINAL_PROMPT' => ENV['GIT_TERMINAL_PROMPT'] } } - let(:timeout) { Gitlab.config.gitlab_shell.git_timeout } - before do - allow(Project).to receive(:find).and_return(project) - end - - it { is_expected.to respond_to :create_repository } it { is_expected.to respond_to :remove_repository } it { is_expected.to respond_to :fork_repository } - it { expect(gitlab_shell.url_to_repo('diaspora')).to eq(Gitlab.config.gitlab_shell.ssh_path_prefix + "diaspora.git") } + describe '.url_to_repo' do + let(:full_path) { 'diaspora/disaspora-rails' } + + subject { described_class.url_to_repo(full_path) } + + it { is_expected.to eq(Gitlab.config.gitlab_shell.ssh_path_prefix + full_path + '.git') } + end describe 'memoized secret_token' do let(:secret_file) { 'tmp/tests/.secret_shell_test' } @@ -49,37 +48,12 @@ describe Gitlab::Shell do describe 'projects commands' do let(:gitlab_shell_path) { File.expand_path('tmp/tests/gitlab-shell') } let(:projects_path) { File.join(gitlab_shell_path, 'bin/gitlab-projects') } - let(:gitlab_shell_hooks_path) { File.join(gitlab_shell_path, 'hooks') } before do allow(Gitlab.config.gitlab_shell).to receive(:path).and_return(gitlab_shell_path) allow(Gitlab.config.gitlab_shell).to receive(:git_timeout).and_return(800) end - describe '#create_repository' do - let(:repository_storage) { 'default' } - let(:repository_storage_path) do - Gitlab::GitalyClient::StorageSettings.allow_disk_access do - Gitlab.config.repositories.storages[repository_storage].legacy_disk_path - end - end - let(:repo_name) { 'project/path' } - let(:created_path) { File.join(repository_storage_path, repo_name + '.git') } - - after do - FileUtils.rm_rf(created_path) - end - - it 'returns false when the command fails' do - FileUtils.mkdir_p(File.dirname(created_path)) - # This file will block the creation of the repo's .git directory. That - # should cause #create_repository to fail. - FileUtils.touch(created_path) - - expect(gitlab_shell.create_repository(repository_storage, repo_name, repo_name)).to be_falsy - end - end - describe '#remove_repository' do let!(:project) { create(:project, :repository, :legacy_storage) } let(:disk_path) { "#{project.disk_path}.git" } |