Skip to content

Commit 7f5d985

Browse files
committed
Add the rest of the simple fields in Entity.
1 parent cd9318b commit 7f5d985

File tree

2 files changed

+34
-2
lines changed

2 files changed

+34
-2
lines changed

lib/cff/entity.rb

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,17 @@ class Entity < ModelPart
2222

2323
ALLOWED_FIELDS = [
2424
'address',
25-
'name'
25+
'city',
26+
'country',
27+
'email',
28+
'fax',
29+
'location',
30+
'name',
31+
'orcid',
32+
'post-code',
33+
'region',
34+
'tel',
35+
'website'
2636
].freeze # :nodoc:
2737

2838
# :call-seq:

test/cff_entity_test.rb

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,15 @@ def test_bad_methods_not_allowed
3333

3434
def test_simple_fields_set_and_output_correctly
3535
data = [
36-
["address", "A Street"]
36+
["address", "A Street"],
37+
["city", "Manchester"],
38+
["country", "GB"],
39+
["email", "email@example.org"],
40+
["location", "Classified"],
41+
["orcid", "https://orcid.org/0000-0001-2345-6789"],
42+
["post-code", "M13 9PL"],
43+
["region", "Greater Manchester"],
44+
["website", "https://home.example.org"]
3745
]
3846

3947
data.each do |method, value|
@@ -48,4 +56,18 @@ def test_simple_fields_set_and_output_correctly
4856
assert y.include? "#{method_to_field(method)}: #{value}\n"
4957
end
5058
end
59+
60+
def test_tel_fax_fields_set_and_output_correctly
61+
number = "+44 (0) 161-234-5678"
62+
@entity.fax = number
63+
@entity.tel = number
64+
65+
assert_equal @entity.fax, number
66+
assert_equal @entity.tel, number
67+
68+
y = @entity.fields.to_yaml
69+
70+
assert y.include? "fax: \"#{number}\"\n"
71+
assert y.include? "tel: \"#{number}\"\n"
72+
end
5173
end

0 commit comments

Comments
 (0)