mirror of
https://github.com/discourse/discourse.git
synced 2025-05-21 18:12:32 +08:00
FEATURE: increasing name length in automation (#28945)
Updates from 30 to 100 the maximum length of the name of an automation. Adds tests for validating the maximum length of the name of an automation.
This commit is contained in:
@ -180,4 +180,19 @@ describe DiscourseAutomation::Automation do
|
||||
expect(user.custom_fields).to eq({ automation2.new_user_custom_field_name => "1" })
|
||||
end
|
||||
end
|
||||
|
||||
context "when creating a new automation" do
|
||||
it "validates the name length" do
|
||||
automation = Fabricate.build(:automation, name: "a" * 101)
|
||||
expect(automation).not_to be_valid
|
||||
expect(automation.errors[:name]).to eq(["is too long (maximum is 100 characters)"])
|
||||
|
||||
automation = Fabricate.build(:automation, name: "b" * 4)
|
||||
expect(automation).not_to be_valid
|
||||
expect(automation.errors[:name]).to eq(["is too short (minimum is 5 characters)"])
|
||||
|
||||
automation = Fabricate.build(:automation, name: "c" * 50)
|
||||
expect(automation).to be_valid
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user