diff --git a/app/workflows/bulk_task_assignment.rb b/app/workflows/bulk_task_assignment.rb index 825ce744621..c150570847d 100644 --- a/app/workflows/bulk_task_assignment.rb +++ b/app/workflows/bulk_task_assignment.rb @@ -31,6 +31,7 @@ def process Task.create!( type: task_type, appeal: task.appeal, + instructions: task.instructions, assigned_by: assigned_by, parent: task, assigned_to: assigned_to diff --git a/spec/workflows/bulk_task_assignment_spec.rb b/spec/workflows/bulk_task_assignment_spec.rb index b6a7cc8aa47..0951f151109 100644 --- a/spec/workflows/bulk_task_assignment_spec.rb +++ b/spec/workflows/bulk_task_assignment_spec.rb @@ -139,6 +139,39 @@ def create_no_show_hearing_task_for_appeal(appeal) create(:no_show_hearing_task, appeal: appeal, assigned_to: organization) end + context "when task has instructions" do + subject { BulkTaskAssignment.new(params).process } + + let(:instructions1) { ["live long"] } + let(:instructions2) { ["prosper"] } + + before do + no_show_hearing_task1.update(instructions: instructions1) + no_show_hearing_task2.update(instructions: instructions2) + end + + it "copies instructions to assigned task" do + count_before = Task.count + subject + expect(Task.count).to eq count_before + 2 + expect(subject.count).to eq 2 + + user_task_1 = subject.find { |task| task.appeal == no_show_hearing_task1.appeal } + expect(user_task_1.assigned_to).to eq assigned_to + expect(user_task_1.type).to eq "NoShowHearingTask" + expect(user_task_1.assigned_by).to eq assigned_by + expect(user_task_1.parent_id).to eq no_show_hearing_task1.id + expect(user_task_1.instructions).to eq no_show_hearing_task1.instructions + + user_task_2 = subject.find { |task| task.appeal == no_show_hearing_task2.appeal } + expect(user_task_2.assigned_to).to eq assigned_to + expect(user_task_2.type).to eq "NoShowHearingTask" + expect(user_task_2.assigned_by).to eq assigned_by + expect(user_task_2.parent_id).to eq no_show_hearing_task2.id + expect(user_task_2.instructions).to eq no_show_hearing_task2.instructions + end + end + context "when there are priority appeals" do let(:regional_office) { nil } let(:task_count) { 20 }