mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 16:40:01 +08:00
DEV: Specs for AboutController can_see_about_stats? impact (#9843)
This commit is contained in:
parent
ba04bb7552
commit
e1bd57007b
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user