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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
2416e3cb
Commit
2416e3cb
authored
May 20, 2012
by
Robb Kidd
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add new utility method for an issue to know whether it is being reassigned
parent
f6035552
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
5 deletions
+25
-5
app/models/issue.rb
app/models/issue.rb
+10
-1
spec/models/issue_spec.rb
spec/models/issue_spec.rb
+15
-4
No files found.
app/models/issue.rb
View file @
2416e3cb
...
...
@@ -27,7 +27,7 @@ class Issue < ActiveRecord::Base
validates
:title
,
:presence
=>
true
,
:length
=>
{
:within
=>
0
..
255
}
validates
:description
,
:length
=>
{
:within
=>
0
..
2000
}
...
...
@@ -55,6 +55,15 @@ class Issue < ActiveRecord::Base
def
new?
today?
&&
created_at
==
updated_at
end
# Return the number of +1 comments (upvotes)
def
upvotes
notes
.
select
(
&
:upvote?
).
size
end
def
is_being_reassigned?
assignee_id_changed?
end
end
# == Schema Information
#
...
...
spec/models/issue_spec.rb
View file @
2416e3cb
...
...
@@ -20,10 +20,21 @@ describe Issue do
it
{
Issue
.
should
respond_to
:opened
}
end
it
{
Factory
.
create
(
:issue
,
:author
=>
Factory
(
:user
),
:assignee
=>
Factory
(
:user
),
:project
=>
Factory
.
create
(
:project
)).
should
be_valid
}
subject
{
Factory
.
create
(
:issue
,
:author
=>
Factory
(
:user
),
:assignee
=>
Factory
(
:user
),
:project
=>
Factory
.
create
(
:project
))
}
it
{
should
be_valid
}
describe
'#is_being_reassigned?'
do
it
'returns true if the issue assignee has changed'
do
subject
.
assignee
=
Factory
(
:user
)
subject
.
is_being_reassigned?
.
should
be_true
end
it
'returns false if the issue assignee has not changed'
do
subject
.
is_being_reassigned?
.
should
be_false
end
end
describe
"plus 1"
do
let
(
:project
)
{
Factory
(
: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