Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-06-07 18:09:56 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-06-07 18:09:56 +0300
commit79f98200f84590af39cf1af7f57f6e8ba89d2bb6 (patch)
tree289fadec4d3f96a681b3938debaf3800806471ff /spec/tasks
parentde8e5077c3671b0b29642faf1b5e562bc4f99453 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/tasks')
-rw-r--r--spec/tasks/gitlab/db_rake_spec.rb16
1 files changed, 7 insertions, 9 deletions
diff --git a/spec/tasks/gitlab/db_rake_spec.rb b/spec/tasks/gitlab/db_rake_spec.rb
index c4623061944..1df7e2d4e98 100644
--- a/spec/tasks/gitlab/db_rake_spec.rb
+++ b/spec/tasks/gitlab/db_rake_spec.rb
@@ -306,7 +306,7 @@ RSpec.describe 'gitlab:db namespace rake task' do
let(:all_migrations) { [double('migration1', version: 1), pending_migration] }
let(:pending_migration) { double('migration2', version: 2) }
let(:filename) { Gitlab::Database::Migrations::Instrumentation::STATS_FILENAME }
- let!(:directory) { Dir.mktmpdir }
+ let(:result_dir) { Dir.mktmpdir }
let(:observations) { %w[some data] }
before do
@@ -316,19 +316,17 @@ RSpec.describe 'gitlab:db namespace rake task' do
allow(instrumentation).to receive(:observe).and_yield
- allow(Dir).to receive(:mkdir)
- allow(File).to receive(:exist?).with(directory).and_return(false)
- stub_const('Gitlab::Database::Migrations::Instrumentation::RESULT_DIR', directory)
+ stub_const('Gitlab::Database::Migrations::Instrumentation::RESULT_DIR', result_dir)
end
after do
- FileUtils.rm_rf([directory])
+ FileUtils.rm_rf(result_dir)
end
- it 'fails when the directory already exists' do
- expect(File).to receive(:exist?).with(directory).and_return(true)
+ it 'creates result directory when one does not exist' do
+ FileUtils.rm_rf(result_dir)
- expect { subject }.to raise_error(/Directory exists/)
+ expect { subject }.to change { Dir.exist?(result_dir) }.from(false).to(true)
end
it 'instruments the pending migration' do
@@ -346,7 +344,7 @@ RSpec.describe 'gitlab:db namespace rake task' do
it 'writes observations out to JSON file' do
subject
- expect(File.read(File.join(directory, filename))).to eq(observations.to_json)
+ expect(File.read(File.join(result_dir, filename))).to eq(observations.to_json)
end
end