debian-mirror-gitlab/spec/features/projects/labels/user_removes_labels_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

58 lines
1.4 KiB
Ruby
Raw Normal View History

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 removes labels" do
2018-05-09 12:01:36 +05:30
let(:project) { create(:project_empty_repo, :public) }
let(:user) { create(:user) }
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)
end
context "when one label" do
let!(:label) { create(:label, project: project) }
before do
visit(project_labels_path(project))
end
2021-04-29 21:17:54 +05:30
it "removes label", :js do
2018-11-08 19:23:39 +05:30
page.within(".other-labels") do
2018-05-09 12:01:36 +05:30
page.first(".label-list-item") do
2018-11-08 19:23:39 +05:30
first('.js-label-options-dropdown').click
2021-04-29 21:17:54 +05:30
first('.js-delete-label-modal-button').click
2018-05-09 12:01:36 +05:30
end
2021-04-29 21:17:54 +05:30
end
2019-07-31 22:56:46 +05:30
2021-04-29 21:17:54 +05:30
expect(page).to have_content("#{label.title} will be permanently deleted from #{project.name}. This cannot be undone.")
2019-07-31 22:56:46 +05:30
2021-04-29 21:17:54 +05:30
first(:link, "Delete label").click
2018-05-09 12:01:36 +05:30
expect(page).to have_content("Label was removed").and have_no_content(label.title)
end
end
context "when many labels", :js do
before do
create_list(:label, 3, project: project)
visit(project_labels_path(project))
end
it "removes all labels" do
2018-11-08 19:23:39 +05:30
loop do
2019-09-04 21:01:54 +05:30
li = page.first(".label-list-item", minimum: 0)
2018-11-08 19:23:39 +05:30
break unless li
2018-05-09 12:01:36 +05:30
2018-11-08 19:23:39 +05:30
li.find('.js-label-options-dropdown').click
li.click_button("Delete")
click_link("Delete label")
2018-05-09 12:01:36 +05:30
end
2018-11-08 19:23:39 +05:30
expect(page).to have_content("Generate a default set of labels").and have_content("New label")
2018-05-09 12:01:36 +05:30
end
end
end