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
Tatuya Kamada
gitlab-ce
Commits
b645f0f4
Commit
b645f0f4
authored
Jun 14, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #9340 from jvanbaarsen/update-noteable
Update noteable after a new note is added
parents
0b3c9742
fbdaf0e2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
2 deletions
+6
-2
app/models/note.rb
app/models/note.rb
+1
-1
spec/lib/gitlab/note_data_builder_spec.rb
spec/lib/gitlab/note_data_builder_spec.rb
+4
-0
spec/models/note_spec.rb
spec/models/note_spec.rb
+1
-1
No files found.
app/models/note.rb
View file @
b645f0f4
...
...
@@ -31,7 +31,7 @@ class Note < ActiveRecord::Base
participant
:author
,
:mentioned_users
belongs_to
:project
belongs_to
:noteable
,
polymorphic:
true
belongs_to
:noteable
,
polymorphic:
true
,
touch:
true
belongs_to
:author
,
class_name:
"User"
delegate
:name
,
to: :project
,
prefix:
true
...
...
spec/lib/gitlab/note_data_builder_spec.rb
View file @
b645f0f4
...
...
@@ -36,6 +36,7 @@ describe 'Gitlab::NoteDataBuilder' do
let
(
:note
)
{
create
(
:note_on_issue
,
noteable_id:
issue
.
id
)
}
it
'returns the note and issue-specific data'
do
data
[
:issue
][
"updated_at"
]
=
fixed_time
expect
(
data
).
to
have_key
(
:issue
)
expect
(
data
[
:issue
]).
to
eq
(
issue
.
hook_attrs
)
end
...
...
@@ -46,6 +47,7 @@ describe 'Gitlab::NoteDataBuilder' do
let
(
:note
)
{
create
(
:note_on_merge_request
,
noteable_id:
merge_request
.
id
)
}
it
'returns the note and merge request data'
do
data
[
:merge_request
][
"updated_at"
]
=
fixed_time
expect
(
data
).
to
have_key
(
:merge_request
)
expect
(
data
[
:merge_request
]).
to
eq
(
merge_request
.
hook_attrs
)
end
...
...
@@ -56,6 +58,7 @@ describe 'Gitlab::NoteDataBuilder' do
let
(
:note
)
{
create
(
:note_on_merge_request_diff
,
noteable_id:
merge_request
.
id
)
}
it
'returns the note and merge request diff data'
do
data
[
:merge_request
][
"updated_at"
]
=
fixed_time
expect
(
data
).
to
have_key
(
:merge_request
)
expect
(
data
[
:merge_request
]).
to
eq
(
merge_request
.
hook_attrs
)
end
...
...
@@ -66,6 +69,7 @@ describe 'Gitlab::NoteDataBuilder' do
let!
(
:note
)
{
create
(
:note_on_project_snippet
,
noteable_id:
snippet
.
id
)
}
it
'returns the note and project snippet data'
do
data
[
:snippet
][
"updated_at"
]
=
fixed_time
expect
(
data
).
to
have_key
(
:snippet
)
expect
(
data
[
:snippet
]).
to
eq
(
snippet
.
hook_attrs
)
end
...
...
spec/models/note_spec.rb
View file @
b645f0f4
...
...
@@ -22,7 +22,7 @@ require 'spec_helper'
describe
Note
do
describe
'associations'
do
it
{
is_expected
.
to
belong_to
(
:project
)
}
it
{
is_expected
.
to
belong_to
(
:noteable
)
}
it
{
is_expected
.
to
belong_to
(
:noteable
)
.
touch
(
true
)
}
it
{
is_expected
.
to
belong_to
(
:author
).
class_name
(
'User'
)
}
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