diff options
| author | Robert | 2018-01-09 17:46:20 +0100 |
|---|---|---|
| committer | Alban Peignier | 2018-01-10 17:47:10 +0100 |
| commit | fd553851e9e6c59b998eef8577836a954c4d43f3 (patch) | |
| tree | 9f5c170444ec1612a1494984356f838d393de0e1 /spec/models | |
| parent | 2be1e1c2bc313f586c4e0385d90a8cfbcd9ab609 (diff) | |
| download | chouette-core-fd553851e9e6c59b998eef8577836a954c4d43f3.tar.bz2 | |
Refs: #5505@0.5h, added tests and validations
Diffstat (limited to 'spec/models')
| -rw-r--r-- | spec/models/custom_field_spec.rb | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/spec/models/custom_field_spec.rb b/spec/models/custom_field_spec.rb index 3668e9858..b93d98187 100644 --- a/spec/models/custom_field_spec.rb +++ b/spec/models/custom_field_spec.rb @@ -1,5 +1,17 @@ require 'rails_helper' RSpec.describe CustomField, type: :model do - pending "add some examples to (or delete) #{__FILE__}" + + context "validates" do + it { should validate_uniqueness_of(:name).scoped_to(:resource_type) } + end + + context "field access" do + let( :custom_field ){ build_stubbed :custom_field } + + it "option's values can be accessed by a key" do + expect( custom_field.options['capacity'] ).to eq("0") + end + + end end |
