Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
d618e9c8
Commit
d618e9c8
authored
Jan 28, 2016
by
Rubén Dávila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add specs.
parent
0a08b105
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
77 additions
and
0 deletions
+77
-0
app/models/milestone.rb
app/models/milestone.rb
+1
-0
features/project/milestone.feature
features/project/milestone.feature
+23
-0
features/steps/project/project_milestone.rb
features/steps/project/project_milestone.rb
+53
-0
No files found.
app/models/milestone.rb
View file @
d618e9c8
...
...
@@ -111,6 +111,7 @@ class Milestone < ActiveRecord::Base
end
def
percent_time_used
return
0
unless
due_date
return
100
if
expired?
duration
=
((
created_at
-
due_date
.
to_datetime
)
/
1
.
day
)
...
...
features/project/milestone.feature
0 → 100644
View file @
d618e9c8
Feature
:
Project Milestone
Background
:
Given
I sign in as a user
And
I own project
"Shop"
And project "Shop" has labels
:
"bug",
"feature",
"enhancement"
And
project
"Shop"
has milestone
"v2.2"
And milestone has issue "Bugfix1" with labels
:
"bug",
"feature"
And milestone has issue "Bugfix2" with labels
:
"bug",
"enhancement"
@javascript
Scenario
:
Listing issues from issues tab
Given
I visit project
"Shop"
milestones page
And
I click link
"v2.2"
Then
I should see the labels
"bug"
,
"enhancement"
and
"feature"
@javascript
Scenario
:
Listing labels from labels tab
Given
I visit project
"Shop"
milestones page
And
I click link
"v2.2"
And
I click link
"Labels"
Then
I should see the list of labels
And
I should see the labels
"bug"
,
"enhancement"
and
"feature"
features/steps/project/project_milestone.rb
0 → 100644
View file @
d618e9c8
class
Spinach::Features::ProjectMilestone
<
Spinach
::
FeatureSteps
include
SharedAuthentication
include
SharedProject
include
SharedPaths
step
'milestone has issue "Bugfix1" with labels: "bug", "feature"'
do
project
=
Project
.
find_by
(
name:
"Shop"
)
milestone
=
project
.
milestones
.
find_by
(
title:
'v2.2'
)
issue
=
create
(
:issue
,
title:
"Bugfix1"
,
project:
project
,
milestone:
milestone
)
issue
.
labels
<<
project
.
labels
.
find_by
(
title:
'bug'
)
issue
.
labels
<<
project
.
labels
.
find_by
(
title:
'feature'
)
end
step
'milestone has issue "Bugfix2" with labels: "bug", "enhancement"'
do
project
=
Project
.
find_by
(
name:
"Shop"
)
milestone
=
project
.
milestones
.
find_by
(
title:
'v2.2'
)
issue
=
create
(
:issue
,
title:
"Bugfix2"
,
project:
project
,
milestone:
milestone
)
issue
.
labels
<<
project
.
labels
.
find_by
(
title:
'bug'
)
issue
.
labels
<<
project
.
labels
.
find_by
(
title:
'enhancement'
)
end
step
'project "Shop" has milestone "v2.2"'
do
project
=
Project
.
find_by
(
name:
"Shop"
)
milestone
=
create
(
:milestone
,
title:
"v2.2"
,
project:
project
,
description:
"# Description header"
)
3
.
times
{
create
(
:issue
,
project:
project
,
milestone:
milestone
)
}
end
step
'I should see the list of labels'
do
expect
(
page
).
to
have_selector
(
'ul.manage-labels-list'
)
end
step
'I should see the labels "bug", "enhancement" and "feature"'
do
page
.
within
(
'#tab-issues'
)
do
expect
(
page
).
to
have_content
'bug'
expect
(
page
).
to
have_content
'enhancement'
expect
(
page
).
to
have_content
'feature'
end
end
step
'I click link "v2.2"'
do
click_link
"v2.2"
end
step
'I click link "Labels"'
do
page
.
within
(
'.nav-links'
)
do
page
.
find
(
:xpath
,
"//a[@href='#tab-labels']"
).
click
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment