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

This commit is contained in:
Mark VanLandingham 2020-05-20 11:30:27 -05:00 committed by GitHub
parent ba04bb7552
commit e1bd57007b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 0 deletions

View File

@ -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