diff options
Diffstat (limited to 'spec/support/shared_examples/requests/api/time_tracking_shared_examples.rb')
-rw-r--r-- | spec/support/shared_examples/requests/api/time_tracking_shared_examples.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/support/shared_examples/requests/api/time_tracking_shared_examples.rb b/spec/support/shared_examples/requests/api/time_tracking_shared_examples.rb index fb6d6603beb..afc902dd184 100644 --- a/spec/support/shared_examples/requests/api/time_tracking_shared_examples.rb +++ b/spec/support/shared_examples/requests/api/time_tracking_shared_examples.rb @@ -125,6 +125,22 @@ RSpec.shared_examples 'time tracking endpoints' do |issuable_name| expect(json_response['message']['base'].first).to eq(_('Time to subtract exceeds the total time spent')) end end + + if issuable_name == 'merge_request' + it 'calls update service with :use_specialized_service param' do + expect(::MergeRequests::UpdateService).to receive(:new).with(project: project, current_user: user, params: hash_including(use_specialized_service: true)) + + post api("/projects/#{project.id}/#{issuable_collection_name}/#{issuable.iid}/add_spent_time", user), params: { duration: '2h' } + end + end + + if issuable_name == 'issue' + it 'calls update service without :use_specialized_service param' do + expect(::Issues::UpdateService).to receive(:new).with(project: project, current_user: user, params: hash_not_including(use_specialized_service: true)) + + post api("/projects/#{project.id}/#{issuable_collection_name}/#{issuable.iid}/add_spent_time", user), params: { duration: '2h' } + end + end end describe "POST /projects/:id/#{issuable_collection_name}/:#{issuable_name}_id/reset_spent_time" do |