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
Léo-Paul Géneau
gitlab-ce
Commits
b40941db
Commit
b40941db
authored
Sep 05, 2017
by
Sean McGivern
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix note resolution specs
parent
007b325d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
10 deletions
+16
-10
app/models/concerns/resolvable_note.rb
app/models/concerns/resolvable_note.rb
+6
-2
spec/lib/gitlab/import_export/safe_model_attributes.yml
spec/lib/gitlab/import_export/safe_model_attributes.yml
+2
-0
spec/models/concerns/resolvable_note_spec.rb
spec/models/concerns/resolvable_note_spec.rb
+8
-8
No files found.
app/models/concerns/resolvable_note.rb
View file @
b40941db
...
@@ -58,15 +58,19 @@ module ResolvableNote
...
@@ -58,15 +58,19 @@ module ResolvableNote
self
.
resolved_at
=
Time
.
now
self
.
resolved_at
=
Time
.
now
self
.
resolved_by
=
current_user
self
.
resolved_by
=
current_user
self
.
resolved_by_push
=
resolved_by_push
self
.
resolved_by_push
=
resolved_by_push
true
end
end
# If you update this method remember to also update `.unresolve!`
# If you update this method remember to also update `.unresolve!`
def
unresolve_without_save
(
current_user
)
def
unresolve_without_save
return
false
unless
resolvable?
return
false
unless
resolvable?
return
false
unless
resolved?
return
false
unless
resolved?
self
.
resolved_at
=
nil
self
.
resolved_at
=
nil
self
.
resolved_by
=
nil
self
.
resolved_by
=
nil
true
end
end
def
resolve!
(
current_user
,
resolved_by_push:
false
)
def
resolve!
(
current_user
,
resolved_by_push:
false
)
...
@@ -75,6 +79,6 @@ module ResolvableNote
...
@@ -75,6 +79,6 @@ module ResolvableNote
end
end
def
unresolve!
def
unresolve!
unresolve_without_save
(
current_user
)
&&
save
unresolve_without_save
&&
save!
end
end
end
end
spec/lib/gitlab/import_export/safe_model_attributes.yml
View file @
b40941db
...
@@ -65,6 +65,7 @@ Note:
...
@@ -65,6 +65,7 @@ Note:
-
change_position
-
change_position
-
resolved_at
-
resolved_at
-
resolved_by_id
-
resolved_by_id
-
resolved_by_push
-
discussion_id
-
discussion_id
-
original_discussion_id
-
original_discussion_id
LabelLink
:
LabelLink
:
...
@@ -407,6 +408,7 @@ Project:
...
@@ -407,6 +408,7 @@ Project:
-
only_allow_merge_if_all_discussions_are_resolved
-
only_allow_merge_if_all_discussions_are_resolved
-
auto_cancel_pending_pipelines
-
auto_cancel_pending_pipelines
-
printing_merge_request_link_enabled
-
printing_merge_request_link_enabled
-
resolve_outdated_diff_discussions
-
build_allow_git_fetch
-
build_allow_git_fetch
-
last_repository_updated_at
-
last_repository_updated_at
-
ci_config_path
-
ci_config_path
...
...
spec/models/concerns/resolvable_note_spec.rb
View file @
b40941db
...
@@ -189,8 +189,8 @@ describe Note, ResolvableNote do
...
@@ -189,8 +189,8 @@ describe Note, ResolvableNote do
allow
(
subject
).
to
receive
(
:resolvable?
).
and_return
(
false
)
allow
(
subject
).
to
receive
(
:resolvable?
).
and_return
(
false
)
end
end
it
"returns
nil
"
do
it
"returns
false
"
do
expect
(
subject
.
resolve!
(
current_user
)).
to
be_
nil
expect
(
subject
.
resolve!
(
current_user
)).
to
be_
falsey
end
end
it
"doesn't set resolved_at"
do
it
"doesn't set resolved_at"
do
...
@@ -224,8 +224,8 @@ describe Note, ResolvableNote do
...
@@ -224,8 +224,8 @@ describe Note, ResolvableNote do
subject
.
resolve!
(
user
)
subject
.
resolve!
(
user
)
end
end
it
"returns
nil
"
do
it
"returns
false
"
do
expect
(
subject
.
resolve!
(
current_user
)).
to
be_
nil
expect
(
subject
.
resolve!
(
current_user
)).
to
be_
falsey
end
end
it
"doesn't change resolved_at"
do
it
"doesn't change resolved_at"
do
...
@@ -279,8 +279,8 @@ describe Note, ResolvableNote do
...
@@ -279,8 +279,8 @@ describe Note, ResolvableNote do
allow
(
subject
).
to
receive
(
:resolvable?
).
and_return
(
false
)
allow
(
subject
).
to
receive
(
:resolvable?
).
and_return
(
false
)
end
end
it
"returns
nil
"
do
it
"returns
false
"
do
expect
(
subject
.
unresolve!
).
to
be_
nil
expect
(
subject
.
unresolve!
).
to
be_
falsey
end
end
end
end
...
@@ -320,8 +320,8 @@ describe Note, ResolvableNote do
...
@@ -320,8 +320,8 @@ describe Note, ResolvableNote do
end
end
context
"when not resolved"
do
context
"when not resolved"
do
it
"returns
nil
"
do
it
"returns
false
"
do
expect
(
subject
.
unresolve!
).
to
be_
nil
expect
(
subject
.
unresolve!
).
to
be_
falsey
end
end
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