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
Boxiang Sun
gitlab-ce
Commits
35160a97
Commit
35160a97
authored
May 03, 2017
by
blackst0ne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add specs for issue and note changes
parent
d9f48e45
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
2 deletions
+31
-2
app/services/issuable_base_service.rb
app/services/issuable_base_service.rb
+2
-2
spec/features/issues_spec.rb
spec/features/issues_spec.rb
+22
-0
spec/services/notes/update_service_spec.rb
spec/services/notes/update_service_spec.rb
+7
-0
No files found.
app/services/issuable_base_service.rb
View file @
35160a97
...
...
@@ -216,12 +216,12 @@ class IssuableBaseService < BaseService
params
[
:label_ids
]
=
label_ids
if
labels_changing?
(
issuable
.
label_ids
,
label_ids
)
if
issuable
.
changed?
||
params
.
present?
issuable
.
assign_attributes
(
params
.
merge
(
updated_by:
current_user
))
if
has_title_or_description_changed?
(
issuable
)
issuable
.
assign_attributes
(
last_edited_at:
Time
.
now
,
last_edited_by:
current_user
)
end
issuable
.
assign_attributes
(
params
.
merge
(
updated_by:
current_user
))
before_update
(
issuable
)
if
issuable
.
with_transaction_returning_status
{
issuable
.
save
}
...
...
spec/features/issues_spec.rb
View file @
35160a97
...
...
@@ -714,4 +714,26 @@ describe 'Issues', feature: true do
expect
(
page
).
to
have_text
(
"updated title"
)
end
end
describe
'"edited by" message'
,
js:
true
do
let
(
:issue
)
{
create
(
:issue
,
project:
project
,
author:
@user
)
}
context
'when issue is updated'
do
before
{
visit
edit_namespace_project_issue_path
(
project
.
namespace
,
project
,
issue
)
}
it
'shows "edited by" mesage on title update'
do
fill_in
'issue_title'
,
with:
'hello world'
click_button
'Save changes'
expect
(
page
).
to
have_content
(
"Edited less than a minute ago by
#{
@user
.
name
}
"
)
end
it
'shows "edited by" mesage on description update'
do
fill_in
'issue_description'
,
with:
'hello world'
click_button
'Save changes'
expect
(
page
).
to
have_content
(
"Edited less than a minute ago by
#{
@user
.
name
}
"
)
end
end
end
end
spec/services/notes/update_service_spec.rb
View file @
35160a97
...
...
@@ -20,6 +20,13 @@ describe Notes::UpdateService, services: true do
@note
.
reload
end
it
'updates last_edited_at and last_edited_by attributes'
do
update_note
({
note:
'Hello world!'
})
expect
(
@note
.
last_edited_at
).
not_to
be_nil
expect
(
@note
.
last_edited_by
).
not_to
be_nil
end
context
'todos'
do
let!
(
:todo
)
{
create
(
:todo
,
:assigned
,
user:
user
,
project:
project
,
target:
issue
,
author:
user2
)
}
...
...
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