DEV: Test if assign_allowed_on_groups contains only visible groups

DEV: Test if assign_allowed_on_groups contains only visible groups

Follow-up to 7d4b51552449a9041c9515a533e1232f8181390d.

diff --git a/spec/requests/assign_controller_spec.rb b/spec/requests/assign_controller_spec.rb
index 886eabf..9a69cc0 100644
--- a/spec/requests/assign_controller_spec.rb
+++ b/spec/requests/assign_controller_spec.rb
@@ -65,6 +65,20 @@ RSpec.describe DiscourseAssign::AssignController do
 
         expect(suggestions).to contain_exactly(user.username)
       end
+
+      it 'does include only visible assign_allowed_on_groups' do
+        visible_group = Fabricate(:group, members_visibility_level: Group.visibility_levels[:members])
+        visible_group.add(user)
+        invisible_group = Fabricate(:group, members_visibility_level: Group.visibility_levels[:members])
+
+        SiteSetting.assign_allowed_on_groups = above_min_version ? "#{visible_group.id}|#{invisible_group.id}"
+                                                                 : "#{visible_group.name}|#{invisible_group.name}"
+
+        get '/assign/suggestions.json'
+        assign_allowed_on_groups = JSON.parse(response.body)['assign_allowed_on_groups']
+
+        expect(assign_allowed_on_groups).to contain_exactly(visible_group.name)
+      end
     end
   end

GitHub sha: 927fdca0