1320: add example tests for file overwriting #4899
Annotations
5 errors and 4 warnings
Run tests:
spec/services/proforma_service/convert_proforma_task_to_task_spec.rb#L683
ProformaService::ConvertProformaTaskToTask#execute when proforma_task has been exported from task when files have been move around imports everything correctly
Failure/Error:
expect(convert_to_task_service).to have_attributes(
id: task.id,
files: have(1).item.and(include(have_attributes(
id: test_files.first.id
))),
model_solutions: have(1).item.and(include(have_attributes(
id: model_solutions.first.id,
files: have(1).item.and(include(have_attributes(id: task_files.first.id)))
))),
tests: have(1).item.and(include(have_attributes(
expected #<Task id: 485, title: "title", description: "description", internal_description: nil, uuid: "236e243...rivate", submission_restrictions: nil, external_resources: nil, grading_hints: nil, state_list: nil> to have attributes {:files => (have 1 item and include (have attributes {:id => 216})), :id => 485, :model_solutions => (have ...attributes {:files => (have 1 item and include (have attributes {:id => 215})), :id => 987654325}))} but had attributes {:files => [#<TaskFile id: 216, content: "content", path: "", name: "name", internal_description: "orig...nil, task_id: 485, meta_data: nil, testing_framework_id: nil, configuration: nil, parent_id: nil>]>}
Diff:
@@ -1,5 +1,5 @@
-:files => (have 1 item and include (have attributes {:id => 216})),
+:files => [#<TaskFile id: 216, content: "content", path: "", name: "name", internal_description: "original test file", mime_type: nil, used_by_grader: true, visible: "yes", usage_by_lms: "display", fileable_type: "Task", fileable_id: 485, created_at: "2024-10-02 22:07:04.185524000 +0000", updated_at: "2024-10-02 22:07:04.185524000 +0000", xml_id: "229", parent_id: nil>],
:id => 485,
-:model_solutions => (have 1 item and include (have attributes {:files => (have 1 item and include (have attributes {:id => 217})), :id => 63})),
-:tests => (have 1 item and include (have attributes {:files => (have 1 item and include (have attributes {:id => 215})), :id => 987654325})),
+:model_solutions => #<ActiveRecord::Associations::CollectionProxy [#<ModelSolution id: 63, description: nil, internal_description: nil, xml_id: "ms_55", task_id: 485, created_at: "2024-10-02 22:07:04.173958000 +0000", updated_at: "2024-10-02 22:07:04.173958000 +0000", parent_id: nil>]>,
+:tests => #<ActiveRecord::Associations::CollectionProxy [#<Test id: 70, created_at: "2024-10-02 22:07:04.246159000 +0000", updated_at: "2024-10-02 22:07:04.246159000 +0000", title: "replacement Test", description: nil, internal_description: nil, test_type: nil, xml_id: "987654325", validity: nil, timeout: nil, task_id: 485, meta_data: nil, testing_framework_id: nil, configuration: nil, parent_id: nil>]>,
|
Run tests:
spec/services/proforma_service/convert_proforma_task_to_task_spec.rb#L727
ProformaService::ConvertProformaTaskToTask#execute when proforma_task has been exported from task when files have been move around when imported task is persisted imports everything correctly
Failure/Error:
expect(task).to have_attributes(
id: task.id,
files: have(1).item.and(include(have_attributes(
id: test_files.first.id
))),
model_solutions: have(1).item.and(include(have_attributes(
id: model_solutions.first.id,
files: have(1).item.and(include(have_attributes(id: task_files.first.id)))
))),
tests: have(1).item.and(include(have_attributes(
expected #<Task id: 489, title: "title", description: "description", internal_description: nil, uuid: "379ef41...rivate", submission_restrictions: nil, external_resources: nil, grading_hints: nil, state_list: nil> to have attributes {:files => (have 1 item and include (have attributes {:id => 228})), :id => 489, :model_solutions => (have ...attributes {:files => (have 1 item and include (have attributes {:id => 227})), :id => 987654325}))} but had attributes {:files => #<ActiveRecord::Associations::CollectionProxy []>, :id => 489, :model_solutions => #<ActiveRecor...nil, task_id: 489, meta_data: nil, testing_framework_id: nil, configuration: nil, parent_id: nil>]>}
Diff:
@@ -1,5 +1,5 @@
-:files => (have 1 item and include (have attributes {:id => 228})),
+:files => #<ActiveRecord::Associations::CollectionProxy []>,
:id => 489,
-:model_solutions => (have 1 item and include (have attributes {:files => (have 1 item and include (have attributes {:id => 229})), :id => 67})),
-:tests => (have 1 item and include (have attributes {:files => (have 1 item and include (have attributes {:id => 227})), :id => 987654325})),
+:model_solutions => #<ActiveRecord::Associations::CollectionProxy [#<ModelSolution id: 67, description: nil, internal_description: nil, xml_id: "ms_59", task_id: 489, created_at: "2024-10-02 22:07:05.735514000 +0000", updated_at: "2024-10-02 22:07:05.735514000 +0000", parent_id: nil>]>,
+:tests => #<ActiveRecord::Associations::CollectionProxy [#<Test id: 78, created_at: "2024-10-02 22:07:05.807409000 +0000", updated_at: "2024-10-02 22:07:05.807409000 +0000", title: "replacement Test", description: nil, internal_description: nil, test_type: nil, xml_id: "987654325", validity: nil, timeout: nil, task_id: 489, meta_data: nil, testing_framework_id: nil, configuration: nil, parent_id: nil>]>,
|
Run tests:
spec/services/proforma_service/convert_proforma_task_to_task_spec.rb#L706
ProformaService::ConvertProformaTaskToTask#execute when proforma_task has been exported from task when files have been move around when imported task is persisted imports taskfiles correctly
Failure/Error:
expect(task.files.first).to have_attributes(
id: test_files.first.id,
internal_description: test_files.first.internal_description
)
expected nil to respond to :id, :internal_description with 0 arguments
|
Run tests:
spec/services/proforma_service/convert_proforma_task_to_task_spec.rb#L239
ProformaService::ConvertProformaTaskToTask#execute when proforma_task has a file when file is used by multiple tests creates files with correct attributes
Failure/Error: expect(convert_to_task_service.tests[1].files[0]).to have_attributes(convert_to_task_service.tests[0].files[0].attributes.merge('xml_id' => 'id-2'))
expected #<TaskFile id: nil, content: "very generic content", path: "", name: "multi_referenced_file.txt", int...le_type: "Test", fileable_id: nil, created_at: nil, updated_at: nil, xml_id: "id-3", parent_id: nil> to have attributes {"content" => "very generic content", "created_at" => nil, "fileable_id" => nil, "fileable_type" => "Test", "...ed_at" => nil, "usage_by_lms" => "display", "used_by_grader" => false, "visible" => "yes", "xml_id" => "id-2"} but had attributes {"content" => "very generic content", "created_at" => nil, "fileable_id" => nil, "fileable_type" => "Test", "...ed_at" => nil, "usage_by_lms" => "display", "used_by_grader" => false, "visible" => "yes", "xml_id" => "id-3"}
Diff:
@@ -12,5 +12,5 @@
"usage_by_lms" => "display",
"used_by_grader" => false,
"visible" => "yes",
-"xml_id" => "id-2",
+"xml_id" => "id-3",
|
Run tests
Process completed with exit code 1.
|
Run tests:
spec/services/proforma_service/import_task_spec.rb#L56
ProformaService::ImportTask#execute when task with same uuid exists in db creates a predecessor for task
Failure/Error: expect { import_proforma_task }.to change { task.reload.predecessor }.from(nil).to(be_an(Task))
NoMethodError:
undefined method `predecessor' for an instance of Task
|
Run tests:
spec/services/proforma_service/import_task_spec.rb#L82
ProformaService::ImportTask#execute when task with same uuid exists in db when user does not own task when user is an author of task creates a predecessor for task
Failure/Error: before { task.authors << user }
NoMethodError:
undefined method `authors' for an instance of Task
|
Run tests:
spec/services/proforma_service/import_task_spec.rb#L78
ProformaService::ImportTask#execute when task with same uuid exists in db when user does not own task when user is an author of task changes existing task
Failure/Error: before { task.authors << user }
NoMethodError:
undefined method `authors' for an instance of Task
|
Run tests:
spec/services/proforma_service/import_task_spec.rb#L74
ProformaService::ImportTask#execute when task with same uuid exists in db when user does not own task when user is an author of task creates a new task
Failure/Error: before { task.authors << user }
NoMethodError:
undefined method `authors' for an instance of Task
|
Loading