2020-06-02 08:08:33 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
RSpec.describe Integration do
|
2020-06-23 14:09:28 -04:00
|
|
|
let!(:project_1) { create(:project) }
|
|
|
|
let!(:project_2) { create(:project) }
|
|
|
|
let!(:project_3) { create(:project) }
|
2020-06-02 08:08:33 -04:00
|
|
|
let(:instance_integration) { create(:jira_service, :instance) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
create(:jira_service, project: project_1, inherit_from_id: instance_integration.id)
|
|
|
|
create(:jira_service, project: project_2, inherit_from_id: nil)
|
|
|
|
create(:slack_service, project: project_1, inherit_from_id: nil)
|
|
|
|
end
|
|
|
|
|
2020-06-04 08:08:21 -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
|
|
|
|
|
|
|
describe '#ids_without_integration' do
|
|
|
|
it 'returns projects ids without an integration' do
|
|
|
|
expect(Project.ids_without_integration(instance_integration, 100)).to contain_exactly(project_3.id)
|
|
|
|
end
|
|
|
|
end
|
2020-06-02 08:08:33 -04:00
|
|
|
end
|