Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-10-27 13:15:59 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-10-27 13:16:27 +0300
commiteff560cfb9a337623d25b912d9bb233fae25fbf1 (patch)
treedd96ba1b42ddc1cdc588c0ff4096a4d47d0b5e0d /spec/models
parent14b92217e768aa4f3ce2d8b30f2c2acbdfdd8f6a (diff)
Add latest changes from gitlab-org/security/gitlab@14-4-stable-ee
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/concerns/resolvable_discussion_spec.rb20
1 files changed, 18 insertions, 2 deletions
diff --git a/spec/models/concerns/resolvable_discussion_spec.rb b/spec/models/concerns/resolvable_discussion_spec.rb
index c0e5ddc23b1..fc154738f11 100644
--- a/spec/models/concerns/resolvable_discussion_spec.rb
+++ b/spec/models/concerns/resolvable_discussion_spec.rb
@@ -188,6 +188,16 @@ RSpec.describe Discussion, ResolvableDiscussion do
it "returns true" do
expect(subject.can_resolve?(current_user)).to be true
end
+
+ context 'when noteable is locked' do
+ before do
+ allow(subject.noteable).to receive(:discussion_locked?).and_return(true)
+ end
+
+ it 'returns false' do
+ expect(subject.can_resolve?(current_user)).to be_falsey
+ end
+ end
end
context "when the signed in user can push to the project" do
@@ -200,8 +210,11 @@ RSpec.describe Discussion, ResolvableDiscussion do
end
context "when the noteable has no author" do
+ before do
+ subject.noteable.author = nil
+ end
+
it "returns true" do
- expect(noteable).to receive(:author).and_return(nil)
expect(subject.can_resolve?(current_user)).to be true
end
end
@@ -213,8 +226,11 @@ RSpec.describe Discussion, ResolvableDiscussion do
end
context "when the noteable has no author" do
+ before do
+ subject.noteable.author = nil
+ end
+
it "returns false" do
- expect(noteable).to receive(:author).and_return(nil)
expect(subject.can_resolve?(current_user)).to be false
end
end