|
188 | 188 | end |
189 | 189 | end |
190 | 190 |
|
191 | | - describe '#get_repo_auth_records' do |
192 | | - let(:assignment1) { create(:assignment, assignment_properties_attributes: { vcs_submit: false }) } |
193 | | - let(:assignment2) { create(:assignment, assignment_properties_attributes: { vcs_submit: false }) } |
194 | | - |
195 | | - before do |
196 | | - create_list(:grouping_with_inviter, 3, assignment: assignment1) |
197 | | - create_list(:grouping_with_inviter, 3, assignment: assignment2) |
198 | | - end |
199 | | - |
200 | | - context 'all assignments with vcs_submit == false' do |
201 | | - it 'should be empty' do |
202 | | - expect(Repository.get_class.get_repo_auth_records).to be_empty |
203 | | - end |
204 | | - end |
205 | | - |
206 | | - context 'one assignment with vcs_submit == true' do |
207 | | - let(:assignment1) { create(:assignment, assignment_properties_attributes: { vcs_submit: true }) } |
208 | | - |
209 | | - it 'should only contain valid memberships' do |
210 | | - ids = assignment1.groupings.map { |g| g.inviter.id } |
211 | | - expect(Repository.get_class.get_repo_auth_records.pluck('roles.id')).to match_array(ids) |
212 | | - end |
213 | | - |
214 | | - context 'when there is a pending membership' do |
215 | | - before { create(:student_membership, grouping: assignment1.groupings.first) } |
216 | | - |
217 | | - it 'should not contain the pending membership' do |
218 | | - ids = assignment1.groupings.map { |g| g.inviter.id } |
219 | | - expect(Repository.get_class.get_repo_auth_records.pluck('roles.id')).to match_array(ids) |
220 | | - end |
221 | | - end |
222 | | - |
223 | | - context 'when the assignment belongs to a hidden course' do |
224 | | - let(:assignment1) do |
225 | | - course = create(:course, is_hidden: true) |
226 | | - create(:assignment, assignment_properties_attributes: { vcs_submit: true }, course: course) |
227 | | - end |
228 | | - |
229 | | - it 'should be empty' do |
230 | | - expect(Repository.get_class.get_repo_auth_records).to be_empty |
231 | | - end |
232 | | - end |
233 | | - end |
234 | | - |
235 | | - context 'both assignments with vcs_submit == true and is_timed == true' do |
236 | | - let(:assignment1) { create(:timed_assignment, assignment_properties_attributes: { vcs_submit: true }) } |
237 | | - let(:assignment2) { create(:timed_assignment, assignment_properties_attributes: { vcs_submit: true }) } |
238 | | - |
239 | | - it 'should be empty' do |
240 | | - expect(Repository.get_class.get_repo_auth_records).to be_empty |
241 | | - end |
242 | | - |
243 | | - context 'when one grouping has started their assignment' do |
244 | | - let!(:grouping) do |
245 | | - g = assignment1.groupings.first |
246 | | - g.update!(start_time: 1.hour.ago) |
247 | | - g.reload |
248 | | - end |
249 | | - |
250 | | - it 'should contain only the members of that group' do |
251 | | - expect(Repository.get_class.get_repo_auth_records.pluck('roles.id')).to contain_exactly(grouping.inviter.id) |
252 | | - end |
253 | | - |
254 | | - context 'when the timed assessment due date has ended' do |
255 | | - let(:assignment1) do |
256 | | - create(:timed_assignment, assignment_properties_attributes: { vcs_submit: true }, due_date: 1.minute.ago) |
257 | | - end |
258 | | - |
259 | | - it 'should contain all members of all groups' do |
260 | | - inviter_ids = assignment1.groupings.map { |g| g.inviter.id } |
261 | | - expect(Repository.get_class.get_repo_auth_records.pluck('roles.id')).to match_array(inviter_ids) |
262 | | - end |
263 | | - end |
264 | | - end |
265 | | - end |
266 | | - end |
267 | | - |
268 | 191 | describe '#get_all_permissions' do |
269 | 192 | let!(:course) { create(:course) } |
270 | 193 | let(:assignment) { create(:assignment_with_criteria_and_results_and_tas) } |
|
0 commit comments