mirror of
https://github.com/discourse/discourse.git
synced 2025-06-05 14:07:30 +08:00
Nuke all SiteSetting.stubs
from our codebase.
This commit is contained in:
@ -11,12 +11,12 @@ describe BasicPostSerializer do
|
||||
let(:json) { serializer.as_json }
|
||||
|
||||
it "returns the name it when `enable_names` is true" do
|
||||
SiteSetting.stubs(:enable_names?).returns(true)
|
||||
SiteSetting.enable_names = true
|
||||
expect(json[:name]).to be_present
|
||||
end
|
||||
|
||||
it "doesn't return the name it when `enable_names` is false" do
|
||||
SiteSetting.stubs(:enable_names?).returns(false)
|
||||
SiteSetting.enable_names = false
|
||||
expect(json[:name]).to be_blank
|
||||
end
|
||||
|
||||
|
@ -70,12 +70,12 @@ describe PostSerializer do
|
||||
let(:json) { serializer.as_json }
|
||||
|
||||
it "returns the display_username it when `enable_names` is on" do
|
||||
SiteSetting.stubs(:enable_names).returns(true)
|
||||
SiteSetting.enable_names = true
|
||||
expect(json[:display_username]).to be_present
|
||||
end
|
||||
|
||||
it "doesn't return the display_username it when `enable_names` is off" do
|
||||
SiteSetting.stubs(:enable_names).returns(false)
|
||||
SiteSetting.enable_names = false
|
||||
expect(json[:display_username]).to be_blank
|
||||
end
|
||||
end
|
||||
|
@ -60,7 +60,7 @@ describe UserSerializer do
|
||||
|
||||
context "with `enable_names` false" do
|
||||
before do
|
||||
SiteSetting.stubs(:enable_names?).returns(false)
|
||||
SiteSetting.enable_names = false
|
||||
end
|
||||
|
||||
it "has a name" do
|
||||
@ -192,7 +192,7 @@ describe UserSerializer do
|
||||
end
|
||||
|
||||
it "serializes the fields listed in public_user_custom_fields site setting" do
|
||||
SiteSetting.stubs(:public_user_custom_fields).returns('public_field')
|
||||
SiteSetting.public_user_custom_fields = 'public_field'
|
||||
expect(json[:custom_fields]['public_field']).to eq(user.custom_fields['public_field'])
|
||||
expect(json[:custom_fields]['secret_field']).to eq(nil)
|
||||
end
|
||||
|
Reference in New Issue
Block a user