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
042cf15b
Commit
042cf15b
authored
Jul 18, 2017
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cache Note#notable for commits and fix tests
parent
4d03873c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
5 deletions
+11
-5
app/models/note.rb
app/models/note.rb
+1
-1
spec/factories/commits.rb
spec/factories/commits.rb
+7
-2
spec/features/participants_autocomplete_spec.rb
spec/features/participants_autocomplete_spec.rb
+2
-1
spec/services/notification_service_spec.rb
spec/services/notification_service_spec.rb
+1
-1
No files found.
app/models/note.rb
View file @
042cf15b
...
@@ -190,7 +190,7 @@ class Note < ActiveRecord::Base
...
@@ -190,7 +190,7 @@ class Note < ActiveRecord::Base
# override to return commits, which are not active record
# override to return commits, which are not active record
def
noteable
def
noteable
if
for_commit?
if
for_commit?
project
.
commit
(
commit_id
)
@commit
||=
project
.
commit
(
commit_id
)
else
else
super
super
end
end
...
...
spec/factories/commits.rb
View file @
042cf15b
...
@@ -4,14 +4,19 @@ FactoryGirl.define do
...
@@ -4,14 +4,19 @@ FactoryGirl.define do
factory
:commit
do
factory
:commit
do
git_commit
RepoHelpers
.
sample_commit
git_commit
RepoHelpers
.
sample_commit
project
factory: :empty_project
project
factory: :empty_project
author
{
build
(
:author
)
}
initialize_with
do
initialize_with
do
new
(
git_commit
,
project
)
new
(
git_commit
,
project
)
end
end
after
(
:build
)
do
|
commit
|
allow
(
commit
).
to
receive
(
:author
).
and_return
build
(
:author
)
end
trait
:without_author
do
trait
:without_author
do
author
nil
after
(
:build
)
do
|
commit
|
allow
(
commit
).
to
receive
(
:author
).
and_return
nil
end
end
end
end
end
end
end
spec/features/participants_autocomplete_spec.rb
View file @
042cf15b
...
@@ -54,7 +54,8 @@ feature 'Member autocomplete', :js do
...
@@ -54,7 +54,8 @@ feature 'Member autocomplete', :js do
let
(
:note
)
{
create
(
:note_on_commit
,
project:
project
,
commit_id:
project
.
commit
.
id
)
}
let
(
:note
)
{
create
(
:note_on_commit
,
project:
project
,
commit_id:
project
.
commit
.
id
)
}
before
do
before
do
allow_any_instance_of
(
Commit
).
to
receive
(
:author
).
and_return
(
author
)
allow
(
User
).
to
receive
(
:find_by_any_email
)
.
with
(
noteable
.
author_email
.
downcase
).
and_return
(
author
)
visit
project_commit_path
(
project
,
noteable
)
visit
project_commit_path
(
project
,
noteable
)
end
end
...
...
spec/services/notification_service_spec.rb
View file @
042cf15b
...
@@ -383,7 +383,7 @@ describe NotificationService, services: true do
...
@@ -383,7 +383,7 @@ describe NotificationService, services: true do
before
do
before
do
build_team
(
note
.
project
)
build_team
(
note
.
project
)
reset_delivered_emails!
reset_delivered_emails!
allow
_any_instance_of
(
Commit
).
to
receive
(
:author
).
and_return
(
@u_committer
)
allow
(
note
.
noteable
).
to
receive
(
:author
).
and_return
(
@u_committer
)
update_custom_notification
(
:new_note
,
@u_guest_custom
,
resource:
project
)
update_custom_notification
(
:new_note
,
@u_guest_custom
,
resource:
project
)
update_custom_notification
(
:new_note
,
@u_custom_global
)
update_custom_notification
(
:new_note
,
@u_custom_global
)
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