diff --git a/app/views/shared/milestones/_milestone.html.haml b/app/views/shared/milestones/_milestone.html.haml index 6f6a036b13f..6a85f7d0564 100644 --- a/app/views/shared/milestones/_milestone.html.haml +++ b/app/views/shared/milestones/_milestone.html.haml @@ -32,7 +32,7 @@ .col-sm-6.milestone-actions - if can?(current_user, :admin_milestones, @group) - if milestone.is_group_milestone? - = link_to edit_group_milestone_path(@group, milestone.id), class: "btn btn-xs btn-grouped" do + = link_to edit_group_milestone_path(@group, milestone), class: "btn btn-xs btn-grouped" do Edit \ - if milestone.closed? diff --git a/app/views/shared/milestones/_top.html.haml b/app/views/shared/milestones/_top.html.haml index b93837e3087..3014300fbe7 100644 --- a/app/views/shared/milestones/_top.html.haml +++ b/app/views/shared/milestones/_top.html.haml @@ -23,7 +23,7 @@ .pull-right - if can?(current_user, :admin_milestones, group) - if milestone.is_group_milestone? - = link_to edit_group_milestone_path(group, milestone.iid), class: "btn btn btn-grouped" do + = link_to edit_group_milestone_path(group, milestone), class: "btn btn btn-grouped" do Edit - if milestone.active? = link_to 'Close Milestone', group_milestone_route(milestone, {state_event: :close }), method: :put, class: "btn btn-grouped btn-close" diff --git a/spec/features/groups/milestone_spec.rb b/spec/features/groups/milestone_spec.rb index 32b3e13c624..56144d17d4f 100644 --- a/spec/features/groups/milestone_spec.rb +++ b/spec/features/groups/milestone_spec.rb @@ -35,12 +35,12 @@ feature 'Group milestones', :js do context 'milestones list' do let!(:other_project) { create(:project_empty_repo, group: group) } - let!(:active_group_milestone) { create(:milestone, group: group, state: 'active') } let!(:active_project_milestone1) { create(:milestone, project: project, state: 'active', title: 'v1.0') } let!(:active_project_milestone2) { create(:milestone, project: other_project, state: 'active', title: 'v1.0') } - let!(:closed_group_milestone) { create(:milestone, group: group, state: 'closed') } let!(:closed_project_milestone1) { create(:milestone, project: project, state: 'closed', title: 'v2.0') } let!(:closed_project_milestone2) { create(:milestone, project: other_project, state: 'closed', title: 'v2.0') } + let!(:active_group_milestone) { create(:milestone, group: group, state: 'active') } + let!(:closed_group_milestone) { create(:milestone, group: group, state: 'closed') } before do visit group_milestones_path(group) @@ -58,5 +58,30 @@ feature 'Group milestones', :js do expect(page).to have_selector("#milestone_#{active_group_milestone.id}", count: 1) expect(page).to have_selector("#milestone_#{legacy_milestone.milestones.first.id}", count: 1) end + + it 'updates milestone' do + page.within(".milestones #milestone_#{active_group_milestone.id}") do + click_link('Edit') + end + + page.within('.milestone-form') do + fill_in 'milestone_title', with: 'new title' + click_button('Update milestone') + end + + expect(find('#content-body h2')).to have_content('new title') + end + + it 'shows milestone detail and supports its edit' do + page.within(".milestones #milestone_#{active_group_milestone.id}") do + click_link(active_group_milestone.title) + end + + page.within('.detail-page-header') do + click_link('Edit') + end + + expect(page).to have_selector('.milestone-form') + end end end