Skip to content

Commit 4f0f627

Browse files
committed
Fixed step definitions for UI tests
1 parent 3d01f53 commit 4f0f627

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

app/controllers/requests_controller.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ def approve
146146
alert = "Failed to approve the request. #{@request.errors.full_messages.join(', ')}"
147147
respond_to do |format|
148148
format.html { flash[:alert] = alert; redirect_to course_requests_path(@course) }
149-
format.json { render json: { success: false, message: alert }, status: :unprocessable_entity }
149+
format.json { render json: { success: false, message: alert }, status: :unprocessable_content }
150150
end
151151
end
152152
end
@@ -162,7 +162,7 @@ def reject
162162
alert = 'Failed to deny the request.'
163163
respond_to do |format|
164164
format.html { redirect_to course_requests_path(@course), alert: alert }
165-
format.json { render json: { success: false, message: alert }, status: :unprocessable_entity }
165+
format.json { render json: { success: false, message: alert }, status: :unprocessable_content }
166166
end
167167
end
168168
end
@@ -291,7 +291,7 @@ def process_mass_action(action)
291291
processed_ids: [],
292292
failed_ids: [],
293293
new_status: action == :approve ? 'approved' : 'denied',
294-
status: :unprocessable_entity
294+
status: :unprocessable_content
295295
)
296296
end
297297

@@ -304,7 +304,7 @@ def process_mass_action(action)
304304
processed_ids: [],
305305
failed_ids: request_ids,
306306
new_status: action == :approve ? 'approved' : 'denied',
307-
status: :unprocessable_entity
307+
status: :unprocessable_content
308308
)
309309
end
310310

@@ -333,7 +333,7 @@ def process_mass_action(action)
333333
processed_ids: processed_ids,
334334
failed_ids: failed_ids,
335335
new_status: action_label,
336-
status: processed_count.positive? ? :ok : :unprocessable_entity
336+
status: processed_count.positive? ? :ok : :unprocessable_content
337337
)
338338
end
339339

features/step_definitions/custom_steps.rb

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

198198
Given(/^a pending request exists$/) do
199199
student = User.joins(:user_to_courses).find_by(user_to_courses: { course: @course, role: 'student' })
200-
assignment = Assignment.find_by(course: @course)
200+
assignment = Assignment.first
201201
@pending_request = create(:request, user: student, course: @course, assignment: assignment)
202202
end
203203

0 commit comments

Comments
 (0)