debian-mirror-gitlab/spec/migrations/migrate_bot_type_to_user_type_spec.rb

21 lines
602 B
Ruby
Raw Normal View History

2020-04-22 19:07:51 +05:30
# frozen_string_literal: true
require 'spec_helper'
2021-09-04 01:27:46 +05:30
require_migration!
2020-04-22 19:07:51 +05:30
2020-07-28 23:09:34 +05:30
RSpec.describe MigrateBotTypeToUserType, :migration do
2020-04-22 19:07:51 +05:30
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!
2021-04-29 21:17:54 +05:30
expect(users.where.not(user_type: nil).map(&:user_type)).to match_array([1, 2, 3])
2020-04-22 19:07:51 +05:30
end
end