From a7353a7b2aa6240df4afac8117dc5de58c7b2045 Mon Sep 17 00:00:00 2001 From: Andrew Cain Date: Thu, 6 Jun 2024 14:23:50 +1000 Subject: [PATCH] chore: minor fixes to tests and schema post merge --- app/models/role.rb | 4 ++++ db/schema.rb | 2 +- test/api/projects_api_test.rb | 12 ++++++------ test/models/task_test.rb | 2 +- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/app/models/role.rb b/app/models/role.rb index d7ef0bd37..3010e9c0d 100644 --- a/app/models/role.rb +++ b/app/models/role.rb @@ -8,6 +8,10 @@ def self.find(id) end end + def self.teaching_staff_ids + [self.tutor_id, self.convenor_id, self.admin_id, self.auditor_id] + end + def self.student Role.find(student_id) end diff --git a/db/schema.rb b/db/schema.rb index 6672e53cc..6daa71ebf 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.0].define(version: 2024_05_28_223908) do +ActiveRecord::Schema[7.1].define(version: 2024_05_28_223908) do create_table "activity_types", charset: "utf8", collation: "utf8_unicode_ci", force: :cascade do |t| t.string "name", null: false t.string "abbreviation", null: false diff --git a/test/api/projects_api_test.rb b/test/api/projects_api_test.rb index fda4b41b4..6d4ab3087 100644 --- a/test/api/projects_api_test.rb +++ b/test/api/projects_api_test.rb @@ -164,9 +164,9 @@ def test_download_portfolio get "/api/submission/project/#{project.id}/portfolio", data_to_put assert_equal 200, last_response.status - assert last_response.header['Content-Disposition'].starts_with?('attachment; filename=') - assert last_response.header['Access-Control-Expose-Headers'] == 'Content-Disposition' - assert last_response.header['Content-Type'] == 'application/pdf' + assert last_response.headers['Content-Disposition'].starts_with?('attachment; filename=') + assert last_response.headers['Access-Control-Expose-Headers'] == 'Content-Disposition' + assert last_response.headers['Content-Type'] == 'application/pdf' assert 10_485_760, last_response.length `fallocate -l 11M #{project.portfolio_path}` @@ -184,9 +184,9 @@ def test_download_portfolio get "/api/submission/project/#{project.id}/portfolio", data_to_put assert 500, last_response.length assert_equal 206, last_response.status - assert_nil last_response.header['Content-Disposition'] - assert_nil last_response.header['Access-Control-Expose-Headers'] - assert last_response.header['Content-Type'] == 'application/pdf' + assert_nil last_response.headers['Content-Disposition'] + assert_nil last_response.headers['Access-Control-Expose-Headers'] + assert last_response.headers['Content-Type'] == 'application/pdf' unit.destroy! ensure diff --git a/test/models/task_test.rb b/test/models/task_test.rb index 779de4497..d88a28ee6 100644 --- a/test/models/task_test.rb +++ b/test/models/task_test.rb @@ -360,7 +360,7 @@ def test_ipynb_to_pdf # Test if latex math was rendered properly reader = PDF::Reader.new(task.final_pdf_path) - assert reader.pages.last.text.include? "BMI: bmi = weigh2\n height" + assert reader.pages.last.text.include?("weight\n") # ensure the notice is not included when the notebook doesn't have long lines source code cells # and no errors