DEV: Specs for AboutController can_see_about_stats? impact (#9843)

DEV: Specs for AboutController can_see_about_stats? impact (#9843)

diff --git a/spec/requests/about_controller_spec.rb b/spec/requests/about_controller_spec.rb
index 6c58284..a10b766 100644
--- a/spec/requests/about_controller_spec.rb
+++ b/spec/requests/about_controller_spec.rb
@@ -36,5 +36,21 @@ describe AboutController do
         expect(response.body).to include("<title>About - Discourse</title>")
       end
     end
+
+    it "serializes stats when 'Guardian#can_see_about_stats?' is true" do
+      Guardian.any_instance.stubs(:can_see_about_stats?).returns(true)
+      get "/about.json"
+
+      expect(response.status).to eq(200)
+      expect(response.parsed_body["about"].keys).to include("stats")
+    end
+
+    it "does not serialize stats when 'Guardian#can_see_about_stats?' is false" do
+      Guardian.any_instance.stubs(:can_see_about_stats?).returns(false)
+      get "/about.json"
+
+      expect(response.status).to eq(200)
+      expect(response.parsed_body["about"].keys).not_to include("stats")
+    end
   end
 end

GitHub sha: e1bd5700

This commit appears in #9843 which was approved by ZogStriP. It was merged by markvanlan.