mirror of
https://github.com/discourse/discourse.git
synced 2025-05-23 11:26:28 +08:00
DEV: Move array type custom fields to JSON type in automation (#26939)
The automation plugin has 4 custom field types that are array typed. However, array typed custom fields are deprecated and should be migrated to JSON type. This commit does a couple of things: 1. Migrate all four custom fields to JSON 2. Fix a couple of small bugs that have been discovered while migrating the custom fields to JSON (see the comments on this commit's PR for details https://github.com/discourse/discourse/pull/26939)
This commit is contained in:
@ -46,19 +46,29 @@ describe DiscourseAutomation::Automation do
|
||||
end
|
||||
end
|
||||
|
||||
describe "#detach_custom_field" do
|
||||
describe "#remove_id_from_custom_field" do
|
||||
fab!(:automation)
|
||||
|
||||
it "expects a User/Topic/Post instance" do
|
||||
expect { automation.detach_custom_field(Invite.new) }.to raise_error(RuntimeError)
|
||||
expect {
|
||||
automation.remove_id_from_custom_field(
|
||||
Invite.new,
|
||||
DiscourseAutomation::AUTOMATION_IDS_CUSTOM_FIELD,
|
||||
)
|
||||
}.to raise_error(RuntimeError)
|
||||
end
|
||||
end
|
||||
|
||||
describe "#attach_custom_field" do
|
||||
describe "#add_id_to_custom_field" do
|
||||
fab!(:automation)
|
||||
|
||||
it "expects a User/Topic/Post instance" do
|
||||
expect { automation.attach_custom_field(Invite.new) }.to raise_error(RuntimeError)
|
||||
expect {
|
||||
automation.add_id_to_custom_field(
|
||||
Invite.new,
|
||||
DiscourseAutomation::AUTOMATION_IDS_CUSTOM_FIELD,
|
||||
)
|
||||
}.to raise_error(RuntimeError)
|
||||
end
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user