|
1033 | 1033 | let(:params) { { course_id: assignment.course.id, id: ssfg.starter_file_group.assignment.id } }
|
1034 | 1034 |
|
1035 | 1035 | it 'should contain the right values' do
|
| 1036 | + expect(response.parsed_body['sections'].size).to eq 1 |
1036 | 1037 | file_data = response.parsed_body['sections'].first
|
1037 | 1038 | expected = { section_id: section.id,
|
1038 | 1039 | section_name: section.name,
|
1039 | 1040 | group_id: starter_file_group.id,
|
1040 | 1041 | group_name: starter_file_group.name }
|
1041 | 1042 | expect(file_data).to eq(expected.transform_keys(&:to_s))
|
1042 | 1043 | end
|
| 1044 | + |
| 1045 | + context 'when there is another assignment with sections' do |
| 1046 | + let(:a2) { create(:assignment) } |
| 1047 | + let(:other_starter_file_group) { create(:starter_file_group, assignment: a2) } |
| 1048 | + let(:ssfg2) do |
| 1049 | + create(:section_starter_file_group, starter_file_group: other_starter_file_group, section: section) |
| 1050 | + end |
| 1051 | + let(:params) do |
| 1052 | + # Ensure creation of both assignments and starter file groups |
| 1053 | + ssfg |
| 1054 | + ssfg2 |
| 1055 | + { course_id: assignment.course.id, id: ssfg.starter_file_group.assignment.id } |
| 1056 | + end |
| 1057 | + |
| 1058 | + it 'should only contain the section data for the requested assignment' do |
| 1059 | + expect(response.parsed_body['sections'].size).to eq 1 |
| 1060 | + file_data = response.parsed_body['sections'].first |
| 1061 | + expected = { section_id: section.id, |
| 1062 | + section_name: section.name, |
| 1063 | + group_id: starter_file_group.id, |
| 1064 | + group_name: starter_file_group.name } |
| 1065 | + expect(file_data).to eq(expected.transform_keys(&:to_s)) |
| 1066 | + end |
| 1067 | + end |
1043 | 1068 | end
|
1044 | 1069 | end
|
1045 | 1070 |
|
|
0 commit comments