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
Léo-Paul Géneau
gitlab-ce
Commits
11a559f7
Commit
11a559f7
authored
Mar 03, 2018
by
Andreas Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Singularize model name.
parent
8a7cd25d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
9 deletions
+9
-9
app/models/event.rb
app/models/event.rb
+1
-1
app/models/user_interacted_project.rb
app/models/user_interacted_project.rb
+1
-1
spec/models/event_spec.rb
spec/models/event_spec.rb
+6
-6
spec/models/user_interacted_project_spec.rb
spec/models/user_interacted_project_spec.rb
+1
-1
No files found.
app/models/event.rb
View file @
11a559f7
...
@@ -395,6 +395,6 @@ class Event < ActiveRecord::Base
...
@@ -395,6 +395,6 @@ class Event < ActiveRecord::Base
# Note the call to .available? is due to earlier migrations
# Note the call to .available? is due to earlier migrations
# that would otherwise conflict with the call to .track
# that would otherwise conflict with the call to .track
# (because the table does not exist yet).
# (because the table does not exist yet).
UserInteractedProject
s
.
track
(
self
)
if
UserInteractedProjects
.
available?
UserInteractedProject
.
track
(
self
)
if
UserInteractedProject
.
available?
end
end
end
end
app/models/user_interacted_project
s
.rb
→
app/models/user_interacted_project.rb
View file @
11a559f7
class
UserInteractedProject
s
<
ActiveRecord
::
Base
class
UserInteractedProject
<
ActiveRecord
::
Base
belongs_to
:user
belongs_to
:user
belongs_to
:project
belongs_to
:project
...
...
spec/models/event_spec.rb
View file @
11a559f7
...
@@ -53,15 +53,15 @@ describe Event do
...
@@ -53,15 +53,15 @@ describe Event do
describe
'after_create :track_user_interacted_projects'
do
describe
'after_create :track_user_interacted_projects'
do
let
(
:event
)
{
build
(
:push_event
,
project:
project
,
author:
project
.
owner
)
}
let
(
:event
)
{
build
(
:push_event
,
project:
project
,
author:
project
.
owner
)
}
it
'passes event to UserInteractedProject
s
.track'
do
it
'passes event to UserInteractedProject.track'
do
expect
(
UserInteractedProject
s
).
to
receive
(
:available?
).
and_return
(
true
)
expect
(
UserInteractedProject
).
to
receive
(
:available?
).
and_return
(
true
)
expect
(
UserInteractedProject
s
).
to
receive
(
:track
).
with
(
event
)
expect
(
UserInteractedProject
).
to
receive
(
:track
).
with
(
event
)
event
.
save
event
.
save
end
end
it
'does not call UserInteractedProject
s
.track if its not yet available'
do
it
'does not call UserInteractedProject.track if its not yet available'
do
expect
(
UserInteractedProject
s
).
to
receive
(
:available?
).
and_return
(
false
)
expect
(
UserInteractedProject
).
to
receive
(
:available?
).
and_return
(
false
)
expect
(
UserInteractedProject
s
).
not_to
receive
(
:track
)
expect
(
UserInteractedProject
).
not_to
receive
(
:track
)
event
.
save
event
.
save
end
end
end
end
...
...
spec/models/user_interacted_project
s
_spec.rb
→
spec/models/user_interacted_project_spec.rb
View file @
11a559f7
require
'spec_helper'
require
'spec_helper'
describe
UserInteractedProject
s
do
describe
UserInteractedProject
do
describe
'.track'
do
describe
'.track'
do
subject
{
described_class
.
track
(
event
)
}
subject
{
described_class
.
track
(
event
)
}
let
(
:event
)
{
build
(
:event
)
}
let
(
:event
)
{
build
(
:event
)
}
...
...
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