BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
816fad35
Commit
816fad35
authored
Jan 25, 2017
by
Jarka Kadlecova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don’t count tasks that are not defined as list items correctly
parent
94715834
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
4 deletions
+27
-4
taskable.rb
app/models/concerns/taskable.rb
+4
-4
26068_tasklist_issue.yml
changelogs/unreleased/26068_tasklist_issue.yml
+4
-0
taskable_shared_examples.rb
spec/support/taskable_shared_examples.rb
+19
-0
No files found.
app/models/concerns/taskable.rb
View file @
816fad35
...
@@ -11,10 +11,10 @@ module Taskable
...
@@ -11,10 +11,10 @@ module Taskable
INCOMPLETE
=
'incomplete'
.
freeze
INCOMPLETE
=
'incomplete'
.
freeze
ITEM_PATTERN
=
/
ITEM_PATTERN
=
/
^
^
\s*(?:[-+*]|(?:\d+\.))
? # optional list prefix
\s*(?:[-+*]|(?:\d+\.))
# list prefix required - task item has to be always in a list
\s
* # optional whitespace prefix
\s
+ # whitespace prefix has to be always presented for a list item
(\[\s\]|\[[xX]\]) # checkbox
(\[\s\]|\[[xX]\])
# checkbox
(\s.+) # followed by whitespace and some text.
(\s.+)
# followed by whitespace and some text.
/x
/x
def
self
.
get_tasks
(
content
)
def
self
.
get_tasks
(
content
)
...
...
changelogs/unreleased/26068_tasklist_issue.yml
0 → 100644
View file @
816fad35
---
title
:
Don’t count tasks that are not defined as list items correctly
merge_request
:
8526
author
:
spec/support/taskable_shared_examples.rb
View file @
816fad35
...
@@ -72,6 +72,25 @@ shared_examples 'a Taskable' do
...
@@ -72,6 +72,25 @@ shared_examples 'a Taskable' do
end
end
end
end
describe
'with tasks that are not formatted correctly'
do
before
do
subject
.
description
=
<<-
EOT
.
strip_heredoc
[ ] task 1
[ ] task 2
- [ ]task 1
-[ ] task 2
EOT
end
it
'returns the correct task status'
do
expect
(
subject
.
task_status
).
to
match
(
'0 of'
)
expect
(
subject
.
task_status
).
to
match
(
'0 tasks completed'
)
expect
(
subject
.
task_status_short
).
to
match
(
'0/'
)
expect
(
subject
.
task_status_short
).
to
match
(
'0 task'
)
end
end
describe
'with a complete task'
do
describe
'with a complete task'
do
before
do
before
do
subject
.
description
=
<<-
EOT
.
strip_heredoc
subject
.
description
=
<<-
EOT
.
strip_heredoc
...
...
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