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
eb05dca4
Commit
eb05dca4
authored
Aug 01, 2017
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add repositories_changed_event to Geo::EventLog model
parent
07b389d1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
1 deletion
+18
-1
app/models/geo/event_log.rb
app/models/geo/event_log.rb
+6
-1
spec/factories/geo/event_log.rb
spec/factories/geo/event_log.rb
+4
-0
spec/models/geo/event_log_spec.rb
spec/models/geo/event_log_spec.rb
+8
-0
No files found.
app/models/geo/event_log.rb
View file @
eb05dca4
...
...
@@ -16,10 +16,15 @@ module Geo
class_name:
'Geo::RepositoryRenamedEvent'
,
foreign_key: :repository_renamed_event_id
belongs_to
:repositories_changed_event
,
class_name:
'Geo::RepositoriesChangedEvent'
,
foreign_key: :repositories_changed_event_id
def
event
repository_updated_event
||
repository_deleted_event
||
repository_renamed_event
repository_renamed_event
||
repositories_changed_event
end
end
end
spec/factories/geo/event_log.rb
View file @
eb05dca4
...
...
@@ -37,4 +37,8 @@ FactoryGirl.define do
old_path
{
project
.
path
}
new_path
{
project
.
path
}
end
factory
:geo_repositories_changed_event
,
class:
Geo
::
RepositoriesChangedEvent
do
geo_node
end
end
spec/models/geo/event_log_spec.rb
View file @
eb05dca4
...
...
@@ -5,6 +5,7 @@ RSpec.describe Geo::EventLog, type: :model do
it
{
is_expected
.
to
belong_to
(
:repository_updated_event
).
class_name
(
'Geo::RepositoryUpdatedEvent'
).
with_foreign_key
(
'repository_updated_event_id'
)
}
it
{
is_expected
.
to
belong_to
(
:repository_deleted_event
).
class_name
(
'Geo::RepositoryDeletedEvent'
).
with_foreign_key
(
'repository_deleted_event_id'
)
}
it
{
is_expected
.
to
belong_to
(
:repository_renamed_event
).
class_name
(
'Geo::RepositoryRenamedEvent'
).
with_foreign_key
(
'repository_renamed_event_id'
)
}
it
{
is_expected
.
to
belong_to
(
:repositories_changed_event
).
class_name
(
'Geo::RepositoriesChangedEvent'
).
with_foreign_key
(
'repositories_changed_event_id'
)
}
end
describe
'#event'
do
...
...
@@ -32,6 +33,13 @@ RSpec.describe Geo::EventLog, type: :model do
expect
(
subject
.
event
).
to
eq
repository_renamed_event
end
it
'returns repositories_changed_event when set'
do
repositories_changed_event
=
build
(
:geo_repositories_changed_event
)
subject
.
repositories_changed_event
=
repositories_changed_event
expect
(
subject
.
event
).
to
eq
repositories_changed_event
end
end
describe
'#project_id'
do
...
...
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