diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-07-20 12:55:51 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-07-20 12:55:51 +0300 |
commit | e8d2c2579383897a1dd7f9debd359abe8ae8373d (patch) | |
tree | c42be41678c2586d49a75cabce89322082698334 /spec/requests/api/branches_spec.rb | |
parent | fc845b37ec3a90aaa719975f607740c22ba6a113 (diff) |
Add latest changes from gitlab-org/gitlab@14-1-stable-eev14.1.0-rc42
Diffstat (limited to 'spec/requests/api/branches_spec.rb')
-rw-r--r-- | spec/requests/api/branches_spec.rb | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/spec/requests/api/branches_spec.rb b/spec/requests/api/branches_spec.rb index 36fbe86ac76..ad517a05533 100644 --- a/spec/requests/api/branches_spec.rb +++ b/spec/requests/api/branches_spec.rb @@ -4,6 +4,7 @@ require 'spec_helper' RSpec.describe API::Branches do let_it_be(:user) { create(:user) } + let(:project) { create(:project, :repository, creator: user, path: 'my.project') } let(:guest) { create(:user).tap { |u| project.add_guest(u) } } let(:branch_name) { 'feature' } @@ -20,7 +21,7 @@ RSpec.describe API::Branches do stub_feature_flags(branch_list_keyset_pagination: false) end - describe "GET /projects/:id/repository/branches", :use_clean_rails_redis_caching do + describe "GET /projects/:id/repository/branches", :use_clean_rails_redis_caching, :clean_gitlab_redis_shared_state do let(:route) { "/projects/#{project_id}/repository/branches" } shared_examples_for 'repository branches' do @@ -74,6 +75,14 @@ RSpec.describe API::Branches do check_merge_status(json_response) end + + it 'recovers pagination headers from cache between consecutive requests' do + 2.times do + get api(route, current_user), params: base_params + + expect(response.headers).to include('X-Page') + end + end end context 'with gitaly pagination params' do @@ -718,10 +727,11 @@ RSpec.describe API::Branches do end it 'returns 400 if ref name is invalid' do + error_message = 'Failed to create branch \'new_design3\': invalid reference name \'foo\'' post api(route, user), params: { branch: 'new_design3', ref: 'foo' } expect(response).to have_gitlab_http_status(:bad_request) - expect(json_response['message']).to eq('Invalid reference name: foo') + expect(json_response['message']).to eq(error_message) end end |