2018-05-09 12:01:36 +05:30
|
|
|
require "spec_helper"
|
|
|
|
|
|
|
|
describe "User removes labels" do
|
|
|
|
let(:project) { create(:project_empty_repo, :public) }
|
|
|
|
let(:user) { create(:user) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
project.add_master(user)
|
|
|
|
sign_in(user)
|
|
|
|
end
|
|
|
|
|
|
|
|
context "when one label" do
|
|
|
|
let!(:label) { create(:label, project: project) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
visit(project_labels_path(project))
|
|
|
|
end
|
|
|
|
|
|
|
|
it "removes label" 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
|
2018-05-09 12:01:36 +05:30
|
|
|
first(".remove-row").click
|
|
|
|
first(:link, "Delete label").click
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
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
|
|
|
|
li = page.first(".label-list-item")
|
|
|
|
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
|