mirror of
https://github.com/discourse/discourse.git
synced 2025-06-05 08:07:17 +08:00
FEATURE: custom fields on User
This commit is contained in:
@ -1149,4 +1149,29 @@ describe User do
|
||||
|
||||
end
|
||||
|
||||
describe "custom fields" do
|
||||
it "allows modification of custom fields" do
|
||||
user = Fabricate(:user)
|
||||
|
||||
user.custom_fields["a"].should == nil
|
||||
|
||||
user.custom_fields["bob"] = "marley"
|
||||
user.custom_fields["jack"] = "black"
|
||||
user.save
|
||||
|
||||
user = User.find(user.id)
|
||||
|
||||
user.custom_fields["bob"].should == "marley"
|
||||
user.custom_fields["jack"].should == "black"
|
||||
|
||||
user.custom_fields.delete("bob")
|
||||
user.custom_fields["jack"] = "jill"
|
||||
|
||||
user.save
|
||||
user = User.find(user.id)
|
||||
|
||||
user.custom_fields.should == {"jack" => "jill"}
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
Reference in New Issue
Block a user