From 6e8c2bb4ab207ad0a0e86882cd05de384863fd83 Mon Sep 17 00:00:00 2001 From: Alan Guo Xiang Tan Date: Fri, 29 Dec 2023 12:44:41 +0800 Subject: [PATCH] DEV: Improve error message when test fails (#25067) Why this change? The two tests being updated in question has been flaky on CI. However, when using `be_forbidden`, the error message does not indicate what the actual response code was making it hard for us to debug. What does this change do? Assert for the exact response status code we are expecting. --- spec/requests/finish_installation_controller_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/requests/finish_installation_controller_spec.rb b/spec/requests/finish_installation_controller_spec.rb index 6e0ae2abfc3..08f1f956c50 100644 --- a/spec/requests/finish_installation_controller_spec.rb +++ b/spec/requests/finish_installation_controller_spec.rb @@ -7,7 +7,7 @@ RSpec.describe FinishInstallationController do it "doesn't allow access" do get "/finish-installation" - expect(response).to be_forbidden + expect(response.status).to eq(403) end end @@ -27,7 +27,7 @@ RSpec.describe FinishInstallationController do it "doesn't allow access" do get "/finish-installation/register" - expect(response).to be_forbidden + expect(response.status).to eq(403) end end