Skip to content
Snippets Groups Projects
Commit 875ffafe authored by Valery Sizov's avatar Valery Sizov
Browse files
parent fbf71fb8
No related branches found
No related tags found
No related merge requests found
Showing with 311 additions and 192 deletions
Loading
Loading
@@ -13,7 +13,7 @@ describe Projects::TagsController do
end
 
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
 
it 'returns releases matching those tags' do
Loading
Loading
Loading
Loading
@@ -695,8 +695,7 @@ describe ProjectsController do
 
parsed_body = JSON.parse(response.body)
expect(parsed_body['Branches']).to include('master')
expect(parsed_body['Tags'].first).to eq('v1.1.0')
expect(parsed_body['Tags'].last).to eq('v1.0.0')
expect(json_response['Tags']).to include('v1.0.0')
expect(parsed_body['Commits']).to be_nil
end
 
Loading
Loading
Loading
Loading
@@ -5,8 +5,9 @@ describe 'Group Badges' do
 
let(:user) { create(:user) }
let(:group) { create(:group) }
let(:badge_link_url) { 'https://gitlab.com/gitlab-org/gitlab-ee/commits/master'}
let(:badge_image_url) { 'https://gitlab.com/gitlab-org/gitlab-ee/badges/master/build.svg'}
let(:project) { create(:project, namespace: group) }
let(:badge_link_url) { "http://#{page.server.host}:#{page.server.port}/#{project.full_path}/commits/master" }
let(:badge_image_url) { "http://#{page.server.host}:#{page.server.port}/#{project.full_path}/badges/master/pipeline.svg" }
let!(:badge_1) { create(:group_badge, group: group) }
let!(:badge_2) { create(:group_badge, group: group) }
 
Loading
Loading
Loading
Loading
@@ -6,8 +6,8 @@ describe 'Project Badges' do
let(:user) { create(:user) }
let(:group) { create(:group) }
let(:project) { create(:project, namespace: group) }
let(:badge_link_url) { 'https://gitlab.com/gitlab-org/gitlab-ee/commits/master'}
let(:badge_image_url) { 'https://gitlab.com/gitlab-org/gitlab-ee/badges/master/build.svg'}
let(:badge_link_url) { "http://#{page.server.host}:#{page.server.port}/#{project.full_path}/commits/master" }
let(:badge_image_url) { "http://#{page.server.host}:#{page.server.port}/#{project.full_path}/badges/master/pipeline.svg" }
let!(:project_badge) { create(:project_badge, project: project) }
let!(:group_badge) { create(:group_badge, group: group) }
 
Loading
Loading
Loading
Loading
@@ -21,23 +21,21 @@ describe 'Project > Tags', :js do
 
context 'page with tags list' do
it 'shows tag name' do
page.within first('.tags > .content-list > li') do
expect(page.find('.row-main-content')).to have_content 'v1.1.0 Version 1.1.0'
end
expect(page).to have_content 'v1.1.0 Version 1.1.0'
end
 
it 'shows tag edit button' do
page.within first('.tags > .content-list > li') do
edit_btn = page.find('.row-fixed-content.controls a.btn-edit')
page.within '.tags > .content-list' do
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
 
context 'edit tag release notes' 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
 
it 'shows tag name header' do
Loading
Loading
Loading
Loading
@@ -14,7 +14,7 @@ describe 'Maintainer deletes tag' do
it 'deletes the tag' do
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'
end
Loading
Loading
@@ -41,15 +41,15 @@ describe 'Maintainer deletes tag' do
end
 
it 'shows the error message' do
delete_first_tag
delete_tag 'v1.1.0'
 
expect(page).to have_content('Do not delete tags')
end
end
 
def delete_first_tag
def delete_tag(tag)
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
Loading
Loading
@@ -12,9 +12,7 @@ describe 'Maintainer updates tag' do
 
context 'from the tags list page' do
it 'updates the release notes' do
page.within(first('.content-list .controls')) do
click_link 'Edit release notes'
end
find("li > .row-fixed-content.controls a.btn-edit[href='/#{project.full_path}/-/tags/v1.1.0/release/edit']").click
 
fill_in 'release_description', with: 'Awesome release notes'
click_button 'Save changes'
Loading
Loading
Loading
Loading
@@ -55,24 +55,25 @@ describe TagsFinder do
end
 
context 'filter and sort' do
it 'filters tags by name and sorts by recently_updated' do
params = { sort: 'updated_desc', search: 'v1' }
tags_finder = described_class.new(repository, params)
let(:tags_to_compare) { %w[v1.0.0 v1.1.0] }
subject { described_class.new(repository, params).execute.select { |tag| tags_to_compare.include?(tag.name) } }
 
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')
expect(result.count).to eq(2)
it 'filters tags by name' do
expect(subject.first.name).to eq('v1.1.0')
expect(subject.count).to eq(2)
end
end
 
it 'filters tags by name and sorts by last_updated' do
params = { sort: 'updated_asc', search: 'v1' }
tags_finder = described_class.new(repository, params)
result = tags_finder.execute
context 'when sort by updated_asc' do
let(:params) { { sort: 'updated_asc', search: 'v1' } }
 
expect(result.first.name).to eq('v1.0.0')
expect(result.count).to eq(2)
it 'filters tags by name' do
expect(subject.first.name).to eq('v1.0.0')
expect(subject.count).to eq(2)
end
end
end
end
Loading
Loading
Loading
Loading
@@ -202,7 +202,7 @@ describe Gitlab::Gpg::Commit do
end
 
let(:gpg_key_subkey) do
gpg_key.subkeys.find_by(fingerprint: '0522DD29B98F167CD8421752E38FFCAF75ABD92A')
gpg_key.subkeys.find_by(fingerprint: GpgHelpers::User3.subkey_fingerprints.last)
end
 
before do
Loading
Loading
Loading
Loading
@@ -66,14 +66,16 @@ describe Repository do
end
 
describe 'tags_sorted_by' do
let(:tags_to_compare) { %w[v1.0.0 v1.1.0] }
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']) }
end
 
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']) }
end
Loading
Loading
@@ -115,7 +117,7 @@ describe Repository do
context 'annotated tag pointing to a blob' do
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
options = { message: 'test tag message\n',
Loading
Loading
Loading
Loading
@@ -5,6 +5,7 @@ describe API::Tags do
let(:guest) { create(:user).tap { |u| project.add_guest(u) } }
let(:project) { create(:project, :repository, creator: user, path: 'my.project') }
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(:current_user) { nil }
Loading
Loading
@@ -73,7 +74,7 @@ describe API::Tags do
expect(response).to have_gitlab_http_status(200)
expect(response).to match_response_schema('public_api/v4/tags')
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
 
context 'when repository is disabled' do
Loading
Loading
@@ -133,9 +134,9 @@ describe API::Tags do
expect(response).to have_gitlab_http_status(200)
expect(response).to match_response_schema('public_api/v4/tags')
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')
expect(json_response.first['release']['description']).to eq(description)
expected_tag = json_response.find { |r| r['name'] == tag_name }
expect(expected_tag['message']).to eq(tag_message)
expect(expected_tag['release']['description']).to eq(description)
end
end
end
Loading
Loading
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment