2016-06-02 11:05:42 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
describe 'Master creates tag' do
|
2016-06-02 11:05:42 +05:30
|
|
|
let(:user) { create(:user) }
|
2017-09-10 17:25:29 +05:30
|
|
|
let(:project) { create(:project, :repository, namespace: user.namespace) }
|
2016-06-02 11:05:42 +05:30
|
|
|
|
|
|
|
before do
|
2018-03-17 18:26:18 +05:30
|
|
|
project.add_master(user)
|
2017-09-10 17:25:29 +05:30
|
|
|
sign_in(user)
|
2016-06-02 11:05:42 +05:30
|
|
|
end
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
context 'from tag list' do
|
|
|
|
before do
|
|
|
|
visit project_tags_path(project)
|
|
|
|
end
|
2016-06-02 11:05:42 +05:30
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
it 'with an invalid name displays an error' do
|
2017-09-10 17:25:29 +05:30
|
|
|
create_tag_in_form(tag: 'v 1.0', ref: 'master')
|
2016-06-02 11:05:42 +05:30
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
expect(page).to have_content 'Tag name invalid'
|
|
|
|
end
|
2016-06-02 11:05:42 +05:30
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
it 'with an invalid reference displays an error' do
|
2017-09-10 17:25:29 +05:30
|
|
|
create_tag_in_form(tag: 'v2.0', ref: 'foo')
|
2016-06-02 11:05:42 +05:30
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
expect(page).to have_content 'Target foo is invalid'
|
|
|
|
end
|
2016-06-02 11:05:42 +05:30
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
it 'that already exists displays an error' do
|
2017-09-10 17:25:29 +05:30
|
|
|
create_tag_in_form(tag: 'v1.1.0', ref: 'master')
|
|
|
|
|
|
|
|
expect(page).to have_content 'Tag v1.1.0 already exists'
|
|
|
|
end
|
2016-06-02 11:05:42 +05:30
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
it 'with multiline message displays the message in a <pre> block' do
|
2017-09-10 17:25:29 +05:30
|
|
|
create_tag_in_form(tag: 'v3.0', ref: 'master', message: "Awesome tag message\n\n- hello\n- world")
|
2016-06-02 11:05:42 +05:30
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
expect(current_path).to eq(
|
|
|
|
project_tag_path(project, 'v3.0'))
|
|
|
|
expect(page).to have_content 'v3.0'
|
|
|
|
page.within 'pre.wrap' do
|
|
|
|
expect(page).to have_content "Awesome tag message\n\n- hello\n- world"
|
|
|
|
end
|
2016-06-02 11:05:42 +05:30
|
|
|
end
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
it 'with multiline release notes parses the release note as Markdown' do
|
2017-09-10 17:25:29 +05:30
|
|
|
create_tag_in_form(tag: 'v4.0', ref: 'master', desc: "Awesome release notes\n\n- hello\n- world")
|
2016-06-02 11:05:42 +05:30
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
expect(current_path).to eq(
|
|
|
|
project_tag_path(project, 'v4.0'))
|
|
|
|
expect(page).to have_content 'v4.0'
|
|
|
|
page.within '.description' do
|
|
|
|
expect(page).to have_content 'Awesome release notes'
|
|
|
|
expect(page).to have_selector('ul li', count: 2)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
it 'opens dropdown for ref', :js do
|
2017-09-10 17:25:29 +05:30
|
|
|
click_link 'New tag'
|
|
|
|
ref_row = find('.form-group:nth-of-type(2) .col-sm-10')
|
|
|
|
page.within ref_row do
|
|
|
|
ref_input = find('[name="ref"]', visible: false)
|
|
|
|
expect(ref_input.value).to eq 'master'
|
|
|
|
expect(find('.dropdown-toggle-text')).to have_content 'master'
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
find('.js-branch-select').click
|
2017-09-10 17:25:29 +05:30
|
|
|
|
|
|
|
expect(find('.dropdown-menu')).to have_content 'empty-branch'
|
|
|
|
end
|
2016-06-02 11:05:42 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
context 'from new tag page' do
|
|
|
|
before do
|
|
|
|
visit new_project_tag_path(project)
|
|
|
|
end
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
it 'description has emoji autocomplete', :js do
|
2017-09-10 17:25:29 +05:30
|
|
|
find('#release_description').native.send_keys('')
|
2018-11-08 19:23:39 +05:30
|
|
|
fill_in 'release_description', with: ':'
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
expect(page).to have_selector('.atwho-view')
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-06-02 11:05:42 +05:30
|
|
|
def create_tag_in_form(tag:, ref:, message: nil, desc: nil)
|
|
|
|
click_link 'New tag'
|
|
|
|
fill_in 'tag_name', with: tag
|
2017-08-17 22:00:37 +05:30
|
|
|
find('#ref', visible: false).set(ref)
|
2016-06-02 11:05:42 +05:30
|
|
|
fill_in 'message', with: message unless message.nil?
|
|
|
|
fill_in 'release_description', with: desc unless desc.nil?
|
|
|
|
click_button 'Create tag'
|
|
|
|
end
|
|
|
|
end
|