Skip to content

Commit c5280c8

Browse files
Fixed grouping tests
1 parent 55b3acd commit c5280c8

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

spec/models/grouping_spec.rb

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1534,8 +1534,8 @@ def expect_updated_criteria_coverage_count_eq(expected_count)
15341534
describe '#get_next_group as instructor' do
15351535
let(:role) { create :instructor }
15361536
let(:assignment) { create :assignment }
1537-
let!(:grouping1) { create :grouping, assignment: assignment, is_collected: true }
1538-
let!(:grouping2) { create :grouping, assignment: assignment, is_collected: true }
1537+
let!(:grouping1) { create :grouping_with_inviter_and_submission, assignment: assignment }
1538+
let!(:grouping2) { create :grouping_with_inviter_and_submission, assignment: assignment }
15391539
it 'should let one navigate right if there is a result directly to the right' do
15401540
groupings = assignment.groupings.joins(:group).order('group_name')
15411541
new_grouping = groupings.first.get_next_grouping(role, false)
@@ -1558,7 +1558,7 @@ def expect_updated_criteria_coverage_count_eq(expected_count)
15581558
end
15591559
describe 'with collected results separated by an uncollected results' do
15601560
let!(:grouping2) { create :grouping, assignment: assignment, is_collected: false }
1561-
let!(:grouping3) { create :grouping, assignment: assignment, is_collected: true }
1561+
let!(:grouping3) { create :grouping_with_inviter_and_submission, assignment: assignment, is_collected: true }
15621562
it 'should let me navigate to the right if any result exists towards the right' do
15631563
groupings = assignment.groupings.joins(:group).order('group_name')
15641564
new_grouping = groupings.first.get_next_grouping(role, false)
@@ -1573,9 +1573,15 @@ def expect_updated_criteria_coverage_count_eq(expected_count)
15731573
end
15741574
describe '#get_next_group as ta' do
15751575
let(:assignment) { create :assignment }
1576-
let(:role) { create :ta, groupings: assignment.groupings }
1577-
let!(:grouping1) { create :grouping, assignment: assignment, is_collected: true }
1578-
let!(:grouping2) { create :grouping, assignment: assignment, is_collected: true }
1576+
let(:role) { create :ta }
1577+
let!(:grouping1) { create :grouping_with_inviter_and_submission, assignment: assignment }
1578+
let!(:grouping2) { create :grouping_with_inviter_and_submission, assignment: assignment }
1579+
let(:groupings) { [grouping1, grouping2] }
1580+
before(:each) do
1581+
2.times do |i|
1582+
create :ta_membership, role: role, grouping: groupings[i]
1583+
end
1584+
end
15791585
it 'should let one navigate right if there is a result directly to the right' do
15801586
groupings = assignment.groupings.joins(:group).order('group_name')
15811587
new_grouping = groupings.first.get_next_grouping(role, false)
@@ -1598,7 +1604,10 @@ def expect_updated_criteria_coverage_count_eq(expected_count)
15981604
end
15991605
describe 'with collected results separated by an uncollected results' do
16001606
let!(:grouping2) { create :grouping, assignment: assignment, is_collected: false }
1601-
let!(:grouping3) { create :grouping, assignment: assignment, is_collected: true }
1607+
let!(:grouping3) { create :grouping_with_inviter_and_submission, assignment: assignment }
1608+
before(:each) do
1609+
create :ta_membership, role: role, grouping: grouping3
1610+
end
16021611
it 'should let me navigate to the right if any result exists towards the right' do
16031612
groupings = assignment.groupings.joins(:group).order('group_name')
16041613
new_grouping = groupings.first.get_next_grouping(role, false)

0 commit comments

Comments
 (0)