Skip to content

Commit

Permalink
enhance: validate task sheet content in unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
ublefo committed Apr 27, 2024
1 parent ee70d19 commit c44b147
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/models/unit_model_test.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
require 'test_helper'
require 'grade_helper'
require './lib/helpers/database_populator'
require 'pdf-reader'

class UnitModelTest < ActiveSupport::TestCase
include TestHelpers::JsonHelper
Expand Down Expand Up @@ -97,6 +98,15 @@ def test_import_task_files
end

assert File.exist? @unit.task_definitions.first.task_resources

# extra checks to ensure the filename matching behavior is correct (longest match)
td = @unit.task_definitions.find_by(abbreviation: "T1")
reader = PDF::Reader.new(td.task_sheet)
assert reader.pages[0].text.include? "Task sheet for task T1!"

td = @unit.task_definitions.find_by(abbreviation: "T10")
reader = PDF::Reader.new(td.task_sheet)
assert reader.pages[0].text.include? "Task sheet for task T10!"
end

def test_rollover_of_task_files
Expand Down

0 comments on commit c44b147

Please sign in to comment.