aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/models/custom_field_spec.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/spec/models/custom_field_spec.rb b/spec/models/custom_field_spec.rb
index d1c6d803a..54a905116 100644
--- a/spec/models/custom_field_spec.rb
+++ b/spec/models/custom_field_spec.rb
@@ -44,6 +44,15 @@ RSpec.describe CustomField, type: :model do
it "should cast the value" do
expect(vj.custom_fields[:energy].value).to eq 99
end
+
+ it "should validate the value" do
+ vj = build :vehicle_journey, custom_field_values: {energy: "99"}
+ expect(vj.validate).to be_truthy
+
+ vj = build :vehicle_journey, custom_field_values: {energy: "azerty"}
+ expect(vj.validate).to be_falsy
+ expect(vj.errors.messages[:"custom_fields.energy"]).to be_present
+ end
end
context "with a 'string' field_type" do