mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 05:11:20 +08:00
FEATURE: support serializing user custom fields by plugins
This commit is contained in:
@ -161,6 +161,18 @@ describe Plugin::Instance do
|
||||
end
|
||||
end
|
||||
|
||||
context "serialized_current_user_fields" do
|
||||
it "correctly serializes custom user fields" do
|
||||
DiscoursePluginRegistry.serialized_current_user_fields << "has_car"
|
||||
user = Fabricate(:user)
|
||||
user.custom_fields["has_car"] = "true"
|
||||
user.save!
|
||||
|
||||
payload = JSON.parse(CurrentUserSerializer.new(user, scope: Guardian.new(user)).to_json)
|
||||
payload["current_user"]["custom_fields"]["has_car"].should == "true"
|
||||
end
|
||||
end
|
||||
|
||||
context "register_color_scheme" do
|
||||
it "can add a color scheme for the first time" do
|
||||
plugin = Plugin::Instance.new nil, "/tmp/test.rb"
|
||||
|
Reference in New Issue
Block a user