Commit 39fedebd authored by Rémy Coutable's avatar Rémy Coutable

Ignore current RSpec/FactoriesInMigrationSpecs offenses

Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent 9d0d9dbf
...@@ -3,6 +3,7 @@ require Rails.root.join('ee', 'db', 'post_migrate', '20170811082658_remove_syste ...@@ -3,6 +3,7 @@ require Rails.root.join('ee', 'db', 'post_migrate', '20170811082658_remove_syste
describe RemoveSystemHookFromGeoNodes, :migration do describe RemoveSystemHookFromGeoNodes, :migration do
let(:geo_nodes) { table(:geo_nodes) } let(:geo_nodes) { table(:geo_nodes) }
let(:web_hooks) { table(:web_hooks) }
before do before do
allow_any_instance_of(WebHookService).to receive(:execute) allow_any_instance_of(WebHookService).to receive(:execute)
...@@ -13,8 +14,8 @@ describe RemoveSystemHookFromGeoNodes, :migration do ...@@ -13,8 +14,8 @@ describe RemoveSystemHookFromGeoNodes, :migration do
port: 3000 port: 3000
} }
create(:system_hook) web_hooks.create!(type: 'SystemHook')
hook_id = create(:system_hook).id hook_id = web_hooks.create!(type: 'SystemHook').id
geo_nodes.create!(node_attrs.merge(primary: true)) geo_nodes.create!(node_attrs.merge(primary: true))
geo_nodes.create!(node_attrs.merge(system_hook_id: hook_id, port: 3001)) geo_nodes.create!(node_attrs.merge(system_hook_id: hook_id, port: 3001))
......
...@@ -25,11 +25,12 @@ describe UpdateAuthorizedKeysFile, :migration do ...@@ -25,11 +25,12 @@ describe UpdateAuthorizedKeysFile, :migration do
@cutoff_datetime = UpdateAuthorizedKeysFile::DATETIME_9_3_0_RELEASED @cutoff_datetime = UpdateAuthorizedKeysFile::DATETIME_9_3_0_RELEASED
@keys = [] @keys = []
Timecop.travel(@cutoff_datetime - 1.day) do Timecop.travel(@cutoff_datetime - 1.day) do
2.times { @keys << create(:key) } # 2 keys before cutoff # 2 keys before cutoff
2.times { @keys << create(:key) } # rubocop:disable RSpec/FactoriesInMigrationSpecs
end end
Timecop.travel(@cutoff_datetime + 1.day) do Timecop.travel(@cutoff_datetime + 1.day) do
2.times { @keys << create(:key) } # 2 keys after cutoff 2.times { @keys << create(:key) } # rubocop:disable RSpec/FactoriesInMigrationSpecs
end end
end end
...@@ -50,8 +51,8 @@ describe UpdateAuthorizedKeysFile, :migration do ...@@ -50,8 +51,8 @@ describe UpdateAuthorizedKeysFile, :migration do
context 'when an SSH key exists in authorized_keys but not in the DB' do context 'when an SSH key exists in authorized_keys but not in the DB' do
before do before do
@key_to_stay = create(:key) @key_to_stay = create(:key) # rubocop:disable RSpec/FactoriesInMigrationSpecs
@key_to_delete = create(:key) @key_to_delete = create(:key) # rubocop:disable RSpec/FactoriesInMigrationSpecs
@key_to_delete.delete @key_to_delete.delete
end end
......
...@@ -4,8 +4,8 @@ require Rails.root.join('db', 'migrate', '20180201110056_add_foreign_keys_to_tod ...@@ -4,8 +4,8 @@ require Rails.root.join('db', 'migrate', '20180201110056_add_foreign_keys_to_tod
describe AddForeignKeysToTodos, :migration do describe AddForeignKeysToTodos, :migration do
let(:todos) { table(:todos) } let(:todos) { table(:todos) }
let(:project) { create(:project) } let(:project) { create(:project) } # rubocop:disable RSpec/FactoriesInMigrationSpecs
let(:user) { create(:user) } let(:user) { create(:user) } # rubocop:disable RSpec/FactoriesInMigrationSpecs
context 'add foreign key on user_id' do context 'add foreign key on user_id' do
let!(:todo_with_user) { create_todo(user_id: user.id) } let!(:todo_with_user) { create_todo(user_id: user.id) }
...@@ -34,7 +34,7 @@ describe AddForeignKeysToTodos, :migration do ...@@ -34,7 +34,7 @@ describe AddForeignKeysToTodos, :migration do
end end
context 'add foreign key on note_id' do context 'add foreign key on note_id' do
let(:note) { create(:note) } let(:note) { create(:note) } # rubocop:disable RSpec/FactoriesInMigrationSpecs
let!(:todo_with_note) { create_todo(note_id: note.id) } let!(:todo_with_note) { create_todo(note_id: note.id) }
let!(:todo_with_invalid_note) { create_todo(note_id: 4711) } let!(:todo_with_invalid_note) { create_todo(note_id: 4711) }
let!(:todo_without_note) { create_todo(note_id: nil) } let!(:todo_without_note) { create_todo(note_id: nil) }
......
...@@ -6,18 +6,18 @@ describe AddHeadPipelineForEachMergeRequest, :delete do ...@@ -6,18 +6,18 @@ describe AddHeadPipelineForEachMergeRequest, :delete do
let(:migration) { described_class.new } let(:migration) { described_class.new }
let!(:project) { create(:project) } let!(:project) { create(:project) } # rubocop:disable RSpec/FactoriesInMigrationSpecs
let!(:other_project) { fork_project(project) } let!(:other_project) { fork_project(project) }
let!(:pipeline_1) { create(:ci_pipeline, project: project, ref: "branch_1") } let!(:pipeline_1) { create(:ci_pipeline, project: project, ref: "branch_1") } # rubocop:disable RSpec/FactoriesInMigrationSpecs
let!(:pipeline_2) { create(:ci_pipeline, project: other_project, ref: "branch_1") } let!(:pipeline_2) { create(:ci_pipeline, project: other_project, ref: "branch_1") } # rubocop:disable RSpec/FactoriesInMigrationSpecs
let!(:pipeline_3) { create(:ci_pipeline, project: other_project, ref: "branch_1") } let!(:pipeline_3) { create(:ci_pipeline, project: other_project, ref: "branch_1") } # rubocop:disable RSpec/FactoriesInMigrationSpecs
let!(:pipeline_4) { create(:ci_pipeline, project: project, ref: "branch_2") } let!(:pipeline_4) { create(:ci_pipeline, project: project, ref: "branch_2") } # rubocop:disable RSpec/FactoriesInMigrationSpecs
let!(:mr_1) { create(:merge_request, source_project: project, target_project: project, source_branch: "branch_1", target_branch: "target_1") } let!(:mr_1) { create(:merge_request, source_project: project, target_project: project, source_branch: "branch_1", target_branch: "target_1") } # rubocop:disable RSpec/FactoriesInMigrationSpecs
let!(:mr_2) { create(:merge_request, source_project: other_project, target_project: project, source_branch: "branch_1", target_branch: "target_2") } let!(:mr_2) { create(:merge_request, source_project: other_project, target_project: project, source_branch: "branch_1", target_branch: "target_2") } # rubocop:disable RSpec/FactoriesInMigrationSpecs
let!(:mr_3) { create(:merge_request, source_project: project, target_project: project, source_branch: "branch_2", target_branch: "master") } let!(:mr_3) { create(:merge_request, source_project: project, target_project: project, source_branch: "branch_2", target_branch: "master") } # rubocop:disable RSpec/FactoriesInMigrationSpecs
let!(:mr_4) { create(:merge_request, source_project: project, target_project: project, source_branch: "branch_3", target_branch: "master") } let!(:mr_4) { create(:merge_request, source_project: project, target_project: project, source_branch: "branch_3", target_branch: "master") } # rubocop:disable RSpec/FactoriesInMigrationSpecs
context "#up" do context "#up" do
context "when source_project and source_branch of pipeline are the same of merge request" do context "when source_project and source_branch of pipeline are the same of merge request" do
......
...@@ -6,7 +6,7 @@ require Rails.root.join('db', 'post_migrate', '20170803090603_calculate_conv_dev ...@@ -6,7 +6,7 @@ require Rails.root.join('db', 'post_migrate', '20170803090603_calculate_conv_dev
describe CalculateConvDevIndexPercentages, :delete do describe CalculateConvDevIndexPercentages, :delete do
let(:migration) { described_class.new } let(:migration) { described_class.new }
let!(:conv_dev_index) do let!(:conv_dev_index) do
create(:conversational_development_index_metric, create(:conversational_development_index_metric, # rubocop:disable RSpec/FactoriesInMigrationSpecs
leader_notes: 0, leader_notes: 0,
instance_milestones: 0, instance_milestones: 0,
percentage_issues: 0, percentage_issues: 0,
......
...@@ -10,9 +10,9 @@ describe CleanupNamespacelessPendingDeleteProjects, :migration, schema: 20180222 ...@@ -10,9 +10,9 @@ describe CleanupNamespacelessPendingDeleteProjects, :migration, schema: 20180222
describe '#up' do describe '#up' do
it 'only cleans up pending delete projects' do it 'only cleans up pending delete projects' do
create(:project) create(:project) # rubocop:disable RSpec/FactoriesInMigrationSpecs
create(:project, pending_delete: true) create(:project, pending_delete: true) # rubocop:disable RSpec/FactoriesInMigrationSpecs
project = build(:project, pending_delete: true, namespace_id: nil) project = build(:project, pending_delete: true, namespace_id: nil) # rubocop:disable RSpec/FactoriesInMigrationSpecs
project.save(validate: false) project.save(validate: false)
expect(NamespacelessProjectDestroyWorker).to receive(:bulk_perform_async).with([[project.id]]) expect(NamespacelessProjectDestroyWorker).to receive(:bulk_perform_async).with([[project.id]])
...@@ -21,8 +21,8 @@ describe CleanupNamespacelessPendingDeleteProjects, :migration, schema: 20180222 ...@@ -21,8 +21,8 @@ describe CleanupNamespacelessPendingDeleteProjects, :migration, schema: 20180222
end end
it 'does nothing when no pending delete projects without namespace found' do it 'does nothing when no pending delete projects without namespace found' do
create(:project) create(:project) # rubocop:disable RSpec/FactoriesInMigrationSpecs
create(:project, pending_delete: true) create(:project, pending_delete: true) # rubocop:disable RSpec/FactoriesInMigrationSpecs
expect(NamespacelessProjectDestroyWorker).not_to receive(:bulk_perform_async) expect(NamespacelessProjectDestroyWorker).not_to receive(:bulk_perform_async)
......
...@@ -9,11 +9,11 @@ describe CleanupNonexistingNamespacePendingDeleteProjects do ...@@ -9,11 +9,11 @@ describe CleanupNonexistingNamespacePendingDeleteProjects do
end end
describe '#up' do describe '#up' do
set(:some_project) { create(:project) } set(:some_project) { create(:project) } # rubocop:disable RSpec/FactoriesInMigrationSpecs
it 'only cleans up when namespace does not exist' do it 'only cleans up when namespace does not exist' do
create(:project, pending_delete: true) create(:project, pending_delete: true) # rubocop:disable RSpec/FactoriesInMigrationSpecs
project = build(:project, pending_delete: true, namespace: nil, namespace_id: Namespace.maximum(:id).to_i.succ) project = build(:project, pending_delete: true, namespace: nil, namespace_id: Namespace.maximum(:id).to_i.succ) # rubocop:disable RSpec/FactoriesInMigrationSpecs
project.save(validate: false) project.save(validate: false)
expect(NamespacelessProjectDestroyWorker).to receive(:bulk_perform_async).with([[project.id]]) expect(NamespacelessProjectDestroyWorker).to receive(:bulk_perform_async).with([[project.id]])
...@@ -22,7 +22,7 @@ describe CleanupNonexistingNamespacePendingDeleteProjects do ...@@ -22,7 +22,7 @@ describe CleanupNonexistingNamespacePendingDeleteProjects do
end end
it 'does nothing when no pending delete projects without namespace found' do it 'does nothing when no pending delete projects without namespace found' do
create(:project, pending_delete: true, namespace: create(:namespace)) create(:project, pending_delete: true, namespace: create(:namespace)) # rubocop:disable RSpec/FactoriesInMigrationSpecs
expect(NamespacelessProjectDestroyWorker).not_to receive(:bulk_perform_async) expect(NamespacelessProjectDestroyWorker).not_to receive(:bulk_perform_async)
......
...@@ -5,9 +5,9 @@ require Rails.root.join('db', 'migrate', '20171106151218_issues_moved_to_id_fore ...@@ -5,9 +5,9 @@ require Rails.root.join('db', 'migrate', '20171106151218_issues_moved_to_id_fore
# only_mirror_protected_branches column in the projects table to create a # only_mirror_protected_branches column in the projects table to create a
# project via FactoryBot. # project via FactoryBot.
describe IssuesMovedToIdForeignKey, :migration, schema: 20171114150259 do describe IssuesMovedToIdForeignKey, :migration, schema: 20171114150259 do
let!(:issue_first) { create(:issue, moved_to_id: issue_second.id) } let!(:issue_first) { create(:issue, moved_to_id: issue_second.id) } # rubocop:disable RSpec/FactoriesInMigrationSpecs
let!(:issue_second) { create(:issue, moved_to_id: issue_third.id) } let!(:issue_second) { create(:issue, moved_to_id: issue_third.id) } # rubocop:disable RSpec/FactoriesInMigrationSpecs
let!(:issue_third) { create(:issue) } let!(:issue_third) { create(:issue) } # rubocop:disable RSpec/FactoriesInMigrationSpecs
subject { described_class.new } subject { described_class.new }
......
...@@ -16,18 +16,18 @@ describe MigrateOldArtifacts do ...@@ -16,18 +16,18 @@ describe MigrateOldArtifacts do
end end
context 'with migratable data' do context 'with migratable data' do
set(:project1) { create(:project, ci_id: 2) } set(:project1) { create(:project, ci_id: 2) } # rubocop:disable RSpec/FactoriesInMigrationSpecs
set(:project2) { create(:project, ci_id: 3) } set(:project2) { create(:project, ci_id: 3) } # rubocop:disable RSpec/FactoriesInMigrationSpecs
set(:project3) { create(:project) } set(:project3) { create(:project) } # rubocop:disable RSpec/FactoriesInMigrationSpecs
set(:pipeline1) { create(:ci_empty_pipeline, project: project1) } set(:pipeline1) { create(:ci_empty_pipeline, project: project1) } # rubocop:disable RSpec/FactoriesInMigrationSpecs
set(:pipeline2) { create(:ci_empty_pipeline, project: project2) } set(:pipeline2) { create(:ci_empty_pipeline, project: project2) } # rubocop:disable RSpec/FactoriesInMigrationSpecs
set(:pipeline3) { create(:ci_empty_pipeline, project: project3) } set(:pipeline3) { create(:ci_empty_pipeline, project: project3) } # rubocop:disable RSpec/FactoriesInMigrationSpecs
let!(:build_with_legacy_artifacts) { create(:ci_build, pipeline: pipeline1) } let!(:build_with_legacy_artifacts) { create(:ci_build, pipeline: pipeline1) } # rubocop:disable RSpec/FactoriesInMigrationSpecs
let!(:build_without_artifacts) { create(:ci_build, pipeline: pipeline1) } let!(:build_without_artifacts) { create(:ci_build, pipeline: pipeline1) } # rubocop:disable RSpec/FactoriesInMigrationSpecs
let!(:build2) { create(:ci_build, pipeline: pipeline2) } let!(:build2) { create(:ci_build, pipeline: pipeline2) } # rubocop:disable RSpec/FactoriesInMigrationSpecs
let!(:build3) { create(:ci_build, pipeline: pipeline3) } let!(:build3) { create(:ci_build, pipeline: pipeline3) } # rubocop:disable RSpec/FactoriesInMigrationSpecs
before do before do
setup_builds(build2, build3) setup_builds(build2, build3)
......
...@@ -4,8 +4,8 @@ require 'spec_helper' ...@@ -4,8 +4,8 @@ require 'spec_helper'
require Rails.root.join('db', 'migrate', '20161124141322_migrate_process_commit_worker_jobs.rb') require Rails.root.join('db', 'migrate', '20161124141322_migrate_process_commit_worker_jobs.rb')
describe MigrateProcessCommitWorkerJobs do describe MigrateProcessCommitWorkerJobs do
let(:project) { create(:project, :legacy_storage, :repository) } let(:project) { create(:project, :legacy_storage, :repository) } # rubocop:disable RSpec/FactoriesInMigrationSpecs
let(:user) { create(:user) } let(:user) { create(:user) } # rubocop:disable RSpec/FactoriesInMigrationSpecs
let(:commit) { project.commit.raw.rugged_commit } let(:commit) { project.commit.raw.rugged_commit }
describe 'Project' do describe 'Project' do
......
...@@ -5,8 +5,8 @@ require Rails.root.join('db', 'post_migrate', '20170324160416_migrate_user_activ ...@@ -5,8 +5,8 @@ require Rails.root.join('db', 'post_migrate', '20170324160416_migrate_user_activ
describe MigrateUserActivitiesToUsersLastActivityOn, :clean_gitlab_redis_shared_state, :delete do describe MigrateUserActivitiesToUsersLastActivityOn, :clean_gitlab_redis_shared_state, :delete do
let(:migration) { described_class.new } let(:migration) { described_class.new }
let!(:user_active_1) { create(:user) } let!(:user_active_1) { create(:user) } # rubocop:disable RSpec/FactoriesInMigrationSpecs
let!(:user_active_2) { create(:user) } let!(:user_active_2) { create(:user) } # rubocop:disable RSpec/FactoriesInMigrationSpecs
def record_activity(user, time) def record_activity(user, time)
Gitlab::Redis::SharedState.with do |redis| Gitlab::Redis::SharedState.with do |redis|
......
...@@ -5,7 +5,7 @@ require Rails.root.join('db', 'post_migrate', '20170406142253_migrate_user_proje ...@@ -5,7 +5,7 @@ require Rails.root.join('db', 'post_migrate', '20170406142253_migrate_user_proje
describe MigrateUserProjectView, :delete do describe MigrateUserProjectView, :delete do
let(:migration) { described_class.new } let(:migration) { described_class.new }
let!(:user) { create(:user, project_view: 'readme') } let!(:user) { create(:user, project_view: 'readme') } # rubocop:disable RSpec/FactoriesInMigrationSpecs
describe '#up' do describe '#up' do
it 'updates project view setting with new value' do it 'updates project view setting with new value' do
......
...@@ -16,14 +16,14 @@ describe MovePersonalSnippetsFiles do ...@@ -16,14 +16,14 @@ describe MovePersonalSnippetsFiles do
describe "#up" do describe "#up" do
let(:snippet) do let(:snippet) do
snippet = create(:personal_snippet) snippet = create(:personal_snippet) # rubocop:disable RSpec/FactoriesInMigrationSpecs
create_upload('picture.jpg', snippet) create_upload('picture.jpg', snippet)
snippet.update(description: markdown_linking_file('picture.jpg', snippet)) snippet.update(description: markdown_linking_file('picture.jpg', snippet))
snippet snippet
end end
let(:snippet_with_missing_file) do let(:snippet_with_missing_file) do
snippet = create(:snippet) snippet = create(:snippet) # rubocop:disable RSpec/FactoriesInMigrationSpecs
create_upload('picture.jpg', snippet, create_file: false) create_upload('picture.jpg', snippet, create_file: false)
snippet.update(description: markdown_linking_file('picture.jpg', snippet)) snippet.update(description: markdown_linking_file('picture.jpg', snippet))
snippet snippet
...@@ -62,7 +62,7 @@ describe MovePersonalSnippetsFiles do ...@@ -62,7 +62,7 @@ describe MovePersonalSnippetsFiles do
secret = "secret#{snippet.id}" secret = "secret#{snippet.id}"
file_location = "/uploads/-/system/personal_snippet/#{snippet.id}/#{secret}/picture.jpg" file_location = "/uploads/-/system/personal_snippet/#{snippet.id}/#{secret}/picture.jpg"
markdown = markdown_linking_file('picture.jpg', snippet) markdown = markdown_linking_file('picture.jpg', snippet)
note = create(:note_on_personal_snippet, noteable: snippet, note: "with #{markdown}") note = create(:note_on_personal_snippet, noteable: snippet, note: "with #{markdown}") # rubocop:disable RSpec/FactoriesInMigrationSpecs
migration.up migration.up
...@@ -73,14 +73,14 @@ describe MovePersonalSnippetsFiles do ...@@ -73,14 +73,14 @@ describe MovePersonalSnippetsFiles do
describe "#down" do describe "#down" do
let(:snippet) do let(:snippet) do
snippet = create(:personal_snippet) snippet = create(:personal_snippet) # rubocop:disable RSpec/FactoriesInMigrationSpecs
create_upload('picture.jpg', snippet, in_new_path: true) create_upload('picture.jpg', snippet, in_new_path: true)
snippet.update(description: markdown_linking_file('picture.jpg', snippet, in_new_path: true)) snippet.update(description: markdown_linking_file('picture.jpg', snippet, in_new_path: true))
snippet snippet
end end
let(:snippet_with_missing_file) do let(:snippet_with_missing_file) do
snippet = create(:personal_snippet) snippet = create(:personal_snippet) # rubocop:disable RSpec/FactoriesInMigrationSpecs
create_upload('picture.jpg', snippet, create_file: false, in_new_path: true) create_upload('picture.jpg', snippet, create_file: false, in_new_path: true)
snippet.update(description: markdown_linking_file('picture.jpg', snippet, in_new_path: true)) snippet.update(description: markdown_linking_file('picture.jpg', snippet, in_new_path: true))
snippet snippet
...@@ -119,7 +119,7 @@ describe MovePersonalSnippetsFiles do ...@@ -119,7 +119,7 @@ describe MovePersonalSnippetsFiles do
markdown = markdown_linking_file('picture.jpg', snippet, in_new_path: true) markdown = markdown_linking_file('picture.jpg', snippet, in_new_path: true)
secret = "secret#{snippet.id}" secret = "secret#{snippet.id}"
file_location = "/uploads/personal_snippet/#{snippet.id}/#{secret}/picture.jpg" file_location = "/uploads/personal_snippet/#{snippet.id}/#{secret}/picture.jpg"
note = create(:note_on_personal_snippet, noteable: snippet, note: "with #{markdown}") note = create(:note_on_personal_snippet, noteable: snippet, note: "with #{markdown}") # rubocop:disable RSpec/FactoriesInMigrationSpecs
migration.down migration.down
...@@ -135,7 +135,7 @@ describe MovePersonalSnippetsFiles do ...@@ -135,7 +135,7 @@ describe MovePersonalSnippetsFiles do
secret = '123456789' secret = '123456789'
filename = 'hello.jpg' filename = 'hello.jpg'
snippet = create(:personal_snippet) snippet = create(:personal_snippet) # rubocop:disable RSpec/FactoriesInMigrationSpecs
path_before = "/uploads/personal_snippet/#{snippet.id}/#{secret}/#{filename}" path_before = "/uploads/personal_snippet/#{snippet.id}/#{secret}/#{filename}"
path_after = "/uploads/system/personal_snippet/#{snippet.id}/#{secret}/#{filename}" path_after = "/uploads/system/personal_snippet/#{snippet.id}/#{secret}/#{filename}"
...@@ -161,7 +161,7 @@ describe MovePersonalSnippetsFiles do ...@@ -161,7 +161,7 @@ describe MovePersonalSnippetsFiles do
FileUtils.touch(absolute_path) FileUtils.touch(absolute_path)
end end
create(:upload, model: snippet, path: "#{secret}/#{filename}", uploader: PersonalFileUploader) create(:upload, model: snippet, path: "#{secret}/#{filename}", uploader: PersonalFileUploader) # rubocop:disable RSpec/FactoriesInMigrationSpecs
end end
def markdown_linking_file(filename, snippet, in_new_path: false) def markdown_linking_file(filename, snippet, in_new_path: false)
......
...@@ -4,7 +4,7 @@ require 'spec_helper' ...@@ -4,7 +4,7 @@ require 'spec_helper'
require Rails.root.join('db', 'migrate', '20161226122833_remove_dot_git_from_usernames.rb') require Rails.root.join('db', 'migrate', '20161226122833_remove_dot_git_from_usernames.rb')
describe RemoveDotGitFromUsernames do describe RemoveDotGitFromUsernames do
let(:user) { create(:user) } let(:user) { create(:user) } # rubocop:disable RSpec/FactoriesInMigrationSpecs
let(:migration) { described_class.new } let(:migration) { described_class.new }
describe '#up' do describe '#up' do
...@@ -23,7 +23,7 @@ describe RemoveDotGitFromUsernames do ...@@ -23,7 +23,7 @@ describe RemoveDotGitFromUsernames do
context 'when new path exists already' do context 'when new path exists already' do
describe '#up' do describe '#up' do
let(:user2) { create(:user) } let(:user2) { create(:user) } # rubocop:disable RSpec/FactoriesInMigrationSpecs
before do before do
update_namespace(user, 'test.git') update_namespace(user, 'test.git')
......
...@@ -5,17 +5,17 @@ describe RemoveDuplicateMrEvents, :delete do ...@@ -5,17 +5,17 @@ describe RemoveDuplicateMrEvents, :delete do
let(:migration) { described_class.new } let(:migration) { described_class.new }
describe '#up' do describe '#up' do
let(:user) { create(:user) } let(:user) { create(:user) } # rubocop:disable RSpec/FactoriesInMigrationSpecs
let(:merge_requests) { create_list(:merge_request, 2) } let(:merge_requests) { create_list(:merge_request, 2) } # rubocop:disable RSpec/FactoriesInMigrationSpecs
let(:issue) { create(:issue) } let(:issue) { create(:issue) } # rubocop:disable RSpec/FactoriesInMigrationSpecs
let!(:events) do let!(:events) do
[ [
create(:event, :created, author: user, target: merge_requests.first), create(:event, :created, author: user, target: merge_requests.first), # rubocop:disable RSpec/FactoriesInMigrationSpecs
create(:event, :created, author: user, target: merge_requests.first), create(:event, :created, author: user, target: merge_requests.first), # rubocop:disable RSpec/FactoriesInMigrationSpecs
create(:event, :updated, author: user, target: merge_requests.first), create(:event, :updated, author: user, target: merge_requests.first), # rubocop:disable RSpec/FactoriesInMigrationSpecs
create(:event, :created, author: user, target: merge_requests.second), create(:event, :created, author: user, target: merge_requests.second), # rubocop:disable RSpec/FactoriesInMigrationSpecs
create(:event, :created, author: user, target: issue), create(:event, :created, author: user, target: issue), # rubocop:disable RSpec/FactoriesInMigrationSpecs
create(:event, :created, author: user, target: issue) create(:event, :created, author: user, target: issue) # rubocop:disable RSpec/FactoriesInMigrationSpecs
] ]
end end
......
...@@ -5,9 +5,9 @@ require Rails.root.join('db', 'post_migrate', '20180202111106_remove_project_lab ...@@ -5,9 +5,9 @@ require Rails.root.join('db', 'post_migrate', '20180202111106_remove_project_lab
describe RemoveProjectLabelsGroupId, :delete do describe RemoveProjectLabelsGroupId, :delete do
let(:migration) { described_class.new } let(:migration) { described_class.new }
let(:group) { create(:group) } let(:group) { create(:group) } # rubocop:disable RSpec/FactoriesInMigrationSpecs
let!(:project_label) { create(:label, group_id: group.id) } let!(:project_label) { create(:label, group_id: group.id) } # rubocop:disable RSpec/FactoriesInMigrationSpecs
let!(:group_label) { create(:group_label) } let!(:group_label) { create(:group_label) } # rubocop:disable RSpec/FactoriesInMigrationSpecs
describe '#up' do describe '#up' do
it 'updates the project labels group ID' do it 'updates the project labels group ID' do
......
...@@ -20,7 +20,7 @@ describe RemoveSoftRemovedObjects, :migration do ...@@ -20,7 +20,7 @@ describe RemoveSoftRemovedObjects, :migration do
create_with_deleted_at(:issue) create_with_deleted_at(:issue)
end end
regular_issue = create(:issue) regular_issue = create(:issue) # rubocop:disable RSpec/FactoriesInMigrationSpecs
run_migration run_migration
...@@ -54,8 +54,7 @@ describe RemoveSoftRemovedObjects, :migration do ...@@ -54,8 +54,7 @@ describe RemoveSoftRemovedObjects, :migration do
it 'schedules the removal of soft removed groups' do it 'schedules the removal of soft removed groups' do
group = create_deleted_group group = create_deleted_group
admin = create(:user, admin: true) # rubocop:disable RSpec/FactoriesInMigrationSpecs
admin = create(:user, admin: true)
expect_any_instance_of(GroupDestroyWorker) expect_any_instance_of(GroupDestroyWorker)
.to receive(:perform) .to receive(:perform)
...@@ -81,7 +80,7 @@ describe RemoveSoftRemovedObjects, :migration do ...@@ -81,7 +80,7 @@ describe RemoveSoftRemovedObjects, :migration do
end end
def create_with_deleted_at(*args) def create_with_deleted_at(*args)
row = create(*args) row = create(*args) # rubocop:disable RSpec/FactoriesInMigrationSpecs
# We set "deleted_at" this way so we don't run into any column cache issues. # We set "deleted_at" this way so we don't run into any column cache issues.
row.class.where(id: row.id).update_all(deleted_at: 1.year.ago) row.class.where(id: row.id).update_all(deleted_at: 1.year.ago)
......
...@@ -8,7 +8,7 @@ require Rails.root.join('db', 'post_migrate', '20170313133418_rename_more_reserv ...@@ -8,7 +8,7 @@ require Rails.root.join('db', 'post_migrate', '20170313133418_rename_more_reserv
# around this we use the DELETE cleaning strategy. # around this we use the DELETE cleaning strategy.
describe RenameMoreReservedProjectNames, :delete do describe RenameMoreReservedProjectNames, :delete do
let(:migration) { described_class.new } let(:migration) { described_class.new }
let!(:project) { create(:project) } let!(:project) { create(:project) } # rubocop:disable RSpec/FactoriesInMigrationSpecs
before do before do
project.path = 'artifacts' project.path = 'artifacts'
......
...@@ -12,7 +12,7 @@ require Rails.root.join('db', 'post_migrate', '20161221153951_rename_reserved_pr ...@@ -12,7 +12,7 @@ require Rails.root.join('db', 'post_migrate', '20161221153951_rename_reserved_pr
# Ideally, the test should not use factories and rely on the `table` helper instead. # Ideally, the test should not use factories and rely on the `table` helper instead.
describe RenameReservedProjectNames, :migration, schema: :latest do describe RenameReservedProjectNames, :migration, schema: :latest do
let(:migration) { described_class.new } let(:migration) { described_class.new }
let!(:project) { create(:project) } let!(:project) { create(:project) } # rubocop:disable RSpec/FactoriesInMigrationSpecs
before do before do
project.path = 'projects' project.path = 'projects'
......
...@@ -3,12 +3,12 @@ require Rails.root.join('db', 'post_migrate', '20170518200835_rename_users_with_ ...@@ -3,12 +3,12 @@ require Rails.root.join('db', 'post_migrate', '20170518200835_rename_users_with_
describe RenameUsersWithRenamedNamespace, :delete do describe RenameUsersWithRenamedNamespace, :delete do
it 'renames a user that had their namespace renamed to the namespace path' do it 'renames a user that had their namespace renamed to the namespace path' do
other_user = create(:user, username: 'kodingu') other_user = create(:user, username: 'kodingu') # rubocop:disable RSpec/FactoriesInMigrationSpecs
other_user1 = create(:user, username: 'api0') other_user1 = create(:user, username: 'api0') # rubocop:disable RSpec/FactoriesInMigrationSpecs
user = create(:user, username: "Users0") user = create(:user, username: "Users0") # rubocop:disable RSpec/FactoriesInMigrationSpecs
user.update_column(:username, 'Users') user.update_column(:username, 'Users')
user1 = create(:user, username: "import0") user1 = create(:user, username: "import0") # rubocop:disable RSpec/FactoriesInMigrationSpecs
user1.update_column(:username, 'import') user1.update_column(:username, 'import')
described_class.new.up described_class.new.up
......
...@@ -3,8 +3,8 @@ require Rails.root.join('db', 'post_migrate', '20171005130944_schedule_create_gp ...@@ -3,8 +3,8 @@ require Rails.root.join('db', 'post_migrate', '20171005130944_schedule_create_gp
describe ScheduleCreateGpgKeySubkeysFromGpgKeys, :migration, :sidekiq do describe ScheduleCreateGpgKeySubkeysFromGpgKeys, :migration, :sidekiq do
before do before do
create(:gpg_key, id: 1, key: GpgHelpers::User1.public_key) create(:gpg_key, id: 1, key: GpgHelpers::User1.public_key) # rubocop:disable RSpec/FactoriesInMigrationSpecs
create(:gpg_key, id: 2, key: GpgHelpers::User3.public_key) create(:gpg_key, id: 2, key: GpgHelpers::User3.public_key) # rubocop:disable RSpec/FactoriesInMigrationSpecs
# Delete all subkeys so they can be recreated # Delete all subkeys so they can be recreated
GpgKeySubkey.destroy_all GpgKeySubkey.destroy_all
end end
......
...@@ -8,7 +8,7 @@ describe SchedulePopulateMergeRequestMetricsWithEventsData, :migration, :sidekiq ...@@ -8,7 +8,7 @@ describe SchedulePopulateMergeRequestMetricsWithEventsData, :migration, :sidekiq
.to receive(:commits_count=).and_return(nil) .to receive(:commits_count=).and_return(nil)
end end
let!(:mrs) { create_list(:merge_request, 3) } let!(:mrs) { create_list(:merge_request, 3) } # rubocop:disable RSpec/FactoriesInMigrationSpecs
it 'correctly schedules background migrations' do it 'correctly schedules background migrations' do
stub_const("#{described_class.name}::BATCH_SIZE", 2) stub_const("#{described_class.name}::BATCH_SIZE", 2)
......
...@@ -2,10 +2,10 @@ require 'spec_helper' ...@@ -2,10 +2,10 @@ require 'spec_helper'
require Rails.root.join('db', 'migrate', '20170503140202_turn_nested_groups_into_regular_groups_for_mysql.rb') require Rails.root.join('db', 'migrate', '20170503140202_turn_nested_groups_into_regular_groups_for_mysql.rb')
describe TurnNestedGroupsIntoRegularGroupsForMysql do describe TurnNestedGroupsIntoRegularGroupsForMysql do
let!(:parent_group) { create(:group) } let!(:parent_group) { create(:group) } # rubocop:disable RSpec/FactoriesInMigrationSpecs
let!(:child_group) { create(:group, parent: parent_group) } let!(:child_group) { create(:group, parent: parent_group) } # rubocop:disable RSpec/FactoriesInMigrationSpecs
let!(:project) { create(:project, :legacy_storage, :empty_repo, namespace: child_group) } let!(:project) { create(:project, :legacy_storage, :empty_repo, namespace: child_group) } # rubocop:disable RSpec/FactoriesInMigrationSpecs
let!(:member) { create(:user) } let!(:member) { create(:user) } # rubocop:disable RSpec/FactoriesInMigrationSpecs
let(:migration) { described_class.new } let(:migration) { described_class.new }
before do before do
......
...@@ -2,9 +2,9 @@ require 'spec_helper' ...@@ -2,9 +2,9 @@ require 'spec_helper'
require Rails.root.join('db', 'post_migrate', '20170503004427_update_retried_for_ci_build.rb') require Rails.root.join('db', 'post_migrate', '20170503004427_update_retried_for_ci_build.rb')
describe UpdateRetriedForCiBuild, :delete do describe UpdateRetriedForCiBuild, :delete do
let(:pipeline) { create(:ci_pipeline) } let(:pipeline) { create(:ci_pipeline) } # rubocop:disable RSpec/FactoriesInMigrationSpecs
let!(:build_old) { create(:ci_build, pipeline: pipeline, name: 'test') } let!(:build_old) { create(:ci_build, pipeline: pipeline, name: 'test') } # rubocop:disable RSpec/FactoriesInMigrationSpecs
let!(:build_new) { create(:ci_build, pipeline: pipeline, name: 'test') } let!(:build_new) { create(:ci_build, pipeline: pipeline, name: 'test') } # rubocop:disable RSpec/FactoriesInMigrationSpecs
before do before do
described_class.new.up described_class.new.up
......
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