Skip to content

Commit

Permalink
Fixed grouping tests
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielDervishi committed Jul 18, 2023
1 parent 55b3acd commit c5280c8
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions spec/models/grouping_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1534,8 +1534,8 @@ def expect_updated_criteria_coverage_count_eq(expected_count)
describe '#get_next_group as instructor' do
let(:role) { create :instructor }
let(:assignment) { create :assignment }
let!(:grouping1) { create :grouping, assignment: assignment, is_collected: true }
let!(:grouping2) { create :grouping, assignment: assignment, is_collected: true }
let!(:grouping1) { create :grouping_with_inviter_and_submission, assignment: assignment }
let!(:grouping2) { create :grouping_with_inviter_and_submission, assignment: assignment }
it 'should let one navigate right if there is a result directly to the right' do
groupings = assignment.groupings.joins(:group).order('group_name')
new_grouping = groupings.first.get_next_grouping(role, false)
Expand All @@ -1558,7 +1558,7 @@ def expect_updated_criteria_coverage_count_eq(expected_count)
end
describe 'with collected results separated by an uncollected results' do
let!(:grouping2) { create :grouping, assignment: assignment, is_collected: false }
let!(:grouping3) { create :grouping, assignment: assignment, is_collected: true }
let!(:grouping3) { create :grouping_with_inviter_and_submission, assignment: assignment, is_collected: true }
it 'should let me navigate to the right if any result exists towards the right' do
groupings = assignment.groupings.joins(:group).order('group_name')
new_grouping = groupings.first.get_next_grouping(role, false)
Expand All @@ -1573,9 +1573,15 @@ def expect_updated_criteria_coverage_count_eq(expected_count)
end
describe '#get_next_group as ta' do
let(:assignment) { create :assignment }
let(:role) { create :ta, groupings: assignment.groupings }
let!(:grouping1) { create :grouping, assignment: assignment, is_collected: true }
let!(:grouping2) { create :grouping, assignment: assignment, is_collected: true }
let(:role) { create :ta }
let!(:grouping1) { create :grouping_with_inviter_and_submission, assignment: assignment }
let!(:grouping2) { create :grouping_with_inviter_and_submission, assignment: assignment }
let(:groupings) { [grouping1, grouping2] }
before(:each) do
2.times do |i|
create :ta_membership, role: role, grouping: groupings[i]
end
end
it 'should let one navigate right if there is a result directly to the right' do
groupings = assignment.groupings.joins(:group).order('group_name')
new_grouping = groupings.first.get_next_grouping(role, false)
Expand All @@ -1598,7 +1604,10 @@ def expect_updated_criteria_coverage_count_eq(expected_count)
end
describe 'with collected results separated by an uncollected results' do
let!(:grouping2) { create :grouping, assignment: assignment, is_collected: false }
let!(:grouping3) { create :grouping, assignment: assignment, is_collected: true }
let!(:grouping3) { create :grouping_with_inviter_and_submission, assignment: assignment }
before(:each) do
create :ta_membership, role: role, grouping: grouping3
end
it 'should let me navigate to the right if any result exists towards the right' do
groupings = assignment.groupings.joins(:group).order('group_name')
new_grouping = groupings.first.get_next_grouping(role, false)
Expand Down

0 comments on commit c5280c8

Please sign in to comment.