Commit b40941db authored by Sean McGivern's avatar Sean McGivern

Fix note resolution specs

parent 007b325d
...@@ -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
...@@ -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
......
...@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment