Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/graphql/types/ci/status_action_type_spec.rb')
-rw-r--r--spec/graphql/types/ci/status_action_type_spec.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/graphql/types/ci/status_action_type_spec.rb b/spec/graphql/types/ci/status_action_type_spec.rb
index 8a99068e44f..ab7dee3dd11 100644
--- a/spec/graphql/types/ci/status_action_type_spec.rb
+++ b/spec/graphql/types/ci/status_action_type_spec.rb
@@ -3,10 +3,13 @@
require 'spec_helper'
RSpec.describe Types::Ci::StatusActionType do
+ include GraphqlHelpers
+
specify { expect(described_class.graphql_name).to eq('StatusAction') }
it 'exposes the expected fields' do
expected_fields = %i[
+ id
buttonTitle
icon
path
@@ -16,4 +19,21 @@ RSpec.describe Types::Ci::StatusActionType do
expect(described_class).to have_graphql_fields(*expected_fields)
end
+
+ describe 'id field' do
+ it 'correctly renders the field' do
+ stage = build(:ci_stage_entity, status: :skipped)
+ status = stage.detailed_status(stage.pipeline.user)
+
+ grandparent_object = double(:grandparent_object, object: stage)
+ parent_object = double(:parent_object, object: status)
+
+ grandparent = double(:parent, object: grandparent_object)
+ parent = double(:parent, object: parent_object, parent: grandparent)
+
+ expected_id = "#{stage.class.name}-#{status.id}"
+
+ expect(resolve_field('id', status, extras: { parent: parent })).to eq(expected_id)
+ end
+ end
end