Commit 4c442bdd authored by GitLab Bot's avatar GitLab Bot

Add latest changes from gitlab-org/gitlab@12-5-stable-ee

parent 1f0ab897
...@@ -4,7 +4,6 @@ entry. ...@@ -4,7 +4,6 @@ entry.
## 12.5.0 ## 12.5.0
- No changes.
### Security (15 changes) ### Security (15 changes)
- Enable the HttpOnly flag for experimentation_subject_id cookie. !19189 - Enable the HttpOnly flag for experimentation_subject_id cookie. !19189
......
...@@ -13,7 +13,7 @@ describe Projects::TagsController do ...@@ -13,7 +13,7 @@ describe Projects::TagsController do
end end
it 'returns the tags for the page' do it 'returns the tags for the page' do
expect(assigns(:tags).map(&:name)).to eq(['v1.1.0', 'v1.0.0']) expect(assigns(:tags).map(&:name)).to include('v1.1.0', 'v1.0.0')
end end
it 'returns releases matching those tags' do it 'returns releases matching those tags' do
......
...@@ -837,8 +837,7 @@ describe ProjectsController do ...@@ -837,8 +837,7 @@ describe ProjectsController do
get :refs, params: { namespace_id: project.namespace, id: project, sort: 'updated_desc' } get :refs, params: { namespace_id: project.namespace, id: project, sort: 'updated_desc' }
expect(json_response['Branches']).to include('master') expect(json_response['Branches']).to include('master')
expect(json_response['Tags'].first).to eq('v1.1.0') expect(json_response['Tags']).to include('v1.0.0')
expect(json_response['Tags'].last).to eq('v1.0.0')
expect(json_response['Commits']).to be_nil expect(json_response['Commits']).to be_nil
end end
......
...@@ -21,23 +21,21 @@ describe 'Project > Tags', :js do ...@@ -21,23 +21,21 @@ describe 'Project > Tags', :js do
context 'page with tags list' do context 'page with tags list' do
it 'shows tag name' do it 'shows tag name' do
page.within first('.tags > .content-list > li') do expect(page).to have_content 'v1.1.0 Version 1.1.0'
expect(page.find('.row-main-content')).to have_content 'v1.1.0 Version 1.1.0'
end
end end
it 'shows tag edit button' do it 'shows tag edit button' do
page.within first('.tags > .content-list > li') do page.within '.tags > .content-list' do
edit_btn = page.find('.row-fixed-content.controls a.btn-edit') edit_btn = page.find("li > .row-fixed-content.controls a.btn-edit[href='/#{project.full_path}/-/tags/v1.1.0/release/edit']")
expect(edit_btn['href']).to have_content '/tags/v1.1.0/release/edit' expect(edit_btn['href']).to end_with("/#{project.full_path}/-/tags/v1.1.0/release/edit")
end end
end end
end end
context 'edit tag release notes' do context 'edit tag release notes' do
before do before do
find('.tags > .content-list > li:first-child .row-fixed-content.controls a.btn-edit').click page.find("li > .row-fixed-content.controls a.btn-edit[href='/#{project.full_path}/-/tags/v1.1.0/release/edit']").click
end end
it 'shows tag name header' do it 'shows tag name header' do
......
...@@ -17,7 +17,7 @@ describe 'Developer deletes tag' do ...@@ -17,7 +17,7 @@ describe 'Developer deletes tag' do
it 'deletes the tag' do it 'deletes the tag' do
expect(page).to have_content 'v1.1.0' expect(page).to have_content 'v1.1.0'
delete_first_tag delete_tag 'v1.1.0'
expect(page).not_to have_content 'v1.1.0' expect(page).not_to have_content 'v1.1.0'
end end
...@@ -46,15 +46,15 @@ describe 'Developer deletes tag' do ...@@ -46,15 +46,15 @@ describe 'Developer deletes tag' do
end end
it 'shows the error message' do it 'shows the error message' do
delete_first_tag delete_tag 'v1.1.0'
expect(page).to have_content('Do not delete tags') expect(page).to have_content('Do not delete tags')
end end
end end
def delete_first_tag def delete_tag(tag)
page.within('.content') do page.within('.content') do
accept_confirm { first('.btn-remove').click } accept_confirm { find("li > .row-fixed-content.controls a.btn-remove[href='/#{project.full_path}/-/tags/#{tag}']").click }
end end
end end
end end
...@@ -15,9 +15,7 @@ describe 'Developer updates tag' do ...@@ -15,9 +15,7 @@ describe 'Developer updates tag' do
context 'from the tags list page' do context 'from the tags list page' do
it 'updates the release notes' do it 'updates the release notes' do
page.within(first('.content-list .controls')) do find("li > .row-fixed-content.controls a.btn-edit[href='/#{project.full_path}/-/tags/v1.1.0/release/edit']").click
click_link 'Edit release notes'
end
fill_in 'release_description', with: 'Awesome release notes' fill_in 'release_description', with: 'Awesome release notes'
click_button 'Save changes' click_button 'Save changes'
......
...@@ -95,24 +95,25 @@ describe TagsFinder do ...@@ -95,24 +95,25 @@ describe TagsFinder do
end end
context 'filter and sort' do context 'filter and sort' do
it 'filters tags by name and sorts by recently_updated' do let(:tags_to_compare) { %w[v1.0.0 v1.1.0] }
params = { sort: 'updated_desc', search: 'v1' } subject { described_class.new(repository, params).execute.select { |tag| tags_to_compare.include?(tag.name) } }
tags_finder = described_class.new(repository, params)
result = tags_finder.execute context 'when sort by updated_desc' do
let(:params) { { sort: 'updated_desc', search: 'v1' } }
expect(result.first.name).to eq('v1.1.0') it 'filters tags by name' do
expect(result.count).to eq(2) expect(subject.first.name).to eq('v1.1.0')
expect(subject.count).to eq(2)
end
end end
it 'filters tags by name and sorts by last_updated' do context 'when sort by updated_asc' do
params = { sort: 'updated_asc', search: 'v1' } let(:params) { { sort: 'updated_asc', search: 'v1' } }
tags_finder = described_class.new(repository, params)
result = tags_finder.execute
expect(result.first.name).to eq('v1.0.0') it 'filters tags by name' do
expect(result.count).to eq(2) expect(subject.first.name).to eq('v1.0.0')
expect(subject.count).to eq(2)
end
end end
end end
end end
......
...@@ -66,14 +66,16 @@ describe Repository do ...@@ -66,14 +66,16 @@ describe Repository do
end end
describe 'tags_sorted_by' do describe 'tags_sorted_by' do
let(:tags_to_compare) { %w[v1.0.0 v1.1.0] }
context 'name_desc' do context 'name_desc' do
subject { repository.tags_sorted_by('name_desc').map(&:name) } subject { repository.tags_sorted_by('name_desc').map(&:name) & tags_to_compare }
it { is_expected.to eq(['v1.1.0', 'v1.0.0']) } it { is_expected.to eq(['v1.1.0', 'v1.0.0']) }
end end
context 'name_asc' do context 'name_asc' do
subject { repository.tags_sorted_by('name_asc').map(&:name) } subject { repository.tags_sorted_by('name_asc').map(&:name) & tags_to_compare }
it { is_expected.to eq(['v1.0.0', 'v1.1.0']) } it { is_expected.to eq(['v1.0.0', 'v1.1.0']) }
end end
...@@ -115,7 +117,7 @@ describe Repository do ...@@ -115,7 +117,7 @@ describe Repository do
context 'annotated tag pointing to a blob' do context 'annotated tag pointing to a blob' do
let(:annotated_tag_name) { 'annotated-tag' } let(:annotated_tag_name) { 'annotated-tag' }
subject { repository.tags_sorted_by('updated_asc').map(&:name) } subject { repository.tags_sorted_by('updated_asc').map(&:name) & (tags_to_compare + [annotated_tag_name]) }
before do before do
options = { message: 'test tag message\n', options = { message: 'test tag message\n',
......
...@@ -7,6 +7,7 @@ describe API::Tags do ...@@ -7,6 +7,7 @@ describe API::Tags do
let(:guest) { create(:user).tap { |u| project.add_guest(u) } } let(:guest) { create(:user).tap { |u| project.add_guest(u) } }
let(:project) { create(:project, :repository, creator: user, path: 'my.project') } let(:project) { create(:project, :repository, creator: user, path: 'my.project') }
let(:tag_name) { project.repository.find_tag('v1.1.0').name } let(:tag_name) { project.repository.find_tag('v1.1.0').name }
let(:tag_message) { project.repository.find_tag('v1.1.0').message }
let(:project_id) { project.id } let(:project_id) { project.id }
let(:current_user) { nil } let(:current_user) { nil }
...@@ -75,7 +76,7 @@ describe API::Tags do ...@@ -75,7 +76,7 @@ describe API::Tags do
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(200)
expect(response).to match_response_schema('public_api/v4/tags') expect(response).to match_response_schema('public_api/v4/tags')
expect(response).to include_pagination_headers expect(response).to include_pagination_headers
expect(json_response.first['name']).to eq(tag_name) expect(json_response.map { |r| r['name'] }).to include(tag_name)
end end
context 'when repository is disabled' do context 'when repository is disabled' do
...@@ -135,9 +136,10 @@ describe API::Tags do ...@@ -135,9 +136,10 @@ describe API::Tags do
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(200)
expect(response).to match_response_schema('public_api/v4/tags') expect(response).to match_response_schema('public_api/v4/tags')
expect(response).to include_pagination_headers expect(response).to include_pagination_headers
expect(json_response.first['name']).to eq(tag_name)
expect(json_response.first['message']).to eq('Version 1.1.0') expected_tag = json_response.find { |r| r['name'] == tag_name }
expect(json_response.first['release']['description']).to eq(description) expect(expected_tag['message']).to eq(tag_message)
expect(expected_tag['release']['description']).to eq(description)
end end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment