blob: 577fea984dae226843c38783b3324f95af367ae9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# frozen_string_literal: true
require 'spec_helper'
require_migration!
RSpec.describe DeleteTemplateServicesDuplicatedByType do
let(:services) { table(:services) }
before do
services.create!(template: true, type: 'JenkinsService')
services.create!(template: true, type: 'JenkinsService')
services.create!(template: true, type: 'JiraService')
services.create!(template: true, type: 'JenkinsService')
end
it 'deletes service templates duplicated by type except the one with the lowest ID' do
jenkins_integration_id = services.where(type: 'JenkinsService').order(:id).pluck(:id).first
jira_integration_id = services.where(type: 'JiraService').pluck(:id).first
migrate!
expect(services.pluck(:id)).to contain_exactly(jenkins_integration_id, jira_integration_id)
end
end
|