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
02924de3
Commit
02924de3
authored
May 20, 2012
by
Robb Kidd
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add method to Note to create notes about status changes.
parent
00ec81ea
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
0 deletions
+27
-0
app/models/note.rb
app/models/note.rb
+8
-0
spec/models/note_spec.rb
spec/models/note_spec.rb
+19
-0
No files found.
app/models/note.rb
View file @
02924de3
...
...
@@ -42,6 +42,14 @@ class Note < ActiveRecord::Base
mount_uploader
:attachment
,
AttachmentUploader
def
self
.
create_status_change_note
(
noteable
,
author
,
status
)
create
({
:noteable
=>
noteable
,
:project
=>
noteable
.
project
,
:author
=>
author
,
:note
=>
"_Status changed to
#{
status
}
_"
},
:without_protection
=>
true
)
end
def
notify
@notify
||=
false
end
...
...
spec/models/note_spec.rb
View file @
02924de3
...
...
@@ -70,6 +70,25 @@ describe Note do
end
end
describe
'#create_status_change_note'
do
let
(
:project
)
{
Factory
.
create
(
:project
)
}
let
(
:thing
)
{
Factory
.
create
(
:issue
,
:project
=>
project
)
}
let
(
:author
)
{
Factory
(
:user
)
}
let
(
:status
)
{
'new_status'
}
subject
{
Note
.
create_status_change_note
(
thing
,
author
,
status
)
}
it
'creates and saves a Note'
do
should
be_a
Note
subject
.
id
.
should_not
be_nil
end
its
(
:noteable
)
{
should
==
thing
}
its
(
:project
)
{
should
==
thing
.
project
}
its
(
:author
)
{
should
==
author
}
its
(
:note
)
{
should
=~
/Status changed to
#{
status
}
/
}
end
describe
:authorization
do
before
do
@p1
=
project
...
...
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