diff options
author | Krasimir Angelov <kangelov@gitlab.com> | 2019-06-07 00:04:56 +1200 |
---|---|---|
committer | Krasimir Angelov <kangelov@gitlab.com> | 2019-06-07 00:04:56 +1200 |
commit | c0a812ecb74f1fd519d096d8be36f0a2436adc94 (patch) | |
tree | 3e22ad23f4fa99c57233e60dfc82f83e7d374fdf | |
parent | 280ac894d203a040c49cc191038fa4c51eb4e174 (diff) | |
download | gitlab-ce-c0a812ecb74f1fd519d096d8be36f0a2436adc94.tar.gz |
Fix migration specs using factories
We need to stub default_git_depth and default_git_depth= because some
old migrations specs try to create a record using schema before that
column was introduced.
3 files changed, 3 insertions, 3 deletions
diff --git a/spec/lib/gitlab/background_migration/delete_diff_files_spec.rb b/spec/lib/gitlab/background_migration/delete_diff_files_spec.rb index 22ec09d44ac..0a5b99d27e7 100644 --- a/spec/lib/gitlab/background_migration/delete_diff_files_spec.rb +++ b/spec/lib/gitlab/background_migration/delete_diff_files_spec.rb @@ -5,7 +5,7 @@ describe Gitlab::BackgroundMigration::DeleteDiffFiles, :migration, :sidekiq, sch describe '#perform' do before do # This migration was created before we introduced ProjectCiCdSetting#default_git_depth - allow_any_instance_of(ProjectCiCdSetting).to receive(:default_git_depth?).and_return(true) + allow_any_instance_of(ProjectCiCdSetting).to receive(:default_git_depth=).and_return(0) allow_any_instance_of(ProjectCiCdSetting).to receive(:default_git_depth).and_return(nil) end diff --git a/spec/lib/gitlab/background_migration/populate_external_pipeline_source_spec.rb b/spec/lib/gitlab/background_migration/populate_external_pipeline_source_spec.rb index 317745bcf83..c6bc3db88a3 100644 --- a/spec/lib/gitlab/background_migration/populate_external_pipeline_source_spec.rb +++ b/spec/lib/gitlab/background_migration/populate_external_pipeline_source_spec.rb @@ -10,8 +10,8 @@ describe Gitlab::BackgroundMigration::PopulateExternalPipelineSource, :migration # This migration was created before we introduced metadata configs stub_feature_flags(ci_build_metadata_config: false) # This migration was created before we introduced ProjectCiCdSetting#default_git_depth - allow_any_instance_of(ProjectCiCdSetting).to receive(:default_git_depth?).and_return(true) allow_any_instance_of(ProjectCiCdSetting).to receive(:default_git_depth).and_return(nil) + allow_any_instance_of(ProjectCiCdSetting).to receive(:default_git_depth=).and_return(0) end let!(:internal_pipeline) { create(:ci_pipeline, source: :web) } diff --git a/spec/migrations/remove_orphaned_label_links_spec.rb b/spec/migrations/remove_orphaned_label_links_spec.rb index 4c8135cd08c..e8c44c141c3 100644 --- a/spec/migrations/remove_orphaned_label_links_spec.rb +++ b/spec/migrations/remove_orphaned_label_links_spec.rb @@ -12,8 +12,8 @@ describe RemoveOrphanedLabelLinks, :migration do before do # This migration was created before we introduced ProjectCiCdSetting#default_git_depth - allow_any_instance_of(ProjectCiCdSetting).to receive(:default_git_depth?).and_return(true) allow_any_instance_of(ProjectCiCdSetting).to receive(:default_git_depth).and_return(nil) + allow_any_instance_of(ProjectCiCdSetting).to receive(:default_git_depth=).and_return(0) end context 'add foreign key on label_id' do |