|
20 | 20 | due_at: mockDate, |
21 | 21 | unlock_at: mockDate, |
22 | 22 | lock_at: mockDate, |
23 | | - student_ids: [mockStudentId] |
| 23 | + student_ids: [ mockStudentId ] |
24 | 24 | } |
25 | 25 | end |
26 | 26 |
|
|
56 | 56 | # other methods need to be refactors too. |
57 | 57 | describe 'get_all_courses' do |
58 | 58 | before do |
59 | | - stubs.get('courses') { [200, {}, '[]'] } |
| 59 | + stubs.get('courses') { [ 200, {}, '[]' ] } |
60 | 60 | end |
61 | 61 |
|
62 | 62 | it 'has correct response body on successful call' do |
|
67 | 67 |
|
68 | 68 | describe 'get_course' do |
69 | 69 | before do |
70 | | - stubs.get("courses/#{mockCourseId}") { [200, {}, '{}'] } |
| 70 | + stubs.get("courses/#{mockCourseId}") { [ 200, {}, '{}' ] } |
71 | 71 | end |
72 | 72 |
|
73 | 73 | it 'has correct response body on successful call' do |
|
78 | 78 |
|
79 | 79 | describe('get_assignments') do |
80 | 80 | before do |
81 | | - stubs.get("courses/#{mockCourseId}/assignments") { [200, {}, '{}'] } |
| 81 | + stubs.get("courses/#{mockCourseId}/assignments") { [ 200, {}, '{}' ] } |
82 | 82 | end |
83 | 83 |
|
84 | 84 | it 'has correct response body on successful call' do |
|
89 | 89 |
|
90 | 90 | describe('get_assignment') do |
91 | 91 | before do |
92 | | - stubs.get("courses/#{mockCourseId}/assignments/#{mockAssignmentId}") { [200, {}, '{}'] } |
| 92 | + stubs.get("courses/#{mockCourseId}/assignments/#{mockAssignmentId}") { [ 200, {}, '{}' ] } |
93 | 93 | end |
94 | 94 |
|
95 | 95 | it 'has correct response body on successful call' do |
|
102 | 102 | before do |
103 | 103 | stubs.get( |
104 | 104 | "courses/#{mockCourseId}/assignments/#{mockAssignmentId}/overrides" |
105 | | - ) { [200, {}, '{}'] } |
| 105 | + ) { [ 200, {}, '{}' ] } |
106 | 106 | end |
107 | 107 |
|
108 | 108 | it 'has correct response body on successful call' do |
|
117 | 117 | before do |
118 | 118 | stubs.post( |
119 | 119 | createAssignmentOverrideUrl |
120 | | - ) { [200, {}, '{}'] } |
| 120 | + ) { [ 200, {}, '{}' ] } |
121 | 121 | end |
122 | 122 |
|
123 | 123 | it 'has correct request body' do |
124 | 124 | expect(conn).to receive(:post).with( |
125 | 125 | createAssignmentOverrideUrl, |
126 | 126 | { assignment_override: { |
127 | | - student_ids: [mockStudentId], |
| 127 | + student_ids: [ mockStudentId ], |
128 | 128 | title: mockTitle, |
129 | 129 | due_at: mockDate, |
130 | 130 | unlock_at: mockDate, |
|
135 | 135 | facade.create_assignment_override( |
136 | 136 | mockCourseId, |
137 | 137 | mockAssignmentId, |
138 | | - [mockStudentId], |
| 138 | + [ mockStudentId ], |
139 | 139 | mockTitle, |
140 | 140 | mockDate, |
141 | 141 | mockDate, |
|
147 | 147 | expect(facade.create_assignment_override( |
148 | 148 | mockCourseId, |
149 | 149 | mockAssignmentId, |
150 | | - [mockStudentId], |
| 150 | + [ mockStudentId ], |
151 | 151 | mockTitle, |
152 | 152 | mockDate, |
153 | 153 | mockDate, |
|
165 | 165 | before do |
166 | 166 | stubs.put( |
167 | 167 | updateAssignmentOverrideUrl |
168 | | - ) { [200, {}, '{}'] } |
| 168 | + ) { [ 200, {}, '{}' ] } |
169 | 169 | end |
170 | 170 |
|
171 | 171 | it 'has correct request body' do |
172 | 172 | expect(conn).to receive(:put).with( |
173 | 173 | updateAssignmentOverrideUrl, |
174 | 174 | { |
175 | | - student_ids: [mockStudentId], |
| 175 | + student_ids: [ mockStudentId ], |
176 | 176 | title: mockTitle, |
177 | 177 | due_at: mockDate, |
178 | 178 | unlock_at: mockDate, |
|
184 | 184 | mockCourseId, |
185 | 185 | mockAssignmentId, |
186 | 186 | mockOverrideId, |
187 | | - [mockStudentId], |
| 187 | + [ mockStudentId ], |
188 | 188 | mockTitle, |
189 | 189 | mockDate, |
190 | 190 | mockDate, |
|
197 | 197 | mockCourseId, |
198 | 198 | mockAssignmentId, |
199 | 199 | mockOverrideId, |
200 | | - [mockStudentId], |
| 200 | + [ mockStudentId ], |
201 | 201 | mockTitle, |
202 | 202 | mockDate, |
203 | 203 | mockDate, |
|
211 | 211 | before do |
212 | 212 | stubs.delete( |
213 | 213 | "courses/#{mockCourseId}/assignments/#{mockAssignmentId}/overrides/#{mockOverrideId}" |
214 | | - ) { [200, {}, '{}'] } |
| 214 | + ) { [ 200, {}, '{}' ] } |
215 | 215 | end |
216 | 216 |
|
217 | 217 | it 'has correct response body on successful call' do |
|
230 | 230 | [ |
231 | 231 | 400, |
232 | 232 | {}, |
233 | | - { errors: { assignment_override_students: [{ |
| 233 | + { errors: { assignment_override_students: [ { |
234 | 234 | attribute: 'assignment_override_students', |
235 | 235 | type: 'taken', |
236 | 236 | message: 'already belongs to an assignment override' |
237 | | - }] } }.to_json |
| 237 | + } ] } }.to_json |
238 | 238 | ] |
239 | 239 | end |
240 | 240 |
|
|
243 | 243 | end |
244 | 244 |
|
245 | 245 | it 'returns correct response body on successful creation' do |
246 | | - stubs.post(mockOverrideCreationUrl) { [200, {}, '{}'] } |
| 246 | + stubs.post(mockOverrideCreationUrl) { [ 200, {}, '{}' ] } |
247 | 247 | expect(facade.provision_extension( |
248 | 248 | mockCourseId, |
249 | 249 | mockStudentId, |
|
253 | 253 | end |
254 | 254 |
|
255 | 255 | it 'throws a pipeline error if the creation response body is improperly formatted' do |
256 | | - stubs.post(mockOverrideCreationUrl) { [400, {}, '{invalid json}'] } |
| 256 | + stubs.post(mockOverrideCreationUrl) { [ 400, {}, '{invalid json}' ] } |
257 | 257 | expect do |
258 | 258 | facade.provision_extension( |
259 | 259 | mockCourseId, |
|
321 | 321 | let(:getAssignmentOverridesUrl) { "courses/#{mockCourseId}/assignments/#{mockAssignmentId}/overrides" } |
322 | 322 |
|
323 | 323 | it 'throws an error if the overrides response body cannot be parsed' do |
324 | | - stubs.get(getAssignmentOverridesUrl) { [200, {}, '{invalid json}'] } |
| 324 | + stubs.get(getAssignmentOverridesUrl) { [ 200, {}, '{invalid json}' ] } |
325 | 325 | expect do |
326 | 326 | facade.send( |
327 | 327 | :get_existing_student_override, |
|
334 | 334 |
|
335 | 335 | it 'returns the override that the student is listed in' do |
336 | 336 | mockOverrideWithoutStudent = mockOverride.clone |
337 | | - mockOverrideWithoutStudent[:student_ids] = [mockStudentId + 1] |
| 337 | + mockOverrideWithoutStudent[:student_ids] = [ mockStudentId + 1 ] |
338 | 338 | stubs.get(getAssignmentOverridesUrl) do |
339 | 339 | [ |
340 | 340 | 200, |
341 | 341 | {}, |
342 | | - [mockOverrideWithoutStudent, mockOverride].to_json |
| 342 | + [ mockOverrideWithoutStudent, mockOverride ].to_json |
343 | 343 | ] |
344 | 344 | end |
345 | 345 | expect(facade.send( |
|
351 | 351 | end |
352 | 352 |
|
353 | 353 | it 'returns nil if no override for that student is found' do |
354 | | - mockOverride[:student_ids] = [mockStudentId + 1] |
| 354 | + mockOverride[:student_ids] = [ mockStudentId + 1 ] |
355 | 355 | stubs.get(getAssignmentOverridesUrl) do |
356 | 356 | [ |
357 | 357 | 200, |
|
387 | 387 |
|
388 | 388 | it 'removes the student and keeps everything else the same' do |
389 | 389 | mockOverrideWithoutStudent = OpenStruct.new(mockOverride) |
390 | | - mockOverrideWithoutStudent.student_ids = [mockStudentId + 1] |
| 390 | + mockOverrideWithoutStudent.student_ids = [ mockStudentId + 1 ] |
391 | 391 | expect(facade).to receive(:update_assignment_override).with( |
392 | 392 | mockCourseId, |
393 | 393 | mockOverrideStruct.assignment_id, |
|
0 commit comments