2020-03-18 09:09:31 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
2021-06-11 18:10:13 +00:00
|
|
|
require_migration!
|
2020-03-18 09:09:31 +00:00
|
|
|
|
2020-06-24 18:09:03 +00:00
|
|
|
RSpec.describe MigrateBotTypeToUserType, :migration do
|
2020-03-18 09:09:31 +00:00
|
|
|
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-01 21:09:22 +00:00
|
|
|
expect(users.where.not(user_type: nil).map(&:user_type)).to match_array([1, 2, 3])
|
2020-03-18 09:09:31 +00:00
|
|
|
end
|
|
|
|
end
|