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
6b6e3007
Commit
6b6e3007
authored
Nov 11, 2019
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Return the proper consumer class for design repositories
parent
eaf4cfd1
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
1 deletion
+30
-1
ee/app/models/geo/repository_updated_event.rb
ee/app/models/geo/repository_updated_event.rb
+11
-0
ee/spec/models/geo/repository_updated_event_spec.rb
ee/spec/models/geo/repository_updated_event_spec.rb
+19
-1
No files found.
ee/app/models/geo/repository_updated_event.rb
View file @
6b6e3007
...
...
@@ -24,5 +24,16 @@ module Geo
def
self
.
source_for
(
repository
)
REPOSITORY_TYPE_MAP
[
repository
.
repo_type
]
end
def
consumer_klass_name
klass
=
if
design?
::
Gitlab
::
Geo
::
LogCursor
::
Events
::
DesignRepositoryUpdatedEvent
else
self
.
class
end
klass
.
name
.
demodulize
end
end
end
ee/spec/models/geo/repository_updated_event_spec.rb
View file @
6b6e3007
...
...
@@ -11,7 +11,25 @@ RSpec.describe Geo::RepositoryUpdatedEvent, type: :model do
it
{
is_expected
.
to
validate_presence_of
(
:project
)
}
end
describe
'#consumer_klass_name'
do
using
RSpec
::
Parameterized
::
TableSyntax
where
(
:source
,
:consumer_klass_name
)
do
:design
|
'DesignRepositoryUpdatedEvent'
:repository
|
'RepositoryUpdatedEvent'
:wiki
|
'RepositoryUpdatedEvent'
end
with_them
do
it
'returns the proper consumer class name'
do
subject
.
source
=
source
expect
(
subject
.
consumer_klass_name
).
to
eq
consumer_klass_name
end
end
end
describe
'#source'
do
it
{
is_expected
.
to
define_enum_for
(
:source
).
with
([
:repository
,
:wiki
,
:design
])
}
it
{
is_expected
.
to
define_enum_for
(
:source
).
with
_values
([
:repository
,
:wiki
,
:design
])
}
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