Use a better message when milestone is newly created

make some changes for the checks to determine when the messages should be displayed

add item to changelog and also integration test

make some changes to the test

make some changes
This commit is contained in:
Arinde Eniola 2016-04-26 12:22:52 +01:00
parent 10f84f99cb
commit ded3b02f33
4 changed files with 42 additions and 3 deletions

View file

@ -7,6 +7,7 @@ v 8.8.0 (unreleased)
- Fix error when visiting commit builds page before build was updated
- Add 'l' shortcut to open Label dropdown on issuables and 'i' to create new issue on a project
- Updated search UI
- Display informative message when new milestone is created
- Replace Devise Async with Devise ActiveJob integration. !3902 (Connor Shea)
- Allow "NEWS" and "CHANGES" as alternative names for CHANGELOG. !3768 (Connor Shea)
- Added button to toggle whitespaces changes on diff view

View file

@ -8,7 +8,7 @@ module Milestoneish
end
def complete?(user = nil)
total_items_count(user) == closed_items_count(user)
total_items_count(user) > 0 && total_items_count(user) == closed_items_count(user)
end
def percent_complete(user = nil)

View file

@ -42,9 +42,12 @@
= preserve do
= markdown @milestone.description
- if @milestone.complete?(current_user) && @milestone.active?
- if @milestone.total_items_count(current_user).zero?
.alert.alert-success.prepend-top-default
%span All issues for this milestone are closed. You may close milestone now.
%span Assign some issues to this milestone.
- elsif @milestone.complete?(current_user) && @milestone.active?
.alert.alert-success.prepend-top-default
%span All issues for this milestone are closed. You may close this milestone now.
= render 'shared/milestones/summary', milestone: @milestone, project: @project
= render 'shared/milestones/tabs', milestone: @milestone

View file

@ -0,0 +1,35 @@
require 'rails_helper'
feature 'Milestone', feature: true do
include WaitForAjax
let(:project) { create(:project, :public) }
let(:user) { create(:user) }
let(:milestone) { create(:milestone, project: project, title: 8.7) }
before do
project.team << [user, :master]
login_as(user)
end
feature 'Create a milestone' do
scenario 'should show an informative message for a new issue' do
visit new_namespace_project_milestone_path(project.namespace, project)
page.within '.milestone-form' do
fill_in "milestone_title", with: '8.7'
end
find('input[name="commit"]').click
expect(find('.alert-success')).to have_content('Assign some issues to this milestone.')
end
end
feature 'Open a milestone with closed issues' do
scenario 'should show an informative message' do
create(:issue, title: "Bugfix1", project: project, milestone: milestone, state: "closed")
visit namespace_project_milestone_path(project.namespace, project, milestone)
expect(find('.alert-success')).to have_content('All issues for this milestone are closed. You may close this milestone now.')
end
end
end