diff options
| author | Teddy Wing | 2017-09-19 16:59:45 +0200 |
|---|---|---|
| committer | Teddy Wing | 2017-09-19 17:00:30 +0200 |
| commit | e1547b52a372942b34cda3b3fee4ab76e9f1b65e (patch) | |
| tree | 166d3bb167ad1b213a2fae98ec5daf22f3ea90ae /spec/lib/model_attribute_spec.rb | |
| parent | 30fc0d3f1a9a158a0d45bbaf2f78e176f74ac943 (diff) | |
| download | chouette-core-e1547b52a372942b34cda3b3fee4ab76e9f1b65e.tar.bz2 | |
ModelAttribute: Add `#code` method
A method that returns a string representation of the attribute, in the
form `:class#:name".
This will be used to store a reference to the attribute in the database.
For example, a validation will reference a `ModelAttribute` in a
database column using this `#code` string.
Refs #4401
Diffstat (limited to 'spec/lib/model_attribute_spec.rb')
| -rw-r--r-- | spec/lib/model_attribute_spec.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/spec/lib/model_attribute_spec.rb b/spec/lib/model_attribute_spec.rb index da767cfed..ad1dd863f 100644 --- a/spec/lib/model_attribute_spec.rb +++ b/spec/lib/model_attribute_spec.rb @@ -13,4 +13,12 @@ RSpec.describe ModelAttribute do expect(model_attr.data_type).to eq(:string) end end + + describe "#code" do + it "returns a string representation of the attribute" do + model_attr = ModelAttribute.new(:route, :name, :string) + + expect(model_attr.code).to eq('route#name') + end + end end |
