debian-mirror-gitlab/spec/models/integration_spec.rb

29 lines
950 B
Ruby
Raw Normal View History

2020-06-23 00:09:42 +05:30
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Integration do
2021-01-03 14:25:43 +05:30
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-23 00:09:42 +05:30
before do
create(:jira_service, project: project_1, inherit_from_id: instance_integration.id)
create(:jira_service, project: project_2, inherit_from_id: nil)
2021-01-03 14:25:43 +05:30
create(:slack_service, project: project_3, inherit_from_id: nil)
2020-06-23 00:09:42 +05:30
end
2021-01-03 14:25:43 +05:30
describe '.with_custom_integration_for' do
2020-06-23 00:09:42 +05:30
it 'returns projects with custom integrations' do
expect(Project.with_custom_integration_for(instance_integration)).to contain_exactly(project_2)
end
end
2020-07-28 23:09:34 +05:30
2021-01-03 14:25:43 +05:30
describe '.without_integration' do
it 'returns projects without integration' do
expect(Project.without_integration(instance_integration)).to contain_exactly(project_3)
2020-07-28 23:09:34 +05:30
end
end
2020-06-23 00:09:42 +05:30
end