diff options
author | Sean McGivern <sean@gitlab.com> | 2018-11-22 09:50:34 +0000 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2018-11-22 09:50:34 +0000 |
commit | 2bc4a17decf943123f5adff0ea624eef325d776d (patch) | |
tree | 2144d1399344696328ba6607803e9745749f8ebb /spec/models/merge_request_spec.rb | |
parent | f0630090aaea98daef3582bc95efe3a43736a10f (diff) | |
parent | 5c131dac5e2e7fc85bcbef6c1c8e95912b7759d4 (diff) | |
download | gitlab-ce-2bc4a17decf943123f5adff0ea624eef325d776d.tar.gz |
Merge branch 'revert-fd6e3781' into 'master'
Revert "Merge branch 'revert-e2aa2177' into 'master'"
Closes #54267
See merge request gitlab-org/gitlab-ce!23237
Diffstat (limited to 'spec/models/merge_request_spec.rb')
-rw-r--r-- | spec/models/merge_request_spec.rb | 62 |
1 files changed, 22 insertions, 40 deletions
diff --git a/spec/models/merge_request_spec.rb b/spec/models/merge_request_spec.rb index a58dc8e25e8..ad55c280399 100644 --- a/spec/models/merge_request_spec.rb +++ b/spec/models/merge_request_spec.rb @@ -30,48 +30,38 @@ describe MergeRequest do end describe '#squash_in_progress?' do - shared_examples 'checking whether a squash is in progress' do - let(:repo_path) do - Gitlab::GitalyClient::StorageSettings.allow_disk_access do - subject.source_project.repository.path - end - end - let(:squash_path) { File.join(repo_path, "gitlab-worktree", "squash-#{subject.id}") } - - before do - system(*%W(#{Gitlab.config.git.bin_path} -C #{repo_path} worktree add --detach #{squash_path} master)) - end - - it 'returns true when there is a current squash directory' do - expect(subject.squash_in_progress?).to be_truthy + let(:repo_path) do + Gitlab::GitalyClient::StorageSettings.allow_disk_access do + subject.source_project.repository.path end + end + let(:squash_path) { File.join(repo_path, "gitlab-worktree", "squash-#{subject.id}") } - it 'returns false when there is no squash directory' do - FileUtils.rm_rf(squash_path) + before do + system(*%W(#{Gitlab.config.git.bin_path} -C #{repo_path} worktree add --detach #{squash_path} master)) + end - expect(subject.squash_in_progress?).to be_falsey - end + it 'returns true when there is a current squash directory' do + expect(subject.squash_in_progress?).to be_truthy + end - it 'returns false when the squash directory has expired' do - time = 20.minutes.ago.to_time - File.utime(time, time, squash_path) + it 'returns false when there is no squash directory' do + FileUtils.rm_rf(squash_path) - expect(subject.squash_in_progress?).to be_falsey - end + expect(subject.squash_in_progress?).to be_falsey + end - it 'returns false when the source project has been removed' do - allow(subject).to receive(:source_project).and_return(nil) + it 'returns false when the squash directory has expired' do + time = 20.minutes.ago.to_time + File.utime(time, time, squash_path) - expect(subject.squash_in_progress?).to be_falsey - end + expect(subject.squash_in_progress?).to be_falsey end - context 'when Gitaly squash_in_progress is enabled' do - it_behaves_like 'checking whether a squash is in progress' - end + it 'returns false when the source project has been removed' do + allow(subject).to receive(:source_project).and_return(nil) - context 'when Gitaly squash_in_progress is disabled', :disable_gitaly do - it_behaves_like 'checking whether a squash is in progress' + expect(subject.squash_in_progress?).to be_falsey end end @@ -2587,14 +2577,6 @@ describe MergeRequest do expect(subject.rebase_in_progress?).to be_falsey end end - - context 'when Gitaly rebase_in_progress is enabled' do - it_behaves_like 'checking whether a rebase is in progress' - end - - context 'when Gitaly rebase_in_progress is enabled', :disable_gitaly do - it_behaves_like 'checking whether a rebase is in progress' - end end describe '#allow_collaboration' do |