diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-12 03:10:11 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-12 03:10:11 +0300 |
commit | c6f0b221b71133792f2c9e5a026f3744c16d5ef5 (patch) | |
tree | 864e5737806d454fbf23c681d5bced9b3e4a7d77 /spec/requests | |
parent | 3f45eb27e9586ad87682c2d125770e119a7e9fe0 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/requests')
-rw-r--r-- | spec/requests/api/branches_spec.rb | 7 | ||||
-rw-r--r-- | spec/requests/api/todos_spec.rb | 40 |
2 files changed, 47 insertions, 0 deletions
diff --git a/spec/requests/api/branches_spec.rb b/spec/requests/api/branches_spec.rb index 97f880dd3cd..5e8223ec3cc 100644 --- a/spec/requests/api/branches_spec.rb +++ b/spec/requests/api/branches_spec.rb @@ -16,6 +16,7 @@ describe API::Branches do before do project.add_maintainer(user) + project.repository.add_branch(user, 'ends-with.txt', branch_sha) end describe "GET /projects/:id/repository/branches" do @@ -240,6 +241,12 @@ describe API::Branches do it_behaves_like 'repository branch' end + context 'when branch contains dot txt' do + let(:branch_name) { project.repository.find_branch('ends-with.txt').name } + + it_behaves_like 'repository branch' + end + context 'when branch contains a slash' do let(:branch_name) { branch_with_slash.name } diff --git a/spec/requests/api/todos_spec.rb b/spec/requests/api/todos_spec.rb index 1c380d51813..0bdc71a30e9 100644 --- a/spec/requests/api/todos_spec.rb +++ b/spec/requests/api/todos_spec.rb @@ -159,6 +159,46 @@ describe API::Todos do expect { get api('/todos', john_doe) }.not_to exceed_query_limit(control) expect(response).to have_gitlab_http_status(:ok) end + + context 'when there is a Design Todo' do + let!(:design_todo) { create_todo_for_mentioned_in_design } + + def create_todo_for_mentioned_in_design + issue = create(:issue, project: project_1) + create(:todo, :mentioned, + user: john_doe, + project: project_1, + target: create(:design, issue: issue), + author: create(:user), + note: create(:note, project: project_1, note: "I am note, hear me roar")) + end + + def api_request + get api('/todos', john_doe) + end + + before do + api_request + end + + specify do + expect(response).to have_gitlab_http_status(:ok) + end + + it 'avoids N+1 queries', :request_store do + control = ActiveRecord::QueryRecorder.new { api_request } + + create_todo_for_mentioned_in_design + + expect { api_request }.not_to exceed_query_limit(control) + end + + it 'includes the Design Todo in the response' do + expect(json_response).to include( + a_hash_including('id' => design_todo.id) + ) + end + end end describe 'POST /todos/:id/mark_as_done' do |