diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-01 09:11:45 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-01 09:11:45 +0300 |
commit | 6c9db7d110fec154dda991e3c323027404fbc940 (patch) | |
tree | c7d2e5d850c93df0fd6d7d096f588fdfe5c5a2ff /spec | |
parent | e5f18589063c991e0fb20fb1566060cddb72f649 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
-rw-r--r-- | spec/lib/gitlab/pagination/keyset/column_order_definition_spec.rb | 29 | ||||
-rw-r--r-- | spec/migrations/20220606080509_fix_incorrect_job_artifacts_expire_at_spec.rb (renamed from spec/migrations/20220606054503_fix_incorrect_job_artifacts_expire_at_spec.rb) | 0 | ||||
-rw-r--r-- | spec/requests/api/graphql/project/issues_spec.rb | 2 | ||||
-rw-r--r-- | spec/routing/uploads_routing_spec.rb | 8 |
4 files changed, 30 insertions, 9 deletions
diff --git a/spec/lib/gitlab/pagination/keyset/column_order_definition_spec.rb b/spec/lib/gitlab/pagination/keyset/column_order_definition_spec.rb index 778244677ef..100574cc75f 100644 --- a/spec/lib/gitlab/pagination/keyset/column_order_definition_spec.rb +++ b/spec/lib/gitlab/pagination/keyset/column_order_definition_spec.rb @@ -50,6 +50,20 @@ RSpec.describe Gitlab::Pagination::Keyset::ColumnOrderDefinition do it { expect(project_calculated_column).to be_ascending_order } it { expect(project_calculated_column).not_to be_descending_order } + context 'when order expression is an Arel node with nulls_last' do + it 'can automatically determine the reversed expression' do + column_order_definition = described_class.new( + attribute_name: :name, + column_expression: Project.arel_table[:name], + order_expression: Project.arel_table[:name].asc.nulls_last, + nullable: :nulls_last, + distinct: false + ) + + expect(column_order_definition).to be_ascending_order + end + end + it 'raises error when order direction cannot be infered' do expect do described_class.new( @@ -132,6 +146,21 @@ RSpec.describe Gitlab::Pagination::Keyset::ColumnOrderDefinition do expect(column_order_definition.reverse.order_expression).to eq('name desc') end end + + context 'when order expression is an Arel node with nulls_last' do + it 'can automatically determine the reversed expression' do + column_order_definition = described_class.new( + attribute_name: :name, + column_expression: Project.arel_table[:name], + order_expression: Project.arel_table[:name].asc.nulls_last, + order_direction: :asc, + nullable: :nulls_last, + distinct: false + ) + + expect(column_order_definition.reverse.order_expression).to eq(Project.arel_table[:name].desc.nulls_first) + end + end end describe '#nullable' do diff --git a/spec/migrations/20220606054503_fix_incorrect_job_artifacts_expire_at_spec.rb b/spec/migrations/20220606080509_fix_incorrect_job_artifacts_expire_at_spec.rb index 5921dd64c0e..5921dd64c0e 100644 --- a/spec/migrations/20220606054503_fix_incorrect_job_artifacts_expire_at_spec.rb +++ b/spec/migrations/20220606080509_fix_incorrect_job_artifacts_expire_at_spec.rb diff --git a/spec/requests/api/graphql/project/issues_spec.rb b/spec/requests/api/graphql/project/issues_spec.rb index d0ed4212349..28282860416 100644 --- a/spec/requests/api/graphql/project/issues_spec.rb +++ b/spec/requests/api/graphql/project/issues_spec.rb @@ -301,7 +301,7 @@ RSpec.describe 'getting an issue list for a project' do let_it_be(:relative_issue5) { create(:issue, project: sort_project, relative_position: 500) } context 'when ascending' do - it_behaves_like 'sorted paginated query' do + it_behaves_like 'sorted paginated query', is_reversible: true do let(:sort_param) { :RELATIVE_POSITION_ASC } let(:first_param) { 2 } let(:all_records) do diff --git a/spec/routing/uploads_routing_spec.rb b/spec/routing/uploads_routing_spec.rb index 41646d1b515..9eb421ec7d0 100644 --- a/spec/routing/uploads_routing_spec.rb +++ b/spec/routing/uploads_routing_spec.rb @@ -39,12 +39,4 @@ RSpec.describe 'Uploads', 'routing' do expect(post("/uploads/#{model}?id=1")).not_to be_routable end end - - describe 'legacy paths' do - include RSpec::Rails::RequestExampleGroup - - it 'redirects project uploads to canonical path under project namespace' do - expect(get('/uploads/namespace/project/12345/test.png')).to redirect_to('/namespace/project/uploads/12345/test.png') - end - end end |