Commit 3e52517d authored by Marin Jankovski's avatar Marin Jankovski

Add feature tests for group milestone.

parent eb5182ac
......@@ -41,7 +41,7 @@ class Groups::MilestonesController < ApplicationController
end
def title
params[:id].gsub("-", ".")
params[:title]
end
def status(state)
......
......@@ -10,7 +10,7 @@ class GroupMilestone
end
def safe_title
@title.gsub(".", "-")
@title.parameterize
end
def milestones
......
......@@ -26,17 +26,17 @@
.pull-right
- if can?(current_user, :manage_group, @group)
- if milestone.closed?
= link_to 'Reopen Milestone', group_milestone_path(@group, milestone.safe_title, milestone: {state_event: :activate }), method: :put, class: "btn btn-small btn-grouped"
= link_to 'Reopen Milestone', group_milestone_path(@group, milestone.safe_title, title: milestone.title, milestone: {state_event: :activate }), method: :put, class: "btn btn-small btn-grouped"
- else
= link_to 'Close Milestone', group_milestone_path(@group, milestone.safe_title, milestone: {state_event: :close }), method: :put, class: "btn btn-small btn-remove"
= link_to 'Close Milestone', group_milestone_path(@group, milestone.safe_title, title: milestone.title, milestone: {state_event: :close }), method: :put, class: "btn btn-small btn-remove"
%h4
= link_to_gfm truncate(milestone.title, length: 100), group_milestone_path(@group, milestone.safe_title)
= link_to_gfm truncate(milestone.title, length: 100), group_milestone_path(@group, milestone.safe_title, title: milestone.title)
%div
%div
= link_to group_milestone_path(@group, milestone.safe_title, anchor: 'tab-issues') do
= link_to group_milestone_path(@group, milestone.safe_title, title: milestone.title) do
= pluralize milestone.issue_count, 'Issue'
&nbsp;
= link_to group_milestone_path(@group, milestone.safe_title, anchor: 'tab-merge-requests') do
= link_to group_milestone_path(@group, milestone.safe_title, title: milestone.title) do
= pluralize milestone.merge_requests_count, 'Merge Request'
&nbsp;
%span.light #{milestone.percent_complete}% complete
......
......@@ -3,9 +3,9 @@
.pull-right
- if can?(current_user, :manage_group, @group)
- if @group_milestone.active?
= link_to 'Close Milestone', group_milestone_path(@group, @group_milestone.safe_title, milestone: {state_event: :close }), method: :put, class: "btn btn-small btn-remove"
= link_to 'Close Milestone', group_milestone_path(@group, @group_milestone.safe_title, title: @group_milestone.title, milestone: {state_event: :close }), method: :put, class: "btn btn-small btn-remove"
- else
= link_to 'Reopen Milestone', group_milestone_path(@group, @group_milestone.safe_title, milestone: {state_event: :activate }), method: :put, class: "btn btn-small btn-grouped"
= link_to 'Reopen Milestone', group_milestone_path(@group, @group_milestone.safe_title, title: @group_milestone.title, milestone: {state_event: :activate }), method: :put, class: "btn btn-small btn-grouped"
- if (@group_milestone.total_items_count == @group_milestone.closed_items_count) && @group_milestone.active?
.alert.alert-success
......
......@@ -120,3 +120,22 @@ Feature: Groups
When I search for 'Mary' member
Then I should see user "Mary Jane" in team list
Then I should not see user "John Doe" in team list
Scenario: I should see group "Owned" milestone index page with no milestones
When I visit group "Owned" page
And I click on group milestones
Then I should see group milestones index page has no milestones
Scenario: I should see group "Owned" milestone index page with milestones
Given Group has projects with milestones
When I visit group "Owned" page
And I click on group milestones
Then I should see group milestones index page with milestones
Scenario: I should see group "Owned" milestone show page
Given Group has projects with milestones
When I visit group "Owned" page
And I click on group milestones
And I click on one group milestone
Then I should see group milestone with all issues and MRs assigned to that milestone
......@@ -164,6 +164,36 @@ class Groups < Spinach::FeatureSteps
end
end
step 'I click on group milestones' do
click_link 'Milestones'
end
step 'I should see group milestones index page has no milestones' do
page.should have_content('No milestones to show')
end
step 'Group has projects with milestones' do
group_milestone
end
step 'I should see group milestones index page with milestones' do
page.should have_content('Version 7.2')
page.should have_content('GL-113')
page.should have_link('2 Issues', href: group_milestone_path("owned", "version-7-2", title: "Version 7.2"))
page.should have_link('3 Merge Requests', href: group_milestone_path("owned", "gl-113", title: "GL-113"))
end
step 'I click on one group milestone' do
click_link 'GL-113'
end
step 'I should see group milestone with all issues and MRs assigned to that milestone' do
page.should have_content('Milestone GL-113')
page.should have_content('Progress: 0 closed – 4 open')
page.should have_link(@issue1.title, href: project_issue_path(@project1, @issue1))
page.should have_link(@mr3.title, href: project_merge_request_path(@project3, @mr3))
end
protected
def assigned_to_me key
......@@ -173,4 +203,68 @@ class Groups < Spinach::FeatureSteps
def project
Group.find_by(name: "Owned").projects.first
end
def group_milestone
group = Group.find_by(name: "Owned")
@project1 = create :project,
group: group
project2 = create :project,
path: 'gitlab-ci',
group: group
@project3 = create :project,
path: 'cookbook-gitlab',
group: group
milestone1_project1 = create :milestone,
title: "Version 7.2",
project: @project1
milestone1_project2 = create :milestone,
title: "Version 7.2",
project: project2
milestone1_project3 = create :milestone,
title: "Version 7.2",
project: @project3
milestone2_project1 = create :milestone,
title: "GL-113",
project: @project1
milestone2_project2 = create :milestone,
title: "GL-113",
project: project2
milestone2_project3 = create :milestone,
title: "GL-113",
project: @project3
@issue1 = create :issue,
project: @project1,
assignee: current_user,
author: current_user,
milestone: milestone2_project1
issue2 = create :issue,
project: project2,
assignee: current_user,
author: current_user,
milestone: milestone1_project2
issue3 = create :issue,
project: @project3,
assignee: current_user,
author: current_user,
milestone: milestone1_project1
mr1 = create :merge_request,
source_project: @project1,
target_project: @project1,
assignee: current_user,
author: current_user,
milestone: milestone2_project1
mr2 = create :merge_request,
source_project: project2,
target_project: project2,
assignee: current_user,
author: current_user,
milestone: milestone2_project2
@mr3 = create :merge_request,
source_project: @project3,
target_project: @project3,
assignee: current_user,
author: current_user,
milestone: milestone2_project3
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment