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
0bbeebc8
Commit
0bbeebc8
authored
Apr 07, 2016
by
Jacob Schatz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove dumb debug statement and add many tests.
parent
8172d2c1
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
116 additions
and
2 deletions
+116
-2
config/gitlab.yml.example
config/gitlab.yml.example
+1
-1
config/initializers/1_settings.rb
config/initializers/1_settings.rb
+0
-1
spec/lib/gitlab/closing_issue_extractor_spec.rb
spec/lib/gitlab/closing_issue_extractor_spec.rb
+115
-0
No files found.
config/gitlab.yml.example
View file @
0bbeebc8
...
@@ -80,7 +80,7 @@ production: &base
...
@@ -80,7 +80,7 @@ production: &base
# This happens when the commit is pushed or merged into the default branch of a project.
# This happens when the commit is pushed or merged into the default branch of a project.
# When not specified the default issue_closing_pattern as specified below will be used.
# When not specified the default issue_closing_pattern as specified below will be used.
# Tip: you can test your closing pattern at http://rubular.com.
# Tip: you can test your closing pattern at http://rubular.com.
# issue_closing_pattern: '((?:[Cc]los(?:e[sd]?|ing)|[Ff]ix(?:e[sd]|ing)?
) +(?:(?:issues? +)?%{issue_ref}(?:(?:, *| +and +)?
))+)'
# issue_closing_pattern: '((?:[Cc]los(?:e[sd]?|ing)|[Ff]ix(?:e[sd]|ing)?
|[Rr]esolv(?:e[sd]?|ing))(:?) +(?:(?:issues? +)?%{issue_ref}(?:(?:, *| +and +)?)|([A-Z][A-Z0-9_]+-\d+
))+)'
## Default project features settings
## Default project features settings
default_projects_features:
default_projects_features:
...
...
config/initializers/1_settings.rb
View file @
0bbeebc8
...
@@ -177,7 +177,6 @@ Settings.gitlab['signin_enabled'] ||= true if Settings.gitlab['signin_enabled'].
...
@@ -177,7 +177,6 @@ Settings.gitlab['signin_enabled'] ||= true if Settings.gitlab['signin_enabled'].
Settings
.
gitlab
[
'restricted_visibility_levels'
]
=
Settings
.
send
(
:verify_constant_array
,
Gitlab
::
VisibilityLevel
,
Settings
.
gitlab
[
'restricted_visibility_levels'
],
[])
Settings
.
gitlab
[
'restricted_visibility_levels'
]
=
Settings
.
send
(
:verify_constant_array
,
Gitlab
::
VisibilityLevel
,
Settings
.
gitlab
[
'restricted_visibility_levels'
],
[])
Settings
.
gitlab
[
'username_changing_enabled'
]
=
true
if
Settings
.
gitlab
[
'username_changing_enabled'
].
nil?
Settings
.
gitlab
[
'username_changing_enabled'
]
=
true
if
Settings
.
gitlab
[
'username_changing_enabled'
].
nil?
Settings
.
gitlab
[
'issue_closing_pattern'
]
=
'((?:[Cc]los(?:e[sd]?|ing)|[Ff]ix(?:e[sd]|ing)?|[Rr]esolv(?:e[sd]?|ing))(:?) +(?:(?:issues? +)?%{issue_ref}(?:(?:, *| +and +)?)|([A-Z][A-Z0-9_]+-\d+))+)'
if
Settings
.
gitlab
[
'issue_closing_pattern'
].
nil?
Settings
.
gitlab
[
'issue_closing_pattern'
]
=
'((?:[Cc]los(?:e[sd]?|ing)|[Ff]ix(?:e[sd]|ing)?|[Rr]esolv(?:e[sd]?|ing))(:?) +(?:(?:issues? +)?%{issue_ref}(?:(?:, *| +and +)?)|([A-Z][A-Z0-9_]+-\d+))+)'
if
Settings
.
gitlab
[
'issue_closing_pattern'
].
nil?
puts
Settings
.
gitlab
[
'issue_closing_pattern'
]
Settings
.
gitlab
[
'default_projects_features'
]
||=
{}
Settings
.
gitlab
[
'default_projects_features'
]
||=
{}
Settings
.
gitlab
[
'webhook_timeout'
]
||=
10
Settings
.
gitlab
[
'webhook_timeout'
]
||=
10
Settings
.
gitlab
[
'max_attachment_size'
]
||=
10
Settings
.
gitlab
[
'max_attachment_size'
]
||=
10
...
...
spec/lib/gitlab/closing_issue_extractor_spec.rb
View file @
0bbeebc8
...
@@ -22,11 +22,21 @@ describe Gitlab::ClosingIssueExtractor, lib: true do
...
@@ -22,11 +22,21 @@ describe Gitlab::ClosingIssueExtractor, lib: true do
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
end
end
it
do
message
=
"Awesome commit (Closes:
#{
reference
}
)"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
end
it
do
it
do
message
=
"Awesome commit (closes
#{
reference
}
)"
message
=
"Awesome commit (closes
#{
reference
}
)"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
end
end
it
do
message
=
"Awesome commit (closes:
#{
reference
}
)"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
end
it
do
it
do
message
=
"Closed
#{
reference
}
"
message
=
"Closed
#{
reference
}
"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
...
@@ -37,106 +47,211 @@ describe Gitlab::ClosingIssueExtractor, lib: true do
...
@@ -37,106 +47,211 @@ describe Gitlab::ClosingIssueExtractor, lib: true do
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
end
end
it
do
message
=
"closed:
#{
reference
}
"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
end
it
do
it
do
message
=
"Closing
#{
reference
}
"
message
=
"Closing
#{
reference
}
"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
end
end
it
do
message
=
"Closing:
#{
reference
}
"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
end
it
do
it
do
message
=
"closing
#{
reference
}
"
message
=
"closing
#{
reference
}
"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
end
end
it
do
message
=
"closing:
#{
reference
}
"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
end
it
do
it
do
message
=
"Close
#{
reference
}
"
message
=
"Close
#{
reference
}
"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
end
end
it
do
message
=
"Close:
#{
reference
}
"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
end
it
do
it
do
message
=
"close
#{
reference
}
"
message
=
"close
#{
reference
}
"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
end
end
it
do
message
=
"close:
#{
reference
}
"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
end
it
do
it
do
message
=
"Awesome commit (Fixes
#{
reference
}
)"
message
=
"Awesome commit (Fixes
#{
reference
}
)"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
end
end
it
do
message
=
"Awesome commit (Fixes:
#{
reference
}
)"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
end
it
do
it
do
message
=
"Awesome commit (fixes
#{
reference
}
)"
message
=
"Awesome commit (fixes
#{
reference
}
)"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
end
end
it
do
message
=
"Awesome commit (Fixes:
#{
reference
}
)"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
end
it
do
it
do
message
=
"Fixed
#{
reference
}
"
message
=
"Fixed
#{
reference
}
"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
end
end
it
do
message
=
"Fixed:
#{
reference
}
"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
end
it
do
it
do
message
=
"fixed
#{
reference
}
"
message
=
"fixed
#{
reference
}
"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
end
end
it
do
message
=
"fixed:
#{
reference
}
"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
end
it
do
it
do
message
=
"Fixing
#{
reference
}
"
message
=
"Fixing
#{
reference
}
"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
end
end
it
do
message
=
"Fixing:
#{
reference
}
"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
end
it
do
it
do
message
=
"fixing
#{
reference
}
"
message
=
"fixing
#{
reference
}
"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
end
end
it
do
message
=
"fixing:
#{
reference
}
"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
end
it
do
it
do
message
=
"Fix
#{
reference
}
"
message
=
"Fix
#{
reference
}
"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
end
end
it
do
message
=
"Fix:
#{
reference
}
"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
end
it
do
it
do
message
=
"fix
#{
reference
}
"
message
=
"fix
#{
reference
}
"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
end
end
it
do
message
=
"fix:
#{
reference
}
"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
end
it
do
it
do
message
=
"Awesome commit (Resolves
#{
reference
}
)"
message
=
"Awesome commit (Resolves
#{
reference
}
)"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
end
end
it
do
message
=
"Awesome commit (Resolves:
#{
reference
}
)"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
end
it
do
it
do
message
=
"Awesome commit (resolves
#{
reference
}
)"
message
=
"Awesome commit (resolves
#{
reference
}
)"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
end
end
it
do
message
=
"Awesome commit (resolves:
#{
reference
}
)"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
end
it
do
it
do
message
=
"Resolved
#{
reference
}
"
message
=
"Resolved
#{
reference
}
"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
end
end
it
do
message
=
"Resolved:
#{
reference
}
"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
end
it
do
it
do
message
=
"resolved
#{
reference
}
"
message
=
"resolved
#{
reference
}
"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
end
end
it
do
message
=
"resolved:
#{
reference
}
"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
end
it
do
it
do
message
=
"Resolving
#{
reference
}
"
message
=
"Resolving
#{
reference
}
"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
end
end
it
do
message
=
"Resolving:
#{
reference
}
"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
end
it
do
it
do
message
=
"resolving
#{
reference
}
"
message
=
"resolving
#{
reference
}
"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
end
end
it
do
message
=
"resolving:
#{
reference
}
"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
end
it
do
it
do
message
=
"Resolve
#{
reference
}
"
message
=
"Resolve
#{
reference
}
"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
end
end
it
do
message
=
"Resolve:
#{
reference
}
"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
end
it
do
it
do
message
=
"resolve
#{
reference
}
"
message
=
"resolve
#{
reference
}
"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
end
end
it
do
message
=
"resolve:
#{
reference
}
"
expect
(
subject
.
closed_by_message
(
message
)).
to
eq
([
issue
])
end
context
'with an external issue tracker reference'
do
context
'with an external issue tracker reference'
do
it
'extracts the referenced issue'
do
it
'extracts the referenced issue'
do
jira_project
=
create
(
:jira_project
,
name:
'JIRA_EXT1'
)
jira_project
=
create
(
:jira_project
,
name:
'JIRA_EXT1'
)
...
...
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