debian-mirror-gitlab/spec/requests/api/graphql/project/jira_service_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

44 lines
1.1 KiB
Ruby
Raw Normal View History

2020-04-22 19:07:51 +05:30
# frozen_string_literal: true
require 'spec_helper'
2023-03-04 22:38:38 +05:30
RSpec.describe 'query Jira service', feature_category: :integrations do
2020-04-22 19:07:51 +05:30
include GraphqlHelpers
let_it_be(:current_user) { create(:user) }
let_it_be(:project) { create(:project) }
2021-09-30 23:02:18 +05:30
let_it_be(:jira_integration) { create(:jira_integration, project: project) }
2020-04-22 19:07:51 +05:30
let(:query) do
%(
query {
project(fullPath: "#{project.full_path}") {
services(active: true, type: JIRA_SERVICE) {
nodes {
type
2022-05-07 20:08:51 +05:30
serviceType
2020-04-22 19:07:51 +05:30
}
}
}
}
)
end
2022-05-07 20:08:51 +05:30
let(:services) { graphql_data.dig('project', 'services', 'nodes') }
2020-04-22 19:07:51 +05:30
it_behaves_like 'unauthorized users cannot read services'
context 'when user can access project services' do
before do
project.add_maintainer(current_user)
post_graphql(query, current_user: current_user)
end
it_behaves_like 'a working graphql query'
2022-05-07 20:08:51 +05:30
it 'returns list of jira integrations' do
expect(services).to contain_exactly({ 'type' => 'JiraService', 'serviceType' => 'JIRA_SERVICE' })
2020-04-22 19:07:51 +05:30
end
end
end