diff --git a/spec/controllers/tasks_controller_spec.rb b/spec/controllers/tasks_controller_spec.rb index dc06369a17..f9a6235a12 100644 --- a/spec/controllers/tasks_controller_spec.rb +++ b/spec/controllers/tasks_controller_spec.rb @@ -1668,16 +1668,33 @@ end end - describe "PATH tasks/:id/modal/upload_transcription_vbms" do + describe "PATH tasks/:id/modal/error_found_upload_transcription_to_vbms" do + let(:file_type) { "pdf" } + let(:hearing) { create(:hearing) } + let(:docket_number) { hearing.docket_number } + let(:appeal_id) { hearing.appeal.uuid } + let(:file_name) { "#{docket_number}_#{hearing.id}_#{hearing.class}.#{file_type}" } + let(:tmp_location) { File.join(Rails.root, "tmp", "transcription_files", file_type, file_name) } + let!(:create_transcription_task) do + Hearings::TranscriptionFile.create!( + hearing_id: hearing.id, + hearing_type: "Hearing", + file_name: file_name, + file_type: file_type.to_s, + docket_number: hearing.docket_number, + file_status: "Successful upload (AWS)", + date_upload_aws: Time.zone.today, + aws_link: "vaec-appeals-caseflow-test/transcript_pdf/#{file_name}" + ) + end + let(:transcription_file) { Hearings::TranscriptionFile.find_by(file_name: file_name) } let(:user) { create(:default_user) } - let!(:veteran) { create(:veteran) } - let!(:appeal) { create(:appeal, veteran: veteran) } - let(:root_task) { create(:root_task, appeal: appeal) } + let(:root_task) { create(:root_task, appeal: hearing.appeal) } let(:distribution_task) { create(:distribution_task, parent: root_task) } let(:parent_hearing_task) { create(:hearing_task, parent: distribution_task) } let!(:review_transcript_task) do ReviewTranscriptTask.create!( - appeal: appeal, + appeal: hearing.appeal, parent: root_task, assigned_to: user ) @@ -1688,7 +1705,11 @@ task: { instructions: "testing" }, - id: review_transcript_task.id.to_s + id: review_transcript_task.id.to_s, + file_info: { + file: "dGhpcyBpcyBhIHRlc3QgZmlsZQ==", + file_name: file_name + } } end @@ -1696,15 +1717,11 @@ review_transcript_task.update!(status: Constants.TASK_STATUSES.in_progress) end - subject { patch :upload_transcription_to_vbms, params: params } + subject { patch :error_found_upload_transcription_to_vbms, params: params } - it "updates status to completed" do + it "updates status for ReviewTranscriptTask to completed" do subject expect(response.status).to eq 200 - response_body = JSON.parse(response.body)["tasks"] - expect(response_body.last["attributes"]["status"]).to eq Constants.TASK_STATUSES.completed - expect(response_body.last["attributes"]["instructions"][0]).to eq(COPY::REVIEW_TRANSCRIPT_TASK_DEFAULT_INSTRUCTIONS) - expect(response_body.last["attributes"]["closed_at"]).to_not be nil end end end