diff options
Diffstat (limited to 'spec/graphql/types/projects')
5 files changed, 58 insertions, 16 deletions
diff --git a/spec/graphql/types/projects/base_service_type_spec.rb b/spec/graphql/types/projects/base_service_type_spec.rb index 423cea860d7..43a680bc9c2 100644 --- a/spec/graphql/types/projects/base_service_type_spec.rb +++ b/spec/graphql/types/projects/base_service_type_spec.rb @@ -6,7 +6,7 @@ RSpec.describe GitlabSchema.types['BaseService'] do specify { expect(described_class.graphql_name).to eq('BaseService') } it 'has basic expected fields' do - expect(described_class).to have_graphql_fields(:type, :active) + expect(described_class).to have_graphql_fields(:type, :active, :service_type) end specify { expect(described_class).to require_graphql_authorizations(:admin_project) } diff --git a/spec/graphql/types/projects/jira_service_type_spec.rb b/spec/graphql/types/projects/jira_service_type_spec.rb index 9db580ac963..69cdcb0f46f 100644 --- a/spec/graphql/types/projects/jira_service_type_spec.rb +++ b/spec/graphql/types/projects/jira_service_type_spec.rb @@ -6,7 +6,7 @@ RSpec.describe GitlabSchema.types['JiraService'] do specify { expect(described_class.graphql_name).to eq('JiraService') } it 'has basic expected fields' do - expect(described_class).to have_graphql_fields(:type, :active, :projects) + expect(described_class).to have_graphql_fields(:type, :active, :projects, :service_type) end specify { expect(described_class).to require_graphql_authorizations(:admin_project) } diff --git a/spec/graphql/types/projects/service_type_enum_spec.rb b/spec/graphql/types/projects/service_type_enum_spec.rb new file mode 100644 index 00000000000..ead69e60f6c --- /dev/null +++ b/spec/graphql/types/projects/service_type_enum_spec.rb @@ -0,0 +1,55 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe GitlabSchema.types['ServiceType'] do + it 'exposes all the existing project services' do + expect(described_class.values.keys).to include(*core_service_enums) + end + + def core_service_enums + %w[ + ASANA_SERVICE + ASSEMBLA_SERVICE + BAMBOO_SERVICE + BUGZILLA_SERVICE + BUILDKITE_SERVICE + CAMPFIRE_SERVICE + CONFLUENCE_SERVICE + CUSTOM_ISSUE_TRACKER_SERVICE + DATADOG_SERVICE + DISCORD_SERVICE + DRONE_CI_SERVICE + EMAILS_ON_PUSH_SERVICE + EWM_SERVICE + EXTERNAL_WIKI_SERVICE + FLOWDOCK_SERVICE + HANGOUTS_CHAT_SERVICE + IRKER_SERVICE + JENKINS_SERVICE + JIRA_SERVICE + MATTERMOST_SERVICE + MATTERMOST_SLASH_COMMANDS_SERVICE + MICROSOFT_TEAMS_SERVICE + PACKAGIST_SERVICE + PIPELINES_EMAIL_SERVICE + PIVOTALTRACKER_SERVICE + PROMETHEUS_SERVICE + PUSHOVER_SERVICE + REDMINE_SERVICE + SHIMO_SERVICE + SLACK_SERVICE + SLACK_SLASH_COMMANDS_SERVICE + TEAMCITY_SERVICE + UNIFY_CIRCUIT_SERVICE + WEBEX_TEAMS_SERVICE + YOUTRACK_SERVICE + ZENTAO_SERVICE + ] + end + + it 'coerces values correctly' do + integration = build(:jenkins_integration) + expect(described_class.coerce_isolated_result(integration.type)).to eq 'JENKINS_SERVICE' + end +end diff --git a/spec/graphql/types/projects/service_type_spec.rb b/spec/graphql/types/projects/service_type_spec.rb index 0bffdfd629d..1a6a128544e 100644 --- a/spec/graphql/types/projects/service_type_spec.rb +++ b/spec/graphql/types/projects/service_type_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe Types::Projects::ServiceType do - specify { expect(described_class).to have_graphql_fields(:type, :active) } + specify { expect(described_class).to have_graphql_fields(:type, :service_type, :active) } describe ".resolve_type" do it 'resolves the corresponding type for objects' do diff --git a/spec/graphql/types/projects/services_enum_spec.rb b/spec/graphql/types/projects/services_enum_spec.rb deleted file mode 100644 index 00427e1d580..00000000000 --- a/spec/graphql/types/projects/services_enum_spec.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe GitlabSchema.types['ServiceType'] do - it 'exposes all the existing project services' do - expect(described_class.values.keys).to match_array(available_services_enum) - end - - def available_services_enum - ::Integration.available_integration_types(include_dev: false).map(&:underscore).map(&:upcase) - end -end |