blob: 54cf34506928fdcc4db1a17b5ea8bfa3618133cc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
# frozen_string_literal: true
require 'spec_helper'
require_migration!
RSpec.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.not(user_type: nil).map(&:user_type)).to match_array([1, 2, 3])
end
end
|