2020-06-02 08:08:33 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
RSpec.describe Integration do
|
2020-10-06 20:08:24 -04:00
|
|
|
let_it_be(:project_1) { create(:project) }
|
|
|
|
let_it_be(:project_2) { create(:project) }
|
|
|
|
let_it_be(:project_3) { create(:project) }
|
|
|
|
let_it_be(:instance_integration) { create(:jira_service, :instance) }
|
2020-06-02 08:08:33 -04:00
|
|
|
|
|
|
|
before do
|
|
|
|
create(:jira_service, project: project_1, inherit_from_id: instance_integration.id)
|
|
|
|
create(:jira_service, project: project_2, inherit_from_id: nil)
|
2020-09-29 11:10:08 -04:00
|
|
|
create(:slack_service, project: project_3, inherit_from_id: nil)
|
2020-06-02 08:08:33 -04:00
|
|
|
end
|
|
|
|
|
2020-09-29 11:10:08 -04:00
|
|
|
describe '.with_custom_integration_for' do
|
2020-06-02 08:08:33 -04:00
|
|
|
it 'returns projects with custom integrations' do
|
2020-06-04 08:08:21 -04:00
|
|
|
expect(Project.with_custom_integration_for(instance_integration)).to contain_exactly(project_2)
|
2020-06-02 08:08:33 -04:00
|
|
|
end
|
|
|
|
end
|
2020-06-23 14:09:28 -04:00
|
|
|
|
2020-09-29 11:10:08 -04:00
|
|
|
describe '.without_integration' do
|
|
|
|
it 'returns projects without integration' do
|
|
|
|
expect(Project.without_integration(instance_integration)).to contain_exactly(project_3)
|
2020-06-23 14:09:28 -04:00
|
|
|
end
|
|
|
|
end
|
2020-06-02 08:08:33 -04:00
|
|
|
end
|