diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-18 12:09:31 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-18 12:09:31 +0300 |
commit | 6763d2787670bc03a36a8eb601703e88fc70dece (patch) | |
tree | edc653ffd3052e3f9898c4fa8a07621d51574767 /spec/migrations | |
parent | ed9165c2abda1dca048a8d3cb8030d906c0bbb0c (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/migrations')
-rw-r--r-- | spec/migrations/migrate_bot_type_to_user_type_spec.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/migrations/migrate_bot_type_to_user_type_spec.rb b/spec/migrations/migrate_bot_type_to_user_type_spec.rb new file mode 100644 index 00000000000..9686aae0cd3 --- /dev/null +++ b/spec/migrations/migrate_bot_type_to_user_type_spec.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +require 'spec_helper' + +require Rails.root.join('db', 'migrate', '20200311074438_migrate_bot_type_to_user_type.rb') + +describe MigrateBotTypeToUserType, :migration do + let(:users) { table(:users) } + + it 'updates bots & ignores humans' do + users.create!(email: 'human', bot_type: nil, projects_limit: 0) + users.create!(email: 'support_bot', bot_type: 1, projects_limit: 0) + users.create!(email: 'alert_bot', bot_type: 2, projects_limit: 0) + users.create!(email: 'visual_review_bot', bot_type: 3, projects_limit: 0) + + migrate! + + expect(users.where('user_type IS NOT NULL').map(&:user_type)).to match_array([1, 2, 3]) + end +end |