diff options
author | Felipe Artur <felipefac@gmail.com> | 2018-08-06 16:02:52 -0300 |
---|---|---|
committer | Felipe Artur <felipefac@gmail.com> | 2018-08-06 17:31:47 -0300 |
commit | abb50ff4710e264c0c700df88757ee3ab1cf7dfb (patch) | |
tree | a77ce62f4384becfe7b36fa1ae7fea700895812f /spec/features/milestones | |
parent | cb2e07309b4e61501a44c3568155bdb73252338f (diff) | |
download | gitlab-ce-abb50ff4710e264c0c700df88757ee3ab1cf7dfb.tar.gz |
Allow to delete group milestonesissue_36138
Diffstat (limited to 'spec/features/milestones')
-rw-r--r-- | spec/features/milestones/user_deletes_milestone_spec.rb | 44 |
1 files changed, 32 insertions, 12 deletions
diff --git a/spec/features/milestones/user_deletes_milestone_spec.rb b/spec/features/milestones/user_deletes_milestone_spec.rb index 9d4a68239d3..a8c296b4cd2 100644 --- a/spec/features/milestones/user_deletes_milestone_spec.rb +++ b/spec/features/milestones/user_deletes_milestone_spec.rb @@ -1,26 +1,46 @@ require "rails_helper" describe "User deletes milestone", :js do - set(:user) { create(:user) } - set(:project) { create(:project) } - set(:milestone) { create(:milestone, project: project) } + let(:user) { create(:user) } + let(:group) { create(:group) } + let(:project) { create(:project, namespace: group) } before do - project.add_developer(user) sign_in(user) + end + + context "when milestone belongs to project" do + let!(:milestone) { create(:milestone, parent: project, title: "project milestone") } + + it "deletes milestone" do + project.add_developer(user) + visit(project_milestones_path(project)) + click_link(milestone.title) + click_button("Delete") + click_button("Delete milestone") + + expect(page).to have_content("No milestones to show") + + visit(activity_project_path(project)) - visit(project_milestones_path(project)) + expect(page).to have_content("#{user.name} destroyed milestone") + end end - it "deletes milestone" do - click_link(milestone.title) - click_button("Delete") - click_button("Delete milestone") + context "when milestone belongs to group" do + let!(:milestone_to_be_deleted) { create(:milestone, parent: group, title: "group milestone 1") } + let!(:milestone) { create(:milestone, parent: group, title: "group milestone 2") } - expect(page).to have_content("No milestones to show") + it "deletes milestone" do + group.add_developer(user) + visit(group_milestones_path(group)) - visit(activity_project_path(project)) + click_link(milestone_to_be_deleted.title) + click_button("Delete") + click_button("Delete milestone") - expect(page).to have_content("#{user.name} destroyed milestone") + expect(page).to have_content(milestone.title) + expect(page).not_to have_content(milestone_to_be_deleted) + end end end |