Skip to content

Commit d1a5fa4

Browse files
committed
Autocorrect failing cops
1 parent 709a6aa commit d1a5fa4

26 files changed

Lines changed: 45 additions & 45 deletions

spec/features/class_member/creating_a_batch_of_class_members_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@
181181

182182
it 'responds 422 Unprocessable Entity' do
183183
post("/api/schools/#{school.id}/classes/#{school_class.id}/members/batch", headers:, params: invalid_params)
184-
expect(response).to have_http_status(:unprocessable_entity)
184+
expect(response).to have_http_status(:unprocessable_content)
185185
end
186186

187187
it 'returns the error message in the operation response' do

spec/features/class_member/creating_a_class_member_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666

6767
it 'responds 422 Unprocessable Entity' do
6868
post("/api/schools/#{school.id}/classes/#{school_class.id}/members", headers:, params: student_params)
69-
expect(response).to have_http_status(:unprocessable_entity)
69+
expect(response).to have_http_status(:unprocessable_content)
7070
end
7171

7272
it 'returns the error message from the operation response' do
@@ -132,7 +132,7 @@
132132

133133
it 'responds 422 Unprocessable Entity' do
134134
post("/api/schools/#{school.id}/classes/#{school_class.id}/members", headers:, params: teacher_params)
135-
expect(response).to have_http_status(:unprocessable_entity)
135+
expect(response).to have_http_status(:unprocessable_content)
136136
end
137137

138138
it 'returns the error message from the operation response' do
@@ -209,7 +209,7 @@
209209

210210
it 'responds 422 Unprocessable Entity when params are invalid' do
211211
post("/api/schools/#{school.id}/classes/#{school_class.id}/members", headers:, params: invalid_params)
212-
expect(response).to have_http_status(:unprocessable_entity)
212+
expect(response).to have_http_status(:unprocessable_content)
213213
end
214214

215215
it 'returns the error message in the operation response' do

spec/features/feedback/creating_feedback_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
end
7171

7272
it 'returns unprocessable entity response' do
73-
expect(response).to have_http_status(:unprocessable_entity)
73+
expect(response).to have_http_status(:unprocessable_content)
7474
end
7575

7676
it 'does not add the feedback to the school project' do

spec/features/lesson/creating_a_copy_of_a_lesson_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555

5656
it 'responds 422 Unprocessable Entity when params are invalid' do
5757
post("/api/lessons/#{lesson.id}/copy", headers:, params: { lesson: { name: ' ' } })
58-
expect(response).to have_http_status(:unprocessable_entity)
58+
expect(response).to have_http_status(:unprocessable_content)
5959
end
6060

6161
it 'responds 401 Unauthorized when no token is given' do

spec/features/lesson/creating_a_lesson_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949

5050
it 'responds 422 Unprocessable Entity when params are invalid' do
5151
post('/api/lessons', headers:, params: { lesson: { name: ' ' } })
52-
expect(response).to have_http_status(:unprocessable_entity)
52+
expect(response).to have_http_status(:unprocessable_content)
5353
end
5454

5555
it 'responds 401 Unauthorized when no token is given' do
@@ -151,14 +151,14 @@
151151
new_params = { lesson: params[:lesson].without(:school_id) }
152152

153153
post('/api/lessons', headers:, params: new_params)
154-
expect(response).to have_http_status(:unprocessable_entity)
154+
expect(response).to have_http_status(:unprocessable_content)
155155
end
156156

157157
it 'responds 422 Unprocessable if school_class_id does not correspond to school_id' do
158158
new_params = { lesson: params[:lesson].merge(school_id: SecureRandom.uuid) }
159159

160160
post('/api/lessons', headers:, params: new_params)
161-
expect(response).to have_http_status(:unprocessable_entity)
161+
expect(response).to have_http_status(:unprocessable_content)
162162
end
163163

164164
it 'responds 403 Forbidden when the user is a school-owner for a different school' do
@@ -183,7 +183,7 @@
183183
new_params = { lesson: params[:lesson].merge(user_id:) }
184184

