DEV: correct test that assumed group 123 did not exist

approved
heisentest
#1

DEV: correct test that assumed group 123 did not exist

This is an incorrect assumption leading to a flaky test, cause for all we know, since sequences do not reset every test, group 123 could exist.

diff --git a/spec/requests/admin/groups_controller_spec.rb b/spec/requests/admin/groups_controller_spec.rb
index fe0278c..d641fb1 100644
--- a/spec/requests/admin/groups_controller_spec.rb
+++ b/spec/requests/admin/groups_controller_spec.rb
@@ -106,8 +106,8 @@ RSpec.describe Admin::GroupsController do
 
   context "#destroy" do
     it 'should return the right response for an invalid group_id' do
-      delete "/admin/groups/123.json"
-
+      max_id = Group.maximum(:id).to_i
+      delete "/admin/groups/#{max_id + 1}.json"
       expect(response.status).to eq(404)
     end

GitHub sha: 307c5268

1 Like
Approved #2