2016-06-02 11:05:42 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
feature 'Master deletes 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
|
|
|
|
project.team << [user, :master]
|
2017-09-10 17:25:29 +05:30
|
|
|
sign_in(user)
|
|
|
|
visit project_tags_path(project)
|
2016-06-02 11:05:42 +05:30
|
|
|
end
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
context 'from the tags list page', js: true do
|
2016-06-02 11:05:42 +05:30
|
|
|
scenario 'deletes the tag' do
|
|
|
|
expect(page).to have_content 'v1.1.0'
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
delete_first_tag
|
2016-06-02 11:05:42 +05:30
|
|
|
|
|
|
|
expect(page).not_to have_content 'v1.1.0'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'from a specific tag page' do
|
|
|
|
scenario 'deletes the tag' do
|
|
|
|
click_on 'v1.0.0'
|
|
|
|
expect(current_path).to eq(
|
2017-09-10 17:25:29 +05:30
|
|
|
project_tag_path(project, 'v1.0.0'))
|
2016-06-02 11:05:42 +05:30
|
|
|
|
|
|
|
click_on 'Delete tag'
|
|
|
|
|
|
|
|
expect(current_path).to eq(
|
2017-09-10 17:25:29 +05:30
|
|
|
project_tags_path(project))
|
2016-06-02 11:05:42 +05:30
|
|
|
expect(page).not_to have_content 'v1.0.0'
|
|
|
|
end
|
|
|
|
end
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
context 'when pre-receive hook fails', js: true do
|
|
|
|
before do
|
|
|
|
allow_any_instance_of(GitHooksService).to receive(:execute)
|
|
|
|
.and_raise(GitHooksService::PreReceiveError, 'Do not delete tags')
|
|
|
|
end
|
|
|
|
|
|
|
|
scenario 'shows the error message' do
|
|
|
|
delete_first_tag
|
|
|
|
|
|
|
|
expect(page).to have_content('Do not delete tags')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def delete_first_tag
|
|
|
|
page.within('.content') do
|
|
|
|
first('.btn-remove').click
|
|
|
|
end
|
|
|
|
end
|
2016-06-02 11:05:42 +05:30
|
|
|
end
|