diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-07 09:09:38 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-07 09:09:38 +0300 |
commit | b6a92c969b16549683ef276f1db7ba9a41dc85bb (patch) | |
tree | ccfb1fb03227e567495bdc9aa078afc57ed66f3a /spec | |
parent | 2e26679b96b5621de70b00bc44f0d3893f1954df (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
58 files changed, 305 insertions, 107 deletions
diff --git a/spec/finders/alert_management/alerts_finder_spec.rb b/spec/finders/alert_management/alerts_finder_spec.rb index bfc848937df..c25585a5da5 100644 --- a/spec/finders/alert_management/alerts_finder_spec.rb +++ b/spec/finders/alert_management/alerts_finder_spec.rb @@ -5,8 +5,8 @@ require 'spec_helper' describe AlertManagement::AlertsFinder, '#execute' do let_it_be(:current_user) { create(:user) } let_it_be(:project) { create(:project) } - let_it_be(:alert_1) { create(:alert_management_alert, project: project) } - let_it_be(:alert_2) { create(:alert_management_alert, project: project) } + let_it_be(:alert_1) { create(:alert_management_alert, project: project, ended_at: 1.year.ago, events: 2, severity: :high, status: :resolved) } + let_it_be(:alert_2) { create(:alert_management_alert, project: project, events: 1, severity: :critical, status: :ignored) } let_it_be(:alert_3) { create(:alert_management_alert) } let(:params) { {} } @@ -36,5 +36,160 @@ describe AlertManagement::AlertsFinder, '#execute' do it { is_expected.to be_empty } end end + + describe 'sorting' do + context 'when sorting by created' do + context 'sorts alerts ascending' do + let(:params) { { sort: 'created_asc' } } + + it { is_expected.to eq [alert_1, alert_2] } + end + + context 'sorts alerts descending' do + let(:params) { { sort: 'created_desc' } } + + it { is_expected.to eq [alert_2, alert_1] } + end + end + + context 'when sorting by updated' do + context 'sorts alerts ascending' do + let(:params) { { sort: 'updated_asc' } } + + it { is_expected.to eq [alert_1, alert_2] } + end + + context 'sorts alerts descending' do + let(:params) { { sort: 'updated_desc' } } + + it { is_expected.to eq [alert_2, alert_1] } + end + end + + context 'when sorting by start time' do + context 'sorts alerts ascending' do + let(:params) { { sort: 'start_time_asc' } } + + it { is_expected.to eq [alert_1, alert_2] } + end + + context 'sorts alerts descending' do + let(:params) { { sort: 'start_time_desc' } } + + it { is_expected.to eq [alert_2, alert_1] } + end + end + + context 'when sorting by end time' do + context 'sorts alerts ascending' do + let(:params) { { sort: 'end_time_asc' } } + + it { is_expected.to eq [alert_1, alert_2] } + end + + context 'sorts alerts descending' do + let(:params) { { sort: 'end_time_desc' } } + + it { is_expected.to eq [alert_2, alert_1] } + end + end + + context 'when sorting by events count' do + let_it_be(:alert_count_6) { create(:alert_management_alert, project: project, events: 6) } + let_it_be(:alert_count_3) { create(:alert_management_alert, project: project, events: 3) } + + context 'sorts alerts ascending' do + let(:params) { { sort: 'events_count_asc' } } + + it { is_expected.to eq [alert_2, alert_1, alert_count_3, alert_count_6] } + end + + context 'sorts alerts descending' do + let(:params) { { sort: 'events_count_desc' } } + + it { is_expected.to eq [alert_count_6, alert_count_3, alert_1, alert_2] } + end + end + + context 'when sorting by severity' do + let_it_be(:alert_critical) { create(:alert_management_alert, project: project, severity: :critical) } + let_it_be(:alert_high) { create(:alert_management_alert, project: project, severity: :high) } + let_it_be(:alert_medium) { create(:alert_management_alert, project: project, severity: :medium) } + let_it_be(:alert_low) { create(:alert_management_alert, project: project, severity: :low) } + let_it_be(:alert_info) { create(:alert_management_alert, project: project, severity: :info) } + let_it_be(:alert_unknown) { create(:alert_management_alert, project: project, severity: :unknown) } + + context 'sorts alerts ascending' do + let(:params) { { sort: 'severity_asc' } } + + it do + is_expected.to eq [ + alert_2, + alert_critical, + alert_1, + alert_high, + alert_medium, + alert_low, + alert_info, + alert_unknown + ] + end + end + + context 'sorts alerts descending' do + let(:params) { { sort: 'severity_desc' } } + + it do + is_expected.to eq [ + alert_unknown, + alert_info, + alert_low, + alert_medium, + alert_1, + alert_high, + alert_critical, + alert_2 + ] + end + end + end + + context 'when sorting by status' do + let_it_be(:alert_triggered) { create(:alert_management_alert, project: project, status: :triggered) } + let_it_be(:alert_acknowledged) { create(:alert_management_alert, project: project, status: :acknowledged) } + let_it_be(:alert_resolved) { create(:alert_management_alert, project: project, status: :resolved) } + let_it_be(:alert_ignored) { create(:alert_management_alert, project: project, status: :ignored) } + + context 'sorts alerts ascending' do + let(:params) { { sort: 'status_asc' } } + + it do + is_expected.to eq [ + alert_triggered, + alert_acknowledged, + alert_1, + alert_resolved, + alert_2, + alert_ignored + ] + end + end + + context 'sorts alerts descending' do + let(:params) { { sort: 'status_desc' } } + + it do + is_expected.to eq [ + alert_2, + alert_ignored, + alert_1, + alert_resolved, + alert_acknowledged, + alert_triggered + ] + end + end + end + end end end diff --git a/spec/frontend/blob/pipeline_tour_success_modal_spec.js b/spec/frontend/blob/pipeline_tour_success_modal_spec.js index 99940225652..6d4e5e46cb8 100644 --- a/spec/frontend/blob/pipeline_tour_success_modal_spec.js +++ b/spec/frontend/blob/pipeline_tour_success_modal_spec.js @@ -12,8 +12,8 @@ describe('PipelineTourSuccessModal', () => { beforeEach(() => { document.body.dataset.page = 'projects:blob:show'; - trackingSpy = mockTracking('_category_', undefined, jest.spyOn); + wrapper = shallowMount(pipelineTourSuccess, { propsData: modalProps, stubs: { diff --git a/spec/frontend/blob/suggest_gitlab_ci_yml/components/popover_spec.js b/spec/frontend/blob/suggest_gitlab_ci_yml/components/popover_spec.js index fb0964a3f32..3c03e6f04ab 100644 --- a/spec/frontend/blob/suggest_gitlab_ci_yml/components/popover_spec.js +++ b/spec/frontend/blob/suggest_gitlab_ci_yml/components/popover_spec.js @@ -69,8 +69,10 @@ describe('Suggest gitlab-ci.yml Popover', () => { let trackingSpy; beforeEach(() => { + document.body.dataset.page = 'projects:blob:new'; + trackingSpy = mockTracking('_category_', undefined, jest.spyOn); + createWrapper(commitTrackLabel); - trackingSpy = mockTracking('_category_', wrapper.element, jest.spyOn); }); afterEach(() => { @@ -83,10 +85,6 @@ describe('Suggest gitlab-ci.yml Popover', () => { const expectedLabel = 'suggest_commit_first_project_gitlab_ci_yml'; const expectedProperty = 'owner'; - document.body.dataset.page = 'projects:blob:new'; - - wrapper.vm.trackOnShow(); - expect(trackingSpy).toHaveBeenCalledWith(expectedCategory, expectedAction, { label: expectedLabel, property: expectedProperty, @@ -99,6 +97,7 @@ describe('Suggest gitlab-ci.yml Popover', () => { const expectedProperty = 'owner'; const expectedValue = '10'; const dismissButton = wrapper.find(GlDeprecatedButton); + trackingSpy = mockTracking('_category_', wrapper.element, jest.spyOn); triggerEvent(dismissButton.element); diff --git a/spec/graphql/resolvers/alert_management_alert_resolver_spec.rb b/spec/graphql/resolvers/alert_management_alert_resolver_spec.rb index 4914c62e322..e550c13a3d2 100644 --- a/spec/graphql/resolvers/alert_management_alert_resolver_spec.rb +++ b/spec/graphql/resolvers/alert_management_alert_resolver_spec.rb @@ -7,8 +7,8 @@ describe Resolvers::AlertManagementAlertResolver do let_it_be(:current_user) { create(:user) } let_it_be(:project) { create(:project) } - let_it_be(:alert_1) { create(:alert_management_alert, project: project) } - let_it_be(:alert_2) { create(:alert_management_alert, project: project) } + let_it_be(:alert_1) { create(:alert_management_alert, project: project, ended_at: 1.year.ago, events: 2, severity: :high, status: :resolved) } + let_it_be(:alert_2) { create(:alert_management_alert, project: project, events: 1, severity: :critical, status: :ignored) } let_it_be(:alert_other_proj) { create(:alert_management_alert) } let(:args) { {} } @@ -31,6 +31,22 @@ describe Resolvers::AlertManagementAlertResolver do it { is_expected.to contain_exactly(alert_1) } end + + describe 'sorting' do + # Other sorting examples in spec/finders/alert_management/alerts_finder_spec.rb + context 'when sorting by events count' do + let_it_be(:alert_count_6) { create(:alert_management_alert, project: project, events: 6) } + let_it_be(:alert_count_3) { create(:alert_management_alert, project: project, events: 3) } + + it 'sorts alerts ascending' do + expect(resolve_alerts(sort: :events_count_asc)).to eq [alert_2, alert_1, alert_count_3, alert_count_6] + end + + it 'sorts alerts descending' do + expect(resolve_alerts(sort: :events_count_desc)).to eq [alert_count_6, alert_count_3, alert_1, alert_2] + end + end + end end private diff --git a/spec/graphql/types/alert_management/alert_type_spec.rb b/spec/graphql/types/alert_management/alert_type_spec.rb index 169611b2e18..aefd88f7645 100644 --- a/spec/graphql/types/alert_management/alert_type_spec.rb +++ b/spec/graphql/types/alert_management/alert_type_spec.rb @@ -3,9 +3,9 @@ require 'spec_helper' describe GitlabSchema.types['AlertManagementAlert'] do - it { expect(described_class.graphql_name).to eq('AlertManagementAlert') } + specify { expect(described_class.graphql_name).to eq('AlertManagementAlert') } - it { expect(described_class).to require_graphql_authorizations(:read_alert_management_alerts) } + specify { expect(described_class).to require_graphql_authorizations(:read_alert_management_alerts) } it 'exposes the expected fields' do expected_fields = %i[ diff --git a/spec/graphql/types/alert_management/severity_enum_spec.rb b/spec/graphql/types/alert_management/severity_enum_spec.rb index 8b92e9bf418..ca5aa826fe5 100644 --- a/spec/graphql/types/alert_management/severity_enum_spec.rb +++ b/spec/graphql/types/alert_management/severity_enum_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe GitlabSchema.types['AlertManagementSeverity'] do - it { expect(described_class.graphql_name).to eq('AlertManagementSeverity') } + specify { expect(described_class.graphql_name).to eq('AlertManagementSeverity') } it 'exposes all the severity values' do expect(described_class.values.keys).to include(*%w[CRITICAL HIGH MEDIUM LOW INFO UNKNOWN]) diff --git a/spec/graphql/types/alert_management/status_enum_spec.rb b/spec/graphql/types/alert_management/status_enum_spec.rb index 4ffb29025fa..8a1dc9841b0 100644 --- a/spec/graphql/types/alert_management/status_enum_spec.rb +++ b/spec/graphql/types/alert_management/status_enum_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe GitlabSchema.types['AlertManagementStatus'] do - it { expect(described_class.graphql_name).to eq('AlertManagementStatus') } + specify { expect(described_class.graphql_name).to eq('AlertManagementStatus') } it 'exposes all the severity values' do expect(described_class.values.keys).to include(*%w[TRIGGERED ACKNOWLEDGED RESOLVED IGNORED]) diff --git a/spec/graphql/types/award_emojis/award_emoji_type_spec.rb b/spec/graphql/types/award_emojis/award_emoji_type_spec.rb index de5ece3b749..4e06329506d 100644 --- a/spec/graphql/types/award_emojis/award_emoji_type_spec.rb +++ b/spec/graphql/types/award_emojis/award_emoji_type_spec.rb @@ -3,9 +3,9 @@ require 'spec_helper' describe GitlabSchema.types['AwardEmoji'] do - it { expect(described_class.graphql_name).to eq('AwardEmoji') } + specify { expect(described_class.graphql_name).to eq('AwardEmoji') } - it { expect(described_class).to require_graphql_authorizations(:read_emoji) } + specify { expect(described_class).to require_graphql_authorizations(:read_emoji) } - it { expect(described_class).to have_graphql_fields(:description, :unicode_version, :emoji, :name, :unicode, :user) } + specify { expect(described_class).to have_graphql_fields(:description, :unicode_version, :emoji, :name, :unicode, :user) } end diff --git a/spec/graphql/types/blob_viewers/type_enum_spec.rb b/spec/graphql/types/blob_viewers/type_enum_spec.rb index 7bd4352f388..09664382af9 100644 --- a/spec/graphql/types/blob_viewers/type_enum_spec.rb +++ b/spec/graphql/types/blob_viewers/type_enum_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe Types::BlobViewers::TypeEnum do - it { expect(described_class.graphql_name).to eq('BlobViewersType') } + specify { expect(described_class.graphql_name).to eq('BlobViewersType') } it 'exposes all tree entry types' do expect(described_class.values.keys).to include(*%w[rich simple auxiliary]) diff --git a/spec/graphql/types/board_list_type_spec.rb b/spec/graphql/types/board_list_type_spec.rb index b5c842ae884..69597fc9617 100644 --- a/spec/graphql/types/board_list_type_spec.rb +++ b/spec/graphql/types/board_list_type_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe GitlabSchema.types['BoardList'] do - it { expect(described_class.graphql_name).to eq('BoardList') } + specify { expect(described_class.graphql_name).to eq('BoardList') } it 'has specific fields' do expected_fields = %w[id list_type position label] diff --git a/spec/graphql/types/board_type_spec.rb b/spec/graphql/types/board_type_spec.rb index 1ca4bf18b57..5d87a1757b5 100644 --- a/spec/graphql/types/board_type_spec.rb +++ b/spec/graphql/types/board_type_spec.rb @@ -3,9 +3,9 @@ require 'spec_helper' describe GitlabSchema.types['Board'] do - it { expect(described_class.graphql_name).to eq('Board') } + specify { expect(described_class.graphql_name).to eq('Board') } - it { expect(described_class).to require_graphql_authorizations(:read_board) } + specify { expect(described_class).to require_graphql_authorizations(:read_board) } it 'has specific fields' do expected_fields = %w[id name] diff --git a/spec/graphql/types/ci/detailed_status_type_spec.rb b/spec/graphql/types/ci/detailed_status_type_spec.rb index 169a03c770b..c62c8f23728 100644 --- a/spec/graphql/types/ci/detailed_status_type_spec.rb +++ b/spec/graphql/types/ci/detailed_status_type_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe Types::Ci::DetailedStatusType do - it { expect(described_class.graphql_name).to eq('DetailedStatus') } + specify { expect(described_class.graphql_name).to eq('DetailedStatus') } it "has all fields" do expect(described_class).to have_graphql_fields(:group, :icon, :favicon, diff --git a/spec/graphql/types/ci/pipeline_type_spec.rb b/spec/graphql/types/ci/pipeline_type_spec.rb index 2fafc1bc13f..d56cff12105 100644 --- a/spec/graphql/types/ci/pipeline_type_spec.rb +++ b/spec/graphql/types/ci/pipeline_type_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe Types::Ci::PipelineType do - it { expect(described_class.graphql_name).to eq('Pipeline') } + specify { expect(described_class.graphql_name).to eq('Pipeline') } - it { expect(described_class).to expose_permissions_using(Types::PermissionTypes::Ci::Pipeline) } + specify { expect(described_class).to expose_permissions_using(Types::PermissionTypes::Ci::Pipeline) } end diff --git a/spec/graphql/types/commit_type_spec.rb b/spec/graphql/types/commit_type_spec.rb index f5f99229f3a..adc86321bb1 100644 --- a/spec/graphql/types/commit_type_spec.rb +++ b/spec/graphql/types/commit_type_spec.rb @@ -3,9 +3,9 @@ require 'spec_helper' describe GitlabSchema.types['Commit'] do - it { expect(described_class.graphql_name).to eq('Commit') } + specify { expect(described_class.graphql_name).to eq('Commit') } - it { expect(described_class).to require_graphql_authorizations(:download_code) } + specify { expect(described_class).to require_graphql_authorizations(:download_code) } it 'contains attributes related to commit' do expect(described_class).to have_graphql_fields( diff --git a/spec/graphql/types/diff_refs_type_spec.rb b/spec/graphql/types/diff_refs_type_spec.rb index a6ead27455f..3165e642452 100644 --- a/spec/graphql/types/diff_refs_type_spec.rb +++ b/spec/graphql/types/diff_refs_type_spec.rb @@ -3,11 +3,11 @@ require 'spec_helper' describe GitlabSchema.types['DiffRefs'] do - it { expect(described_class.graphql_name).to eq('DiffRefs') } + specify { expect(described_class.graphql_name).to eq('DiffRefs') } - it { expect(described_class).to have_graphql_fields(:head_sha, :base_sha, :start_sha).only } + specify { expect(described_class).to have_graphql_fields(:head_sha, :base_sha, :start_sha).only } - it { expect(described_class.fields['headSha'].type).to be_non_null } - it { expect(described_class.fields['baseSha'].type).not_to be_non_null } - it { expect(described_class.fields['startSha'].type).to be_non_null } + specify { expect(described_class.fields['headSha'].type).to be_non_null } + specify { expect(described_class.fields['baseSha'].type).not_to be_non_null } + specify { expect(described_class.fields['startSha'].type).to be_non_null } end diff --git a/spec/graphql/types/environment_type_spec.rb b/spec/graphql/types/environment_type_spec.rb index 24a8bddfa6a..0e5cbac05df 100644 --- a/spec/graphql/types/environment_type_spec.rb +++ b/spec/graphql/types/environment_type_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe GitlabSchema.types['Environment'] do - it { expect(described_class.graphql_name).to eq('Environment') } + specify { expect(described_class.graphql_name).to eq('Environment') } it 'has the expected fields' do expected_fields = %w[ @@ -13,5 +13,5 @@ describe GitlabSchema.types['Environment'] do expect(described_class).to have_graphql_fields(*expected_fields) end - it { expect(described_class).to require_graphql_authorizations(:read_environment) } + specify { expect(described_class).to require_graphql_authorizations(:read_environment) } end diff --git a/spec/graphql/types/error_tracking/sentry_detailed_error_type_spec.rb b/spec/graphql/types/error_tracking/sentry_detailed_error_type_spec.rb index 44652f831b5..0a094e9e188 100644 --- a/spec/graphql/types/error_tracking/sentry_detailed_error_type_spec.rb +++ b/spec/graphql/types/error_tracking/sentry_detailed_error_type_spec.rb @@ -3,9 +3,9 @@ require 'spec_helper' describe GitlabSchema.types['SentryDetailedError'] do - it { expect(described_class.graphql_name).to eq('SentryDetailedError') } + specify { expect(described_class.graphql_name).to eq('SentryDetailedError') } - it { expect(described_class).to require_graphql_authorizations(:read_sentry_issue) } + specify { expect(described_class).to require_graphql_authorizations(:read_sentry_issue) } it 'exposes the expected fields' do expected_fields = %i[ diff --git a/spec/graphql/types/error_tracking/sentry_error_collection_type_spec.rb b/spec/graphql/types/error_tracking/sentry_error_collection_type_spec.rb index 20ec31391d8..793da2db960 100644 --- a/spec/graphql/types/error_tracking/sentry_error_collection_type_spec.rb +++ b/spec/graphql/types/error_tracking/sentry_error_collection_type_spec.rb @@ -3,9 +3,9 @@ require 'spec_helper' describe GitlabSchema.types['SentryErrorCollection'] do - it { expect(described_class.graphql_name).to eq('SentryErrorCollection') } + specify { expect(described_class.graphql_name).to eq('SentryErrorCollection') } - it { expect(described_class).to require_graphql_authorizations(:read_sentry_issue) } + specify { expect(described_class).to require_graphql_authorizations(:read_sentry_issue) } it 'exposes the expected fields' do expected_fields = %i[ diff --git a/spec/graphql/types/error_tracking/sentry_error_stack_trace_entry_type_spec.rb b/spec/graphql/types/error_tracking/sentry_error_stack_trace_entry_type_spec.rb index 05cc2ca7612..b65398fccc9 100644 --- a/spec/graphql/types/error_tracking/sentry_error_stack_trace_entry_type_spec.rb +++ b/spec/graphql/types/error_tracking/sentry_error_stack_trace_entry_type_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe GitlabSchema.types['SentryErrorStackTraceEntry'] do - it { expect(described_class.graphql_name).to eq('SentryErrorStackTraceEntry') } + specify { expect(described_class.graphql_name).to eq('SentryErrorStackTraceEntry') } it 'exposes the expected fields' do expected_fields = %i[ diff --git a/spec/graphql/types/error_tracking/sentry_error_stack_trace_type_spec.rb b/spec/graphql/types/error_tracking/sentry_error_stack_trace_type_spec.rb index 2a422228f72..2cec8865764 100644 --- a/spec/graphql/types/error_tracking/sentry_error_stack_trace_type_spec.rb +++ b/spec/graphql/types/error_tracking/sentry_error_stack_trace_type_spec.rb @@ -3,9 +3,9 @@ require 'spec_helper' describe GitlabSchema.types['SentryErrorStackTrace'] do - it { expect(described_class.graphql_name).to eq('SentryErrorStackTrace') } + specify { expect(described_class.graphql_name).to eq('SentryErrorStackTrace') } - it { expect(described_class).to require_graphql_authorizations(:read_sentry_issue) } + specify { expect(described_class).to require_graphql_authorizations(:read_sentry_issue) } it 'exposes the expected fields' do expected_fields = %i[ diff --git a/spec/graphql/types/error_tracking/sentry_error_type_spec.rb b/spec/graphql/types/error_tracking/sentry_error_type_spec.rb index 4676d91ef9c..f8cc801e35e 100644 --- a/spec/graphql/types/error_tracking/sentry_error_type_spec.rb +++ b/spec/graphql/types/error_tracking/sentry_error_type_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe GitlabSchema.types['SentryError'] do - it { expect(described_class.graphql_name).to eq('SentryError') } + specify { expect(described_class.graphql_name).to eq('SentryError') } it 'exposes the expected fields' do expected_fields = %i[ diff --git a/spec/graphql/types/grafana_integration_type_spec.rb b/spec/graphql/types/grafana_integration_type_spec.rb index ac26911acbf..429b5bdffe6 100644 --- a/spec/graphql/types/grafana_integration_type_spec.rb +++ b/spec/graphql/types/grafana_integration_type_spec.rb @@ -14,9 +14,9 @@ describe GitlabSchema.types['GrafanaIntegration'] do ] end - it { expect(described_class.graphql_name).to eq('GrafanaIntegration') } + specify { expect(described_class.graphql_name).to eq('GrafanaIntegration') } - it { expect(described_class).to require_graphql_authorizations(:admin_operations) } + specify { expect(described_class).to require_graphql_authorizations(:admin_operations) } - it { expect(described_class).to have_graphql_fields(*expected_fields) } + specify { expect(described_class).to have_graphql_fields(*expected_fields) } end diff --git a/spec/graphql/types/group_type_spec.rb b/spec/graphql/types/group_type_spec.rb index 532f1a4b53d..a834a9038db 100644 --- a/spec/graphql/types/group_type_spec.rb +++ b/spec/graphql/types/group_type_spec.rb @@ -3,11 +3,11 @@ require 'spec_helper' describe GitlabSchema.types['Group'] do - it { expect(described_class).to expose_permissions_using(Types::PermissionTypes::Group) } + specify { expect(described_class).to expose_permissions_using(Types::PermissionTypes::Group) } - it { expect(described_class.graphql_name).to eq('Group') } + specify { expect(described_class.graphql_name).to eq('Group') } - it { expect(described_class).to require_graphql_authorizations(:read_group) } + specify { expect(described_class).to require_graphql_authorizations(:read_group) } it 'has the expected fields' do expected_fields = %w[ diff --git a/spec/graphql/types/issuable_sort_enum_spec.rb b/spec/graphql/types/issuable_sort_enum_spec.rb index 5a680c8eae5..35c42d8194c 100644 --- a/spec/graphql/types/issuable_sort_enum_spec.rb +++ b/spec/graphql/types/issuable_sort_enum_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe Types::IssuableSortEnum do - it { expect(described_class.graphql_name).to eq('IssuableSort') } + specify { expect(described_class.graphql_name).to eq('IssuableSort') } it 'exposes all the existing issuable sort values' do expect(described_class.values.keys).to include( diff --git a/spec/graphql/types/issuable_state_enum_spec.rb b/spec/graphql/types/issuable_state_enum_spec.rb index 65a80fa4176..f974ed5f5fb 100644 --- a/spec/graphql/types/issuable_state_enum_spec.rb +++ b/spec/graphql/types/issuable_state_enum_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe GitlabSchema.types['IssuableState'] do - it { expect(described_class.graphql_name).to eq('IssuableState') } + specify { expect(described_class.graphql_name).to eq('IssuableState') } it_behaves_like 'issuable state' end diff --git a/spec/graphql/types/issue_sort_enum_spec.rb b/spec/graphql/types/issue_sort_enum_spec.rb index 532f9686f25..c496b897cdb 100644 --- a/spec/graphql/types/issue_sort_enum_spec.rb +++ b/spec/graphql/types/issue_sort_enum_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe GitlabSchema.types['IssueSort'] do - it { expect(described_class.graphql_name).to eq('IssueSort') } + specify { expect(described_class.graphql_name).to eq('IssueSort') } it_behaves_like 'common sort values' diff --git a/spec/graphql/types/issue_state_enum_spec.rb b/spec/graphql/types/issue_state_enum_spec.rb index de19e6fc505..a18c5f5d317 100644 --- a/spec/graphql/types/issue_state_enum_spec.rb +++ b/spec/graphql/types/issue_state_enum_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe GitlabSchema.types['IssueState'] do - it { expect(described_class.graphql_name).to eq('IssueState') } + specify { expect(described_class.graphql_name).to eq('IssueState') } it_behaves_like 'issuable state' end diff --git a/spec/graphql/types/issue_type_spec.rb b/spec/graphql/types/issue_type_spec.rb index ebe48c17c11..d51457b29b4 100644 --- a/spec/graphql/types/issue_type_spec.rb +++ b/spec/graphql/types/issue_type_spec.rb @@ -3,13 +3,13 @@ require 'spec_helper' describe GitlabSchema.types['Issue'] do - it { expect(described_class).to expose_permissions_using(Types::PermissionTypes::Issue) } + specify { expect(described_class).to expose_permissions_using(Types::PermissionTypes::Issue) } - it { expect(described_class.graphql_name).to eq('Issue') } + specify { expect(described_class.graphql_name).to eq('Issue') } - it { expect(described_class).to require_graphql_authorizations(:read_issue) } + specify { expect(described_class).to require_graphql_authorizations(:read_issue) } - it { expect(described_class.interfaces).to include(Types::Notes::NoteableType) } + specify { expect(described_class.interfaces).to include(Types::Notes::NoteableType) } it 'has specific fields' do fields = %i[iid title description state reference author assignees participants labels milestone due_date diff --git a/spec/graphql/types/jira_import_type_spec.rb b/spec/graphql/types/jira_import_type_spec.rb index e73568c9710..ac1aa672e30 100644 --- a/spec/graphql/types/jira_import_type_spec.rb +++ b/spec/graphql/types/jira_import_type_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe GitlabSchema.types['JiraImport'] do - it { expect(described_class.graphql_name).to eq('JiraImport') } + specify { expect(described_class.graphql_name).to eq('JiraImport') } it 'has the expected fields' do expect(described_class).to have_graphql_fields(:jira_project_key, :createdAt, :scheduled_at, :scheduled_by) diff --git a/spec/graphql/types/label_type_spec.rb b/spec/graphql/types/label_type_spec.rb index 71b86d9b528..026c63906ef 100644 --- a/spec/graphql/types/label_type_spec.rb +++ b/spec/graphql/types/label_type_spec.rb @@ -8,5 +8,5 @@ describe GitlabSchema.types['Label'] do expect(described_class).to have_graphql_fields(*expected_fields) end - it { expect(described_class).to require_graphql_authorizations(:read_label) } + specify { expect(described_class).to require_graphql_authorizations(:read_label) } end diff --git a/spec/graphql/types/merge_request_state_enum_spec.rb b/spec/graphql/types/merge_request_state_enum_spec.rb index 626e33b18d3..2abc7b298b1 100644 --- a/spec/graphql/types/merge_request_state_enum_spec.rb +++ b/spec/graphql/types/merge_request_state_enum_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe GitlabSchema.types['MergeRequestState'] do - it { expect(described_class.graphql_name).to eq('MergeRequestState') } + specify { expect(described_class.graphql_name).to eq('MergeRequestState') } it_behaves_like 'issuable state' diff --git a/spec/graphql/types/merge_request_type_spec.rb b/spec/graphql/types/merge_request_type_spec.rb index 0c83ebd3de9..e7ab2100084 100644 --- a/spec/graphql/types/merge_request_type_spec.rb +++ b/spec/graphql/types/merge_request_type_spec.rb @@ -3,11 +3,11 @@ require 'spec_helper' describe GitlabSchema.types['MergeRequest'] do - it { expect(described_class).to expose_permissions_using(Types::PermissionTypes::MergeRequest) } + specify { expect(described_class).to expose_permissions_using(Types::PermissionTypes::MergeRequest) } - it { expect(described_class).to require_graphql_authorizations(:read_merge_request) } + specify { expect(described_class).to require_graphql_authorizations(:read_merge_request) } - it { expect(described_class.interfaces).to include(Types::Notes::NoteableType) } + specify { expect(described_class.interfaces).to include(Types::Notes::NoteableType) } it 'has the expected fields' do expected_fields = %w[ diff --git a/spec/graphql/types/metadata_type_spec.rb b/spec/graphql/types/metadata_type_spec.rb index c8270a8c2f5..75369ec9c3c 100644 --- a/spec/graphql/types/metadata_type_spec.rb +++ b/spec/graphql/types/metadata_type_spec.rb @@ -3,6 +3,6 @@ require 'spec_helper' describe GitlabSchema.types['Metadata'] do - it { expect(described_class.graphql_name).to eq('Metadata') } - it { expect(described_class).to require_graphql_authorizations(:read_instance_metadata) } + specify { expect(described_class.graphql_name).to eq('Metadata') } + specify { expect(described_class).to require_graphql_authorizations(:read_instance_metadata) } end diff --git a/spec/graphql/types/metrics/dashboard_type_spec.rb b/spec/graphql/types/metrics/dashboard_type_spec.rb index 76f2b4b8935..81219c596a7 100644 --- a/spec/graphql/types/metrics/dashboard_type_spec.rb +++ b/spec/graphql/types/metrics/dashboard_type_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe GitlabSchema.types['MetricsDashboard'] do - it { expect(described_class.graphql_name).to eq('MetricsDashboard') } + specify { expect(described_class.graphql_name).to eq('MetricsDashboard') } it 'has the expected fields' do expected_fields = %w[ diff --git a/spec/graphql/types/metrics/dashboards/annotation_type_spec.rb b/spec/graphql/types/metrics/dashboards/annotation_type_spec.rb index 2956a2512eb..dbb8b04dbd7 100644 --- a/spec/graphql/types/metrics/dashboards/annotation_type_spec.rb +++ b/spec/graphql/types/metrics/dashboards/annotation_type_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe GitlabSchema.types['MetricsDashboardAnnotation'] do - it { expect(described_class.graphql_name).to eq('MetricsDashboardAnnotation') } + specify { expect(described_class.graphql_name).to eq('MetricsDashboardAnnotation') } it 'has the expected fields' do expected_fields = %w[ @@ -13,5 +13,5 @@ describe GitlabSchema.types['MetricsDashboardAnnotation'] do expect(described_class).to have_graphql_fields(*expected_fields) end - it { expect(described_class).to require_graphql_authorizations(:read_metrics_dashboard_annotation) } + specify { expect(described_class).to require_graphql_authorizations(:read_metrics_dashboard_annotation) } end diff --git a/spec/graphql/types/milestone_type_spec.rb b/spec/graphql/types/milestone_type_spec.rb index f7ee79eae9f..4c3d9f50a64 100644 --- a/spec/graphql/types/milestone_type_spec.rb +++ b/spec/graphql/types/milestone_type_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe GitlabSchema.types['Milestone'] do - it { expect(described_class.graphql_name).to eq('Milestone') } + specify { expect(described_class.graphql_name).to eq('Milestone') } - it { expect(described_class).to require_graphql_authorizations(:read_milestone) } + specify { expect(described_class).to require_graphql_authorizations(:read_milestone) } end diff --git a/spec/graphql/types/namespace_type_spec.rb b/spec/graphql/types/namespace_type_spec.rb index 6c2ba70cf4c..741698021e7 100644 --- a/spec/graphql/types/namespace_type_spec.rb +++ b/spec/graphql/types/namespace_type_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe GitlabSchema.types['Namespace'] do - it { expect(described_class.graphql_name).to eq('Namespace') } + specify { expect(described_class.graphql_name).to eq('Namespace') } it 'has the expected fields' do expected_fields = %w[ @@ -14,5 +14,5 @@ describe GitlabSchema.types['Namespace'] do expect(described_class).to have_graphql_fields(*expected_fields) end - it { expect(described_class).to require_graphql_authorizations(:read_namespace) } + specify { expect(described_class).to require_graphql_authorizations(:read_namespace) } end diff --git a/spec/graphql/types/notes/discussion_type_spec.rb b/spec/graphql/types/notes/discussion_type_spec.rb index 804785ba67d..44774594d17 100644 --- a/spec/graphql/types/notes/discussion_type_spec.rb +++ b/spec/graphql/types/notes/discussion_type_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' describe GitlabSchema.types['Discussion'] do - it { expect(described_class).to have_graphql_fields(:id, :created_at, :notes, :reply_id) } + specify { expect(described_class).to have_graphql_fields(:id, :created_at, :notes, :reply_id) } - it { expect(described_class).to require_graphql_authorizations(:read_note) } + specify { expect(described_class).to require_graphql_authorizations(:read_note) } end diff --git a/spec/graphql/types/notes/note_type_spec.rb b/spec/graphql/types/notes/note_type_spec.rb index 8cf84cd8dfd..019f742ee77 100644 --- a/spec/graphql/types/notes/note_type_spec.rb +++ b/spec/graphql/types/notes/note_type_spec.rb @@ -10,6 +10,6 @@ describe GitlabSchema.types['Note'] do expect(described_class).to have_graphql_fields(*expected_fields) end - it { expect(described_class).to expose_permissions_using(Types::PermissionTypes::Note) } - it { expect(described_class).to require_graphql_authorizations(:read_note) } + specify { expect(described_class).to expose_permissions_using(Types::PermissionTypes::Note) } + specify { expect(described_class).to require_graphql_authorizations(:read_note) } end diff --git a/spec/graphql/types/notes/noteable_type_spec.rb b/spec/graphql/types/notes/noteable_type_spec.rb index a4259e160e0..3176134fa14 100644 --- a/spec/graphql/types/notes/noteable_type_spec.rb +++ b/spec/graphql/types/notes/noteable_type_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' describe Types::Notes::NoteableType do - it { expect(described_class).to have_graphql_fields(:notes, :discussions) } + specify { expect(described_class).to have_graphql_fields(:notes, :discussions) } describe ".resolve_type" do it 'knows the correct type for objects' do diff --git a/spec/graphql/types/permission_types/merge_request_type_spec.rb b/spec/graphql/types/permission_types/merge_request_type_spec.rb index 572b4ac42d0..7e9752cdc46 100644 --- a/spec/graphql/types/permission_types/merge_request_type_spec.rb +++ b/spec/graphql/types/permission_types/merge_request_type_spec.rb @@ -3,5 +3,5 @@ require 'spec_helper' describe Types::MergeRequestType do - it { expect(described_class).to expose_permissions_using(Types::PermissionTypes::MergeRequest) } + specify { expect(described_class).to expose_permissions_using(Types::PermissionTypes::MergeRequest) } end diff --git a/spec/graphql/types/project_type_spec.rb b/spec/graphql/types/project_type_spec.rb index e05c5d5e6ad..9a257ec8d1b 100644 --- a/spec/graphql/types/project_type_spec.rb +++ b/spec/graphql/types/project_type_spec.rb @@ -3,11 +3,11 @@ require 'spec_helper' describe GitlabSchema.types['Project'] do - it { expect(described_class).to expose_permissions_using(Types::PermissionTypes::Project) } + specify { expect(described_class).to expose_permissions_using(Types::PermissionTypes::Project) } - it { expect(described_class.graphql_name).to eq('Project') } + specify { expect(described_class.graphql_name).to eq('Project') } - it { expect(described_class).to require_graphql_authorizations(:read_project) } + specify { expect(described_class).to require_graphql_authorizations(:read_project) } it 'has the expected fields' do expected_fields = %w[ diff --git a/spec/graphql/types/projects/base_service_type_spec.rb b/spec/graphql/types/projects/base_service_type_spec.rb index bda6022bf79..4fcb9fe1a73 100644 --- a/spec/graphql/types/projects/base_service_type_spec.rb +++ b/spec/graphql/types/projects/base_service_type_spec.rb @@ -3,11 +3,11 @@ require 'spec_helper' describe GitlabSchema.types['BaseService'] do - it { expect(described_class.graphql_name).to eq('BaseService') } + specify { expect(described_class.graphql_name).to eq('BaseService') } it 'has basic expected fields' do expect(described_class).to have_graphql_fields(:type, :active) end - it { expect(described_class).to require_graphql_authorizations(:admin_project) } + specify { expect(described_class).to require_graphql_authorizations(:admin_project) } end diff --git a/spec/graphql/types/projects/jira_service_type_spec.rb b/spec/graphql/types/projects/jira_service_type_spec.rb index 7f8fa6538e9..91d7e4586cb 100644 --- a/spec/graphql/types/projects/jira_service_type_spec.rb +++ b/spec/graphql/types/projects/jira_service_type_spec.rb @@ -3,11 +3,11 @@ require 'spec_helper' describe GitlabSchema.types['JiraService'] do - it { expect(described_class.graphql_name).to eq('JiraService') } + specify { expect(described_class.graphql_name).to eq('JiraService') } it 'has basic expected fields' do expect(described_class).to have_graphql_fields(:type, :active) end - it { expect(described_class).to require_graphql_authorizations(:admin_project) } + specify { expect(described_class).to require_graphql_authorizations(:admin_project) } end diff --git a/spec/graphql/types/projects/service_type_spec.rb b/spec/graphql/types/projects/service_type_spec.rb index ad30a4008bc..f6758d17d18 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' describe Types::Projects::ServiceType do - it { expect(described_class).to have_graphql_fields(:type, :active) } + specify { expect(described_class).to have_graphql_fields(: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 index aac4aae4f69..91e398e8d81 100644 --- a/spec/graphql/types/projects/services_enum_spec.rb +++ b/spec/graphql/types/projects/services_enum_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe GitlabSchema.types['ServiceType'] do - it { expect(described_class.graphql_name).to eq('ServiceType') } + specify { expect(described_class.graphql_name).to eq('ServiceType') } it 'exposes all the existing project services' do expect(described_class.values.keys).to match_array(available_services_enum) diff --git a/spec/graphql/types/repository_type_spec.rb b/spec/graphql/types/repository_type_spec.rb index f746e75b574..fb52839c712 100644 --- a/spec/graphql/types/repository_type_spec.rb +++ b/spec/graphql/types/repository_type_spec.rb @@ -3,11 +3,11 @@ require 'spec_helper' describe GitlabSchema.types['Repository'] do - it { expect(described_class.graphql_name).to eq('Repository') } + specify { expect(described_class.graphql_name).to eq('Repository') } - it { expect(described_class).to require_graphql_authorizations(:download_code) } + specify { expect(described_class).to require_graphql_authorizations(:download_code) } - it { expect(described_class).to have_graphql_field(:root_ref) } + specify { expect(described_class).to have_graphql_field(:root_ref) } - it { expect(described_class).to have_graphql_field(:tree) } + specify { expect(described_class).to have_graphql_field(:tree) } end diff --git a/spec/graphql/types/root_storage_statistics_type_spec.rb b/spec/graphql/types/root_storage_statistics_type_spec.rb index b796b974b82..ebaa5a18623 100644 --- a/spec/graphql/types/root_storage_statistics_type_spec.rb +++ b/spec/graphql/types/root_storage_statistics_type_spec.rb @@ -3,12 +3,12 @@ require 'spec_helper' describe GitlabSchema.types['RootStorageStatistics'] do - it { expect(described_class.graphql_name).to eq('RootStorageStatistics') } + specify { expect(described_class.graphql_name).to eq('RootStorageStatistics') } it 'has all the required fields' do expect(described_class).to have_graphql_fields(:storage_size, :repository_size, :lfs_objects_size, :build_artifacts_size, :packages_size, :wiki_size) end - it { expect(described_class).to require_graphql_authorizations(:read_statistics) } + specify { expect(described_class).to require_graphql_authorizations(:read_statistics) } end diff --git a/spec/graphql/types/snippet_type_spec.rb b/spec/graphql/types/snippet_type_spec.rb index 77b33e8483a..adc13d4d651 100644 --- a/spec/graphql/types/snippet_type_spec.rb +++ b/spec/graphql/types/snippet_type_spec.rb @@ -17,7 +17,7 @@ describe GitlabSchema.types['Snippet'] do end describe 'authorizations' do - it { expect(described_class).to require_graphql_authorizations(:read_snippet) } + specify { expect(described_class).to require_graphql_authorizations(:read_snippet) } end shared_examples 'response without repository URLs' do diff --git a/spec/graphql/types/time_type_spec.rb b/spec/graphql/types/time_type_spec.rb index 88a535ed3bb..3c6e191e2fb 100644 --- a/spec/graphql/types/time_type_spec.rb +++ b/spec/graphql/types/time_type_spec.rb @@ -6,7 +6,7 @@ describe GitlabSchema.types['Time'] do let(:iso) { "2018-06-04T15:23:50+02:00" } let(:time) { Time.parse(iso) } - it { expect(described_class.graphql_name).to eq('Time') } + specify { expect(described_class.graphql_name).to eq('Time') } it 'coerces Time object into ISO 8601' do expect(described_class.coerce_isolated_result(time)).to eq(iso) diff --git a/spec/graphql/types/todo_type_spec.rb b/spec/graphql/types/todo_type_spec.rb index 59118259d09..87a5405f0e2 100644 --- a/spec/graphql/types/todo_type_spec.rb +++ b/spec/graphql/types/todo_type_spec.rb @@ -9,5 +9,5 @@ describe GitlabSchema.types['Todo'] do expect(described_class).to have_graphql_fields(*expected_fields) end - it { expect(described_class).to require_graphql_authorizations(:read_todo) } + specify { expect(described_class).to require_graphql_authorizations(:read_todo) } end diff --git a/spec/graphql/types/tree/blob_type_spec.rb b/spec/graphql/types/tree/blob_type_spec.rb index 516c862b9c6..547a03b5edf 100644 --- a/spec/graphql/types/tree/blob_type_spec.rb +++ b/spec/graphql/types/tree/blob_type_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe Types::Tree::BlobType do - it { expect(described_class.graphql_name).to eq('Blob') } + specify { expect(described_class.graphql_name).to eq('Blob') } - it { expect(described_class).to have_graphql_fields(:id, :sha, :name, :type, :path, :flat_path, :web_url, :lfs_oid) } + specify { expect(described_class).to have_graphql_fields(:id, :sha, :name, :type, :path, :flat_path, :web_url, :lfs_oid) } end diff --git a/spec/graphql/types/tree/submodule_type_spec.rb b/spec/graphql/types/tree/submodule_type_spec.rb index 81f7ad825a1..b5cfe8eb812 100644 --- a/spec/graphql/types/tree/submodule_type_spec.rb +++ b/spec/graphql/types/tree/submodule_type_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe Types::Tree::SubmoduleType do - it { expect(described_class.graphql_name).to eq('Submodule') } + specify { expect(described_class.graphql_name).to eq('Submodule') } - it { expect(described_class).to have_graphql_fields(:id, :sha, :name, :type, :path, :flat_path, :web_url, :tree_url) } + specify { expect(described_class).to have_graphql_fields(:id, :sha, :name, :type, :path, :flat_path, :web_url, :tree_url) } end diff --git a/spec/graphql/types/tree/tree_entry_type_spec.rb b/spec/graphql/types/tree/tree_entry_type_spec.rb index 228a4be0949..14826d06645 100644 --- a/spec/graphql/types/tree/tree_entry_type_spec.rb +++ b/spec/graphql/types/tree/tree_entry_type_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe Types::Tree::TreeEntryType do - it { expect(described_class.graphql_name).to eq('TreeEntry') } + specify { expect(described_class.graphql_name).to eq('TreeEntry') } - it { expect(described_class).to have_graphql_fields(:id, :sha, :name, :type, :path, :flat_path, :web_url) } + specify { expect(described_class).to have_graphql_fields(:id, :sha, :name, :type, :path, :flat_path, :web_url) } end diff --git a/spec/graphql/types/tree/tree_type_spec.rb b/spec/graphql/types/tree/tree_type_spec.rb index 23779d75600..93faebd3602 100644 --- a/spec/graphql/types/tree/tree_type_spec.rb +++ b/spec/graphql/types/tree/tree_type_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe Types::Tree::TreeType do - it { expect(described_class.graphql_name).to eq('Tree') } + specify { expect(described_class.graphql_name).to eq('Tree') } - it { expect(described_class).to have_graphql_fields(:trees, :submodules, :blobs, :last_commit) } + specify { expect(described_class).to have_graphql_fields(:trees, :submodules, :blobs, :last_commit) } end diff --git a/spec/graphql/types/tree/type_enum_spec.rb b/spec/graphql/types/tree/type_enum_spec.rb index 4caf9e1c457..dcacd6073f9 100644 --- a/spec/graphql/types/tree/type_enum_spec.rb +++ b/spec/graphql/types/tree/type_enum_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe Types::Tree::TypeEnum do - it { expect(described_class.graphql_name).to eq('EntryType') } + specify { expect(described_class.graphql_name).to eq('EntryType') } it 'exposes all tree entry types' do expect(described_class.values.keys).to include(*%w[tree blob commit]) diff --git a/spec/graphql/types/user_type_spec.rb b/spec/graphql/types/user_type_spec.rb index 2b0b8844df5..cf1e91afb80 100644 --- a/spec/graphql/types/user_type_spec.rb +++ b/spec/graphql/types/user_type_spec.rb @@ -3,9 +3,9 @@ require 'spec_helper' describe GitlabSchema.types['User'] do - it { expect(described_class.graphql_name).to eq('User') } + specify { expect(described_class.graphql_name).to eq('User') } - it { expect(described_class).to require_graphql_authorizations(:read_user) } + specify { expect(described_class).to require_graphql_authorizations(:read_user) } it 'has the expected fields' do expected_fields = %w[ diff --git a/spec/requests/api/graphql/project/alert_management/alerts_spec.rb b/spec/requests/api/graphql/project/alert_management/alerts_spec.rb index 5d60f054bf2..50650d13644 100644 --- a/spec/requests/api/graphql/project/alert_management/alerts_spec.rb +++ b/spec/requests/api/graphql/project/alert_management/alerts_spec.rb @@ -7,8 +7,9 @@ describe 'getting Alert Management Alerts' do let_it_be(:payload) { { 'custom' => { 'alert' => 'payload' } } } let_it_be(:project) { create(:project, :repository) } let_it_be(:current_user) { create(:user) } - let_it_be(:alert_1) { create(:alert_management_alert, :all_fields, project: project) } - let_it_be(:alert_2) { create(:alert_management_alert, :all_fields, project: project, payload: payload) } + let_it_be(:alert_1) { create(:alert_management_alert, :all_fields, project: project, severity: :low) } + let_it_be(:alert_2) { create(:alert_management_alert, :all_fields, project: project, severity: :critical, payload: payload) } + let_it_be(:other_project_alert) { create(:alert_management_alert, :all_fields) } let(:fields) do <<~QUERY @@ -85,6 +86,33 @@ describe 'getting Alert Management Alerts' do it { expect(alerts.size).to eq(1) } it { expect(first_alert['iid']).to eq(alert_1.iid.to_s) } end + + context 'sorting data given' do + let(:query) do + graphql_query_for( + 'project', + { 'fullPath' => project.full_path }, + query_graphql_field('alertManagementAlerts', params, fields) + ) + end + + let(:params) { 'sort: SEVERITY_DESC' } + let(:iids) { alerts.map { |a| a['iid'] } } + + it_behaves_like 'a working graphql query' + + it 'sorts in the correct order' do + expect(iids).to eq [alert_1.iid.to_s, alert_2.iid.to_s] + end + + context 'ascending order' do + let(:params) { 'sort: SEVERITY_ASC' } + + it 'sorts in the correct order' do + expect(iids).to eq [alert_2.iid.to_s, alert_1.iid.to_s] + end + end + end end end end |