Commit ae8fd6ad authored by Lin Jen-Shin's avatar Lin Jen-Shin

Merge branch 'refactor/update_spec_database_task_dir' into 'master'

Refactor database task dir for spec

See merge request gitlab-org/gitlab!69160
parents 84cf2429 98e3fec5
...@@ -129,13 +129,14 @@ RSpec.describe 'gitlab:db namespace rake task', :silence_stdout do ...@@ -129,13 +129,14 @@ RSpec.describe 'gitlab:db namespace rake task', :silence_stdout do
let(:output) { StringIO.new } let(:output) { StringIO.new }
before do before do
structure_files = %w[db/structure.sql db/ci_structure.sql] structure_files = %w[structure.sql ci_structure.sql]
allow(File).to receive(:open).and_call_original allow(File).to receive(:open).and_call_original
structure_files.each do |structure_file| structure_files.each do |structure_file_name|
structure_file = File.join(ActiveRecord::Tasks::DatabaseTasks.db_dir, structure_file_name)
stub_file_read(structure_file, content: input) stub_file_read(structure_file, content: input)
allow(File).to receive(:open).with(Rails.root.join(structure_file).to_s, any_args).and_yield(output) allow(File).to receive(:open).with(structure_file.to_s, any_args).and_yield(output)
end end
end end
......
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