185185
post('/api/lessons', headers:, params: new_params)
186-
expect(response).to have_http_status(:unprocessable_entity)
186+
expect(response).to have_http_status(:unprocessable_content)
187187
end
188188
end
189189
end

spec/features/lesson/updating_a_lesson_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242

4343
it 'responds 422 Unprocessable Entity when params are invalid' do
4444
put("/api/lessons/#{lesson.id}", headers:, params: { lesson: { name: ' ' } })
45-
expect(response).to have_http_status(:unprocessable_entity)
45+
expect(response).to have_http_status(:unprocessable_content)
4646
end
4747

4848
it 'responds 401 Unauthorized when no token is given' do
@@ -125,7 +125,7 @@
125125
new_params = { lesson: params[:lesson].merge(school_class_id: school_class.id) }
126126
put("/api/lessons/#{lesson.id}", headers:, params: new_params)
127127

128-
expect(response).to have_http_status(:unprocessable_entity)
128+
expect(response).to have_http_status(:unprocessable_content)
129129
end
130130
end
131131
end

spec/features/project/creating_a_project_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353

5454
it 'responds 422 Unprocessable Entity when params are invalid' do
5555
post('/api/projects', headers:, params: { project: { components: [{ name: ' ' }] } })
56-
expect(response).to have_http_status(:unprocessable_entity)
56+
expect(response).to have_http_status(:unprocessable_content)
5757
end
5858

5959
it 'responds 401 Unauthorized when no token is given' do
@@ -168,21 +168,21 @@
168168
new_params = { project: project.merge(user_id:) }
169169

170170
post('/api/projects', headers:, params: new_params)
171-
expect(response).to have_http_status(:unprocessable_entity)
171+
expect(response).to have_http_status(:unprocessable_content)
172172
end
173173

174174
it 'responds 422 Unprocessable when lesson_id is provided but school_id is missing' do
175175
new_params = { project: params[:project].without(:school_id) }
176176

177177
post('/api/projects', headers:, params: new_params)
178-
expect(response).to have_http_status(:unprocessable_entity)
178+
expect(response).to have_http_status(:unprocessable_content)
179179
end
180180

181181
it 'responds 422 Unprocessable when lesson_id does not correspond to school_id' do
182182
new_params = { project: params[:project].merge(lesson_id: SecureRandom.uuid) }
183183

184184
post('/api/projects', headers:, params: new_params)
185-
expect(response).to have_http_status(:unprocessable_entity)
185+
expect(response).to have_http_status(:unprocessable_content)
186186
end
187187

188188
it 'responds 403 Forbidden when the user is a school-owner for a different school' do

spec/features/project/updating_a_project_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848

4949
it 'responds 422 Unprocessable Entity when params are invalid' do
5050
put("/api/projects/#{project.id}", headers:, params: { project: { components: [{ name: ' ' }] } })
51-
expect(response).to have_http_status(:unprocessable_entity)
51+
expect(response).to have_http_status(:unprocessable_content)
5252
end
5353

5454
it 'responds 401 Unauthorized when no token is given' do

spec/features/school/creating_a_school_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050

5151
it 'responds 422 Unprocessable Entity when params are invalid' do
5252
post('/api/schools', headers:, params: { school: { name: ' ' } })
53-
expect(response).to have_http_status(:unprocessable_entity)
53+
expect(response).to have_http_status(:unprocessable_content)
5454
end
5555

5656
it 'responds 401 Unauthorized when no token is given' do

spec/features/school/importing_schools_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
it 'responds 422 Unprocessable Entity' do
5454
post('/api/schools/import', headers:)
5555

56-
expect(response).to have_http_status(:unprocessable_entity)
56+
expect(response).to have_http_status(:unprocessable_content)
5757
data = JSON.parse(response.body, symbolize_names: true)
5858
expect(data[:error][:error_code]).to eq('CSV_FILE_REQUIRED')
5959
end

0 commit comments

Comments
 (0)