summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-02-25 17:47:24 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-02-25 17:47:24 +0000
commitc27fa5c6ebd18b20d52dca62b1c4adcf22e31008 (patch)
treed43dcb31db3cdc5d98f0e8d2f9eedf087a2a9aa2 /spec
parent0e7f4716b1c534922ebab5a1f27c1442b59dc362 (diff)
downloadgitlab-ce-c27fa5c6ebd18b20d52dca62b1c4adcf22e31008.tar.gz
Add latest changes from gitlab-org/security/gitlab@14-6-stable-ee
Diffstat (limited to 'spec')
-rw-r--r--spec/models/note_spec.rb10
-rw-r--r--spec/requests/api/notes_spec.rb10
2 files changed, 14 insertions, 6 deletions
diff --git a/spec/models/note_spec.rb b/spec/models/note_spec.rb
index 9d9cca0678a..530732420e6 100644
--- a/spec/models/note_spec.rb
+++ b/spec/models/note_spec.rb
@@ -1624,4 +1624,14 @@ RSpec.describe Note do
end
end
end
+
+ describe '#commands_changes' do
+ let(:note) { build(:note) }
+
+ it 'only returns allowed keys' do
+ note.commands_changes = { emoji_award: {}, time_estimate: {}, spend_time: {}, target_project: build(:project) }
+
+ expect(note.commands_changes.keys).to contain_exactly(:emoji_award, :time_estimate, :spend_time)
+ end
+ end
end
diff --git a/spec/requests/api/notes_spec.rb b/spec/requests/api/notes_spec.rb
index d4f8b841c96..3c28aed6cac 100644
--- a/spec/requests/api/notes_spec.rb
+++ b/spec/requests/api/notes_spec.rb
@@ -233,11 +233,9 @@ RSpec.describe API::Notes do
subject { post api(request_path, user), params: { body: request_body } }
context 'a command only note' do
- let(:assignee) { create(:user) }
- let(:request_body) { "/assign #{assignee.to_reference}" }
+ let(:request_body) { "/spend 1h" }
before do
- project.add_developer(assignee)
project.add_developer(user)
end
@@ -256,7 +254,7 @@ RSpec.describe API::Notes do
end
it 'applies the commands' do
- expect { subject }.to change { merge_request.reset.assignees }
+ expect { subject }.to change { merge_request.reset.total_time_spent }
end
it 'reports the changes' do
@@ -264,9 +262,9 @@ RSpec.describe API::Notes do
expect(json_response).to include(
'commands_changes' => include(
- 'assignee_ids' => [Integer]
+ 'spend_time' => include('duration' => 3600)
),
- 'summary' => include("Assigned #{assignee.to_reference}.")
+ 'summary' => include('Added 1h spent time.')
)
end
end