Merge pull request #2864 from urbanrotnik/ur-sci-4993

Assign user to cloned experiment [SCI-4993]
This commit is contained in:
Urban Rotnik 2020-09-23 13:37:07 +02:00 committed by GitHub
commit 3de2aee921
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View file

@ -433,6 +433,8 @@ class MyModule < ApplicationRecord
clone.save!
clone.assign_user(current_user)
# Remove the automatically generated protocol,
# & clone the protocol instead
clone.protocol.destroy

View file

@ -189,12 +189,12 @@ describe Experiment, type: :model do
expect(Activities::CreateActivityService)
.to(receive(:call)
.with(hash_including(activity_type:
:assign_user_to_module))).exactly(3).times
:assign_user_to_module))).exactly(6).times
function_call
end
it 'creats 3 new activities in DB' do
expect { function_call }.to change { Activity.all.count }.by(6)
it 'creats 9 new activities in DB (6 for assigning user, 3 for cloning module)' do
expect { function_call }.to change { Activity.all.count }.by(9)
end
end