Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jorg-vr committed Nov 13, 2024
1 parent 52025b1 commit 1f11ba3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion app/policies/annotation_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ def resolve
scope.all
elsif user
common = scope.joins(:submission)
common.released.where(submission: { user: user }).or(common.where(submission: { course_id: user.administrating_courses.map(&:id) }))
common.released.where(submissions: { user: user }).or(common.where(submissions: { course_id: user.administrating_courses.map(&:id) }))
else
scope.none
end
Expand Down
12 changes: 6 additions & 6 deletions test/models/saved_annotation_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ class SavedAnnotationTest < ActiveSupport::TestCase
s2 = create :saved_annotation, course: course, user: user
s3 = create :saved_annotation, course: create(:course), user: user

assert_includes SavedAnnotation.by_course(course), s1
assert_includes SavedAnnotation.by_course(course), s2
assert_not_includes SavedAnnotation.by_course(course), s3
assert_includes SavedAnnotation.by_course_id(course.id), s1
assert_includes SavedAnnotation.by_course_id(course.id), s2
assert_not_includes SavedAnnotation.by_course_id(course.id), s3
end

test 'filtering by exercise_id should contain nil values' do
Expand All @@ -38,8 +38,8 @@ class SavedAnnotationTest < ActiveSupport::TestCase
s2 = create :saved_annotation, exercise: exercise, user: user
s3 = create :saved_annotation, exercise: create(:exercise), user: user

assert_includes SavedAnnotation.by_exercise(exercise), s1
assert_includes SavedAnnotation.by_exercise(exercise), s2
assert_not_includes SavedAnnotation.by_exercise(exercise), s3
assert_includes SavedAnnotation.by_exercise_id(exercise.id), s1
assert_includes SavedAnnotation.by_exercise_id(exercise.id), s2
assert_not_includes SavedAnnotation.by_exercise_id(exercise.id), s3
end
end

0 comments on commit 1f11ba3

Please sign in to comment.