diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-10-20 11:43:02 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-10-20 11:43:02 +0300 |
commit | d9ab72d6080f594d0b3cae15f14b3ef2c6c638cb (patch) | |
tree | 2341ef426af70ad1e289c38036737e04b0aa5007 /spec/support/shared_examples/graphql | |
parent | d6e514dd13db8947884cd58fe2a9c2a063400a9b (diff) |
Add latest changes from gitlab-org/gitlab@14-4-stable-eev14.4.0-rc42
Diffstat (limited to 'spec/support/shared_examples/graphql')
-rw-r--r-- | spec/support/shared_examples/graphql/connection_shared_examples.rb | 2 | ||||
-rw-r--r-- | spec/support/shared_examples/graphql/sorted_paginated_query_shared_examples.rb | 18 |
2 files changed, 10 insertions, 10 deletions
diff --git a/spec/support/shared_examples/graphql/connection_shared_examples.rb b/spec/support/shared_examples/graphql/connection_shared_examples.rb index 4cba5b5a69d..895bab1f51a 100644 --- a/spec/support/shared_examples/graphql/connection_shared_examples.rb +++ b/spec/support/shared_examples/graphql/connection_shared_examples.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true RSpec.shared_examples 'a connection with collection methods' do - %i[to_a size include? empty?].each do |method_name| + %i[to_a size map include? empty?].each do |method_name| it "responds to #{method_name}" do expect(connection).to respond_to(method_name) end diff --git a/spec/support/shared_examples/graphql/sorted_paginated_query_shared_examples.rb b/spec/support/shared_examples/graphql/sorted_paginated_query_shared_examples.rb index eaeb5faee3b..37a805902a9 100644 --- a/spec/support/shared_examples/graphql/sorted_paginated_query_shared_examples.rb +++ b/spec/support/shared_examples/graphql/sorted_paginated_query_shared_examples.rb @@ -9,7 +9,7 @@ # data_path: the keys necessary to dig into the return GraphQL data to get the # returned results # first_param: number of items expected (like a page size) -# expected_results: array of comparison data of all items sorted correctly +# all_records: array of comparison data of all items sorted correctly # pagination_query: method that specifies the GraphQL query # pagination_results_data: method that extracts the sorted data used to compare against # the expected results @@ -38,9 +38,9 @@ # let(:ordered_issues) { issues.sort_by(&:weight) } # # it_behaves_like 'sorted paginated query' do -# let(:sort_param) { :WEIGHT_ASC } -# let(:first_param) { 2 } -# let(:expected_results) { ordered_issues.map(&:iid) } +# let(:sort_param) { :WEIGHT_ASC } +# let(:first_param) { 2 } +# let(:all_records) { ordered_issues.map(&:iid) } # end # end # @@ -51,7 +51,7 @@ RSpec.shared_examples 'sorted paginated query' do |conditions = {}| let(:node_path) { ['id'] } it_behaves_like 'requires variables' do - let(:required_variables) { [:sort_param, :first_param, :expected_results, :data_path, :current_user] } + let(:required_variables) { [:sort_param, :first_param, :all_records, :data_path, :current_user] } end describe do @@ -101,13 +101,13 @@ RSpec.shared_examples 'sorted paginated query' do |conditions = {}| context 'when sorting' do it 'sorts correctly' do - expect(results).to eq expected_results + expect(results).to eq all_records end context 'when paginating' do let(:params) { sort_argument.merge(first: first_param) } - let(:first_page) { expected_results.first(first_param) } - let(:rest) { expected_results.drop(first_param) } + let(:first_page) { all_records.first(first_param) } + let(:rest) { all_records.drop(first_param) } it 'paginates correctly' do expect(results).to eq first_page @@ -130,7 +130,7 @@ RSpec.shared_examples 'sorted paginated query' do |conditions = {}| it 'fetches last elements without error' do post_graphql(pagination_query(params), current_user: current_user) - expect(results.first).to eq(expected_results.last) + expect(results.first).to eq(all_records.last) end end end |