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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
a63792b7
Commit
a63792b7
authored
Dec 04, 2017
by
Alexis Reigel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
accepts `.all` as a hook scope as well
parent
a78abf3a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
2 deletions
+11
-2
app/models/concerns/triggerable_hooks.rb
app/models/concerns/triggerable_hooks.rb
+2
-1
spec/models/concerns/triggerable_hooks_spec.rb
spec/models/concerns/triggerable_hooks_spec.rb
+9
-1
No files found.
app/models/concerns/triggerable_hooks.rb
View file @
a63792b7
...
...
@@ -18,7 +18,8 @@ module TriggerableHooks
attr_reader
:triggerable_hooks
def
hooks_for
(
trigger
)
return
none
unless
self
::
TRIGGERS
.
keys
.
include?
(
trigger
)
callable_scopes
=
self
::
TRIGGERS
.
keys
+
[
:all
]
return
none
unless
callable_scopes
.
include?
(
trigger
)
public_send
(
trigger
)
# rubocop:disable GitlabSecurity/PublicSend
end
...
...
spec/models/concerns/triggerable_hooks_spec.rb
View file @
a63792b7
...
...
@@ -26,10 +26,18 @@ RSpec.describe TriggerableHooks do
context
'the model does not have the required trigger scope'
do
it
'returns an empty relation'
do
TestableHook
.
create!
(
url:
'http://example.com'
,
push_events:
true
)
TestableHook
.
create!
(
url:
'http://example.com'
)
expect
(
TestableHook
.
hooks_for
(
:tag_push_hooks
)).
to
eq
[]
end
end
context
'the stock scope ".all" is accepted'
do
it
'returns the record'
do
hook
=
TestableHook
.
create!
(
url:
'http://example.com'
)
expect
(
TestableHook
.
hooks_for
(
:all
)).
to
eq
[
hook
]
end
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