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
3a7c2941
Commit
3a7c2941
authored
Sep 24, 2018
by
Jarka Košanová
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add specs for closing and reopening issue
parent
983bd38f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
6 deletions
+23
-6
spec/models/issue_spec.rb
spec/models/issue_spec.rb
+23
-6
No files found.
spec/models/issue_spec.rb
View file @
3a7c2941
...
...
@@ -84,15 +84,32 @@ describe Issue do
end
end
describe
'#closed_at'
do
it
'sets closed_at to Time.now when issue is closed'
do
issue
=
create
(
:issue
,
state:
'opened'
)
describe
'#close'
do
subject
(
:issue
)
{
create
(
:issue
,
state:
'opened'
)
}
expect
(
issue
.
closed_at
).
to
be_nil
it
'sets closed_at to Time.now when an issue is closed'
do
expect
{
issue
.
close
}.
to
change
{
issue
.
closed_at
}.
from
(
nil
)
end
issue
.
close
it
'changes the state to closed'
do
expect
{
issue
.
close
}.
to
change
{
issue
.
state
}.
from
(
'opened'
).
to
(
'closed'
)
end
end
describe
'#reopen'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:issue
)
{
create
(
:issue
,
state:
'closed'
,
closed_at:
Time
.
now
,
closed_by:
user
)
}
it
'sets closed_at to nil when an issue is reopend'
do
expect
{
issue
.
reopen
}.
to
change
{
issue
.
closed_at
}.
to
(
nil
)
end
it
'sets closed_by to nil when an issue is reopend'
do
expect
{
issue
.
reopen
}.
to
change
{
issue
.
closed_by
}.
from
(
user
).
to
(
nil
)
end
expect
(
issue
.
closed_at
).
to
be_present
it
'changes the state to opened'
do
expect
{
issue
.
reopen
}.
to
change
{
issue
.
state
}.
from
(
'closed'
).
to
(
'opened'
)
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