diff options
Diffstat (limited to 'spec/graphql')
-rw-r--r-- | spec/graphql/types/ci/job_type_spec.rb | 2 | ||||
-rw-r--r-- | spec/graphql/types/ci/runner_type_spec.rb | 16 | ||||
-rw-r--r-- | spec/graphql/types/permission_types/ci/job_spec.rb | 13 | ||||
-rw-r--r-- | spec/graphql/types/query_type_spec.rb | 7 |
4 files changed, 38 insertions, 0 deletions
diff --git a/spec/graphql/types/ci/job_type_spec.rb b/spec/graphql/types/ci/job_type_spec.rb index a1107bae630..8b092584efe 100644 --- a/spec/graphql/types/ci/job_type_spec.rb +++ b/spec/graphql/types/ci/job_type_spec.rb @@ -5,6 +5,7 @@ require 'spec_helper' RSpec.describe Types::Ci::JobType do specify { expect(described_class.graphql_name).to eq('CiJob') } specify { expect(described_class).to require_graphql_authorizations(:read_commit_status) } + specify { expect(described_class).to expose_permissions_using(Types::PermissionTypes::Ci::Job) } it 'exposes the expected fields' do expected_fields = %i[ @@ -38,6 +39,7 @@ RSpec.describe Types::Ci::JobType do status tags triggered + userPermissions ] expect(described_class).to have_graphql_fields(*expected_fields) diff --git a/spec/graphql/types/ci/runner_type_spec.rb b/spec/graphql/types/ci/runner_type_spec.rb new file mode 100644 index 00000000000..dfe4a30c5b7 --- /dev/null +++ b/spec/graphql/types/ci/runner_type_spec.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Types::Ci::RunnerType do + specify { expect(described_class.graphql_name).to eq('CiRunner') } + + it 'contains attributes related to a runner' do + expected_fields = %w[ + id description contacted_at maximum_timeout access_level active status + version short_sha revision locked run_untagged ip_address runner_type tag_list + ] + + expect(described_class).to have_graphql_fields(*expected_fields) + end +end diff --git a/spec/graphql/types/permission_types/ci/job_spec.rb b/spec/graphql/types/permission_types/ci/job_spec.rb new file mode 100644 index 00000000000..e4bc5419070 --- /dev/null +++ b/spec/graphql/types/permission_types/ci/job_spec.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Types::PermissionTypes::Ci::Job do + it 'has expected permission fields' do + expected_permissions = [ + :read_job_artifacts, :read_build, :update_build + ] + + expect(described_class).to have_graphql_fields(expected_permissions).only + end +end diff --git a/spec/graphql/types/query_type_spec.rb b/spec/graphql/types/query_type_spec.rb index a877e19c069..f0e80fa8f14 100644 --- a/spec/graphql/types/query_type_spec.rb +++ b/spec/graphql/types/query_type_spec.rb @@ -24,6 +24,7 @@ RSpec.describe GitlabSchema.types['Query'] do merge_request usage_trends_measurements runner_platforms + runner ] expect(described_class).to have_graphql_fields(*expected_fields).at_least @@ -84,6 +85,12 @@ RSpec.describe GitlabSchema.types['Query'] do end end + describe 'runner field' do + subject { described_class.fields['runner'] } + + it { is_expected.to have_graphql_type(Types::Ci::RunnerType) } + end + describe 'runner_platforms field' do subject { described_class.fields['runnerPlatforms'] } |