summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/background_migration/backfill_snippet_repositories_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/lib/gitlab/background_migration/backfill_snippet_repositories_spec.rb')
-rw-r--r--spec/lib/gitlab/background_migration/backfill_snippet_repositories_spec.rb18
1 files changed, 11 insertions, 7 deletions
diff --git a/spec/lib/gitlab/background_migration/backfill_snippet_repositories_spec.rb b/spec/lib/gitlab/background_migration/backfill_snippet_repositories_spec.rb
index 27ae60eb278..ec2fd3cc4e0 100644
--- a/spec/lib/gitlab/background_migration/backfill_snippet_repositories_spec.rb
+++ b/spec/lib/gitlab/background_migration/backfill_snippet_repositories_spec.rb
@@ -2,14 +2,13 @@
require 'spec_helper'
-describe Gitlab::BackgroundMigration::BackfillSnippetRepositories, :migration, schema: 2020_04_20_094444 do
+RSpec.describe Gitlab::BackgroundMigration::BackfillSnippetRepositories, :migration, schema: 2020_04_20_094444 do
let(:gitlab_shell) { Gitlab::Shell.new }
let(:users) { table(:users) }
let(:snippets) { table(:snippets) }
let(:snippet_repositories) { table(:snippet_repositories) }
let(:user_state) { 'active' }
- let(:ghost) { false }
let(:user_type) { nil }
let(:user_name) { 'Test' }
@@ -20,13 +19,20 @@ describe Gitlab::BackgroundMigration::BackfillSnippetRepositories, :migration, s
username: 'test',
name: user_name,
state: user_state,
- ghost: ghost,
last_activity_on: 1.minute.ago,
user_type: user_type,
confirmed_at: 1.day.ago)
end
- let(:migration_bot) { User.migration_bot }
+ let!(:migration_bot) do
+ users.create(id: 100,
+ email: "noreply+gitlab-migration-bot%s@#{Settings.gitlab.host}",
+ user_type: HasUserType::USER_TYPES[:migration_bot],
+ name: 'GitLab Migration Bot',
+ projects_limit: 10,
+ username: 'bot')
+ end
+
let!(:snippet_with_repo) { snippets.create(id: 1, type: 'PersonalSnippet', author_id: user.id, file_name: file_name, content: content) }
let!(:snippet_with_empty_repo) { snippets.create(id: 2, type: 'PersonalSnippet', author_id: user.id, file_name: file_name, content: content) }
let!(:snippet_without_repo) { snippets.create(id: 3, type: 'PersonalSnippet', author_id: user.id, file_name: file_name, content: content) }
@@ -113,8 +119,7 @@ describe Gitlab::BackgroundMigration::BackfillSnippetRepositories, :migration, s
end
context 'when user is a ghost' do
- let(:ghost) { true }
- let(:user_type) { 'ghost' }
+ let(:user_type) { HasUserType::USER_TYPES[:ghost] }
it_behaves_like 'migration_bot user commits files'
end
@@ -255,7 +260,6 @@ describe Gitlab::BackgroundMigration::BackfillSnippetRepositories, :migration, s
username: 'test2',
name: 'Test2',
state: user_state,
- ghost: ghost,
last_activity_on: 1.minute.ago,
user_type: user_type,
confirmed_at: 1.day.ago)