2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-05-09 12:01:36 +05:30
|
|
|
require "spec_helper"
|
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
RSpec.describe "User edits labels" do
|
2022-03-02 08:16:31 +05:30
|
|
|
include Spec::Support::Helpers::ModalHelpers
|
|
|
|
|
2020-04-08 14:13:33 +05:30
|
|
|
let_it_be(:project) { create(:project_empty_repo, :public) }
|
|
|
|
let_it_be(:label) { create(:label, project: project) }
|
|
|
|
let_it_be(:user) { create(:user) }
|
2018-05-09 12:01:36 +05:30
|
|
|
|
|
|
|
before do
|
2018-11-18 11:00:15 +05:30
|
|
|
project.add_maintainer(user)
|
2018-05-09 12:01:36 +05:30
|
|
|
sign_in(user)
|
|
|
|
|
|
|
|
visit(edit_project_label_path(project, label))
|
|
|
|
end
|
|
|
|
|
|
|
|
it "updates label's title" do
|
|
|
|
new_title = "fix"
|
|
|
|
|
|
|
|
fill_in("Title", with: new_title)
|
|
|
|
click_button("Save changes")
|
|
|
|
|
|
|
|
page.within(".other-labels .manage-labels-list") do
|
|
|
|
expect(page).to have_content(new_title).and have_no_content(label.title)
|
|
|
|
end
|
|
|
|
end
|
2022-03-02 08:16:31 +05:30
|
|
|
|
|
|
|
it 'allows user to delete label', :js do
|
|
|
|
click_button 'Delete'
|
|
|
|
|
|
|
|
within_modal do
|
|
|
|
expect(page).to have_content("#{label.title} will be permanently deleted from #{project.name}. This cannot be undone.")
|
|
|
|
|
|
|
|
click_link 'Delete label'
|
|
|
|
end
|
|
|
|
|
|
|
|
expect(page).to have_content('Label was removed')
|
|
|
|
end
|
2018-05-09 12:01:36 +05:30
|
|
|
end
|