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
f9729659
Commit
f9729659
authored
Feb 18, 2013
by
Andrew8xx8
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issuable consern uses StateMachine now
parent
8db3920c
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
2 additions
and
74 deletions
+2
-74
app/models/concerns/issuable.rb
app/models/concerns/issuable.rb
+2
-11
spec/models/concerns/issuable_spec.rb
spec/models/concerns/issuable_spec.rb
+0
-1
spec/models/issue_spec.rb
spec/models/issue_spec.rb
+0
-31
spec/models/merge_request_spec.rb
spec/models/merge_request_spec.rb
+0
-31
No files found.
app/models/concerns/issuable.rb
View file @
f9729659
...
@@ -17,10 +17,9 @@ module Issuable
...
@@ -17,10 +17,9 @@ module Issuable
validates
:project
,
presence:
true
validates
:project
,
presence:
true
validates
:author
,
presence:
true
validates
:author
,
presence:
true
validates
:title
,
presence:
true
,
length:
{
within:
0
..
255
}
validates
:title
,
presence:
true
,
length:
{
within:
0
..
255
}
validates
:closed
,
inclusion:
{
in:
[
true
,
false
]
}
scope
:opened
,
->
{
w
here
(
closed:
false
)
}
scope
:opened
,
->
{
w
ith_state
(
:opened
)
}
scope
:closed
,
->
{
w
here
(
closed:
true
)
}
scope
:closed
,
->
{
w
ith_state
(
:closed
)
}
scope
:of_group
,
->
(
group
)
{
where
(
project_id:
group
.
project_ids
)
}
scope
:of_group
,
->
(
group
)
{
where
(
project_id:
group
.
project_ids
)
}
scope
:of_user_team
,
->
(
team
)
{
where
(
project_id:
team
.
project_ids
,
assignee_id:
team
.
member_ids
)
}
scope
:of_user_team
,
->
(
team
)
{
where
(
project_id:
team
.
project_ids
,
assignee_id:
team
.
member_ids
)
}
scope
:assigned
,
->
(
u
)
{
where
(
assignee_id:
u
.
id
)}
scope
:assigned
,
->
(
u
)
{
where
(
assignee_id:
u
.
id
)}
...
@@ -62,14 +61,6 @@ module Issuable
...
@@ -62,14 +61,6 @@ module Issuable
assignee_id_changed?
assignee_id_changed?
end
end
def
is_being_closed?
closed_changed?
&&
closed
end
def
is_being_reopened?
closed_changed?
&&
!
closed
end
#
#
# Votes
# Votes
#
#
...
...
spec/models/concerns/issuable_spec.rb
View file @
f9729659
...
@@ -15,7 +15,6 @@ describe Issue, "Issuable" do
...
@@ -15,7 +15,6 @@ describe Issue, "Issuable" do
it
{
should
validate_presence_of
(
:author
)
}
it
{
should
validate_presence_of
(
:author
)
}
it
{
should
validate_presence_of
(
:title
)
}
it
{
should
validate_presence_of
(
:title
)
}
it
{
should
ensure_length_of
(
:title
).
is_at_least
(
0
).
is_at_most
(
255
)
}
it
{
should
ensure_length_of
(
:title
).
is_at_least
(
0
).
is_at_most
(
255
)
}
it
{
should
ensure_inclusion_of
(
:closed
).
in_array
([
true
,
false
])
}
end
end
describe
"Scope"
do
describe
"Scope"
do
...
...
spec/models/issue_spec.rb
View file @
f9729659
...
@@ -43,35 +43,4 @@ describe Issue do
...
@@ -43,35 +43,4 @@ describe Issue do
subject
.
is_being_reassigned?
.
should
be_false
subject
.
is_being_reassigned?
.
should
be_false
end
end
end
end
describe
'#is_being_closed?'
do
it
'returns true if the closed attribute has changed and is now true'
do
subject
.
closed
=
true
subject
.
is_being_closed?
.
should
be_true
end
it
'returns false if the closed attribute has changed and is now false'
do
issue
=
create
(
:closed_issue
)
issue
.
closed
=
false
issue
.
is_being_closed?
.
should
be_false
end
it
'returns false if the closed attribute has not changed'
do
subject
.
is_being_closed?
.
should
be_false
end
end
describe
'#is_being_reopened?'
do
it
'returns true if the closed attribute has changed and is now false'
do
issue
=
create
(
:closed_issue
)
issue
.
closed
=
false
issue
.
is_being_reopened?
.
should
be_true
end
it
'returns false if the closed attribute has changed and is now true'
do
subject
.
closed
=
true
subject
.
is_being_reopened?
.
should
be_false
end
it
'returns false if the closed attribute has not changed'
do
subject
.
is_being_reopened?
.
should
be_false
end
end
end
end
spec/models/merge_request_spec.rb
View file @
f9729659
...
@@ -62,35 +62,4 @@ describe MergeRequest do
...
@@ -62,35 +62,4 @@ describe MergeRequest do
subject
.
is_being_reassigned?
.
should
be_false
subject
.
is_being_reassigned?
.
should
be_false
end
end
end
end
describe
'#is_being_closed?'
do
it
'returns true if the closed attribute has changed and is now true'
do
subject
.
closed
=
true
subject
.
is_being_closed?
.
should
be_true
end
it
'returns false if the closed attribute has changed and is now false'
do
merge_request
=
create
(
:closed_merge_request
)
merge_request
.
closed
=
false
merge_request
.
is_being_closed?
.
should
be_false
end
it
'returns false if the closed attribute has not changed'
do
subject
.
is_being_closed?
.
should
be_false
end
end
describe
'#is_being_reopened?'
do
it
'returns true if the closed attribute has changed and is now false'
do
merge_request
=
create
(
:closed_merge_request
)
merge_request
.
closed
=
false
merge_request
.
is_being_reopened?
.
should
be_true
end
it
'returns false if the closed attribute has changed and is now true'
do
subject
.
closed
=
true
subject
.
is_being_reopened?
.
should
be_false
end
it
'returns false if the closed attribute has not changed'
do
subject
.
is_being_reopened?
.
should
be_false
end
end
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