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
b23e59e6
Commit
b23e59e6
authored
Nov 11, 2019
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a method to return the consumer class name
parent
2b566300
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
1 deletion
+13
-1
ee/app/models/concerns/geo/eventable.rb
ee/app/models/concerns/geo/eventable.rb
+4
-0
ee/lib/gitlab/geo/log_cursor/daemon.rb
ee/lib/gitlab/geo/log_cursor/daemon.rb
+1
-1
ee/spec/models/concerns/geo/eventable_spec.rb
ee/spec/models/concerns/geo/eventable_spec.rb
+8
-0
No files found.
ee/app/models/concerns/geo/eventable.rb
View file @
b23e59e6
...
...
@@ -19,5 +19,9 @@ module Geo
::
Gitlab
::
Database
::
Subquery
.
self_join
(
limit
(
limit
)).
delete_all
end
end
def
consumer_klass_name
self
.
class
.
name
.
demodulize
end
end
end
ee/lib/gitlab/geo/log_cursor/daemon.rb
View file @
b23e59e6
...
...
@@ -114,7 +114,7 @@ module Gitlab
end
def
event_klass_for
(
event
)
event_klass_name
=
event
.
c
lass
.
name
.
demoduliz
e
event_klass_name
=
event
.
c
onsumer_klass_nam
e
current_namespace
=
self
.
class
.
name
.
deconstantize
Object
.
const_get
(
"
#{
current_namespace
}
::Events::
#{
event_klass_name
}
"
,
false
)
end
...
...
ee/spec/models/concerns/geo/eventable_spec.rb
View file @
b23e59e6
...
...
@@ -20,4 +20,12 @@ RSpec.describe Geo::Eventable do
end
.
to
change
{
Geo
::
RepositoryUpdatedEvent
.
count
}.
by
(
-
2
)
end
end
describe
'#consumer_klass_name'
do
it
'returns the even class name without the module part'
do
event
=
build
(
:geo_repository_created_event
)
expect
(
event
.
consumer_klass_name
).
to
eq
'RepositoryCreatedEvent'
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