Skip to content

Commit

Permalink
Add tests for Exercise#needs_more_feedback?
Browse files Browse the repository at this point in the history
  • Loading branch information
MrSerth committed Nov 22, 2023
1 parent f83fdbe commit 5def888
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions spec/models/exercise_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,26 @@ def create_submissions
end
end

describe '#needs_more_feedback?' do
let(:exercise) { create(:dummy) }

before { stub_const('Exercise::MAX_GROUP_EXERCISE_FEEDBACKS', 5) }

context 'when too few feedback was collected' do
it 'returns true' do
expect(exercise).to be_needs_more_feedback
end
end

context 'when enough feedback was collected' do
before { create_list(:user_exercise_feedback, Exercise::MAX_GROUP_EXERCISE_FEEDBACKS, exercise:) }

it 'returns false' do
expect(exercise).to be_needs_more_feedback
end
end
end

describe '#teacher_defined_assessment?' do
let(:exercise) { create(:dummy) }

Expand Down

0 comments on commit 5def888

Please sign in to comment.