A platform for community discussion. Free, open, simple.
DEV: Specs for AboutController can_see_about_stats? impact (#9843)
Mark VanLandinghame1bd57007be8
diff --git a/spec/requests/about_controller_spec.rb b/spec/requests/about_controller_spec.rbindex 6c58284979f..a10b7663043 100644--- a/spec/requests/about_controller_spec.rb+++ b/spec/requests/about_controller_spec.rb@@ -36,5 +36,21 @@ describe AboutController doexpect(response.body).to include("<title>About - Discourse</title>")endend++ 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")+ endendend