summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/email/handler/create_note_handler_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-06-18 11:18:50 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-06-18 11:18:50 +0000
commit8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781 (patch)
treea77e7fe7a93de11213032ed4ab1f33a3db51b738 /spec/lib/gitlab/email/handler/create_note_handler_spec.rb
parent00b35af3db1abfe813a778f643dad221aad51fca (diff)
downloadgitlab-ce-8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781.tar.gz
Add latest changes from gitlab-org/gitlab@13-1-stable-ee
Diffstat (limited to 'spec/lib/gitlab/email/handler/create_note_handler_spec.rb')
-rw-r--r--spec/lib/gitlab/email/handler/create_note_handler_spec.rb28
1 files changed, 18 insertions, 10 deletions
diff --git a/spec/lib/gitlab/email/handler/create_note_handler_spec.rb b/spec/lib/gitlab/email/handler/create_note_handler_spec.rb
index 909a7618df4..af963e1b695 100644
--- a/spec/lib/gitlab/email/handler/create_note_handler_spec.rb
+++ b/spec/lib/gitlab/email/handler/create_note_handler_spec.rb
@@ -65,16 +65,24 @@ describe Gitlab::Email::Handler::CreateNoteHandler do
end
end
- context 'and current user can update noteable' do
- before do
- project.add_developer(user)
- end
-
- it 'does not raise an error' do
- # One system note is created for the 'close' event
- expect { receiver.execute }.to change { noteable.notes.count }.by(1)
-
- expect(noteable.reload).to be_closed
+ [true, false].each do |state_tracking_enabled|
+ context "and current user can update noteable #{state_tracking_enabled ? 'enabled' : 'disabled'}" do
+ before do
+ stub_feature_flags(track_resource_state_change_events: state_tracking_enabled)
+
+ project.add_developer(user)
+ end
+
+ it 'does not raise an error' do
+ if state_tracking_enabled
+ expect { receiver.execute }.to change { noteable.resource_state_events.count }.by(1)
+ else
+ # One system note is created for the 'close' event
+ expect { receiver.execute }.to change { noteable.notes.count }.by(1)
+ end
+
+ expect(noteable.reload).to be_closed
+ end
end
end
end