mods_display 0.3.3 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +16 -0
  3. data/.rubocop_todo.yml +60 -0
  4. data/.travis.yml +2 -2
  5. data/Rakefile +10 -2
  6. data/lib/mods_display.rb +42 -42
  7. data/lib/mods_display/configuration.rb +69 -67
  8. data/lib/mods_display/configuration/access_condition.rb +17 -13
  9. data/lib/mods_display/configuration/base.rb +27 -24
  10. data/lib/mods_display/configuration/format.rb +8 -4
  11. data/lib/mods_display/configuration/genre.rb +8 -4
  12. data/lib/mods_display/configuration/imprint.rb +12 -7
  13. data/lib/mods_display/configuration/name.rb +8 -4
  14. data/lib/mods_display/configuration/note.rb +8 -4
  15. data/lib/mods_display/configuration/related_item.rb +8 -4
  16. data/lib/mods_display/configuration/subject.rb +11 -9
  17. data/lib/mods_display/configuration/title.rb +8 -4
  18. data/lib/mods_display/controller_extension.rb +24 -24
  19. data/lib/mods_display/country_codes.rb +385 -384
  20. data/lib/mods_display/fields/abstract.rb +7 -6
  21. data/lib/mods_display/fields/access_condition.rb +55 -55
  22. data/lib/mods_display/fields/audience.rb +7 -6
  23. data/lib/mods_display/fields/cartographics.rb +15 -14
  24. data/lib/mods_display/fields/collection.rb +32 -17
  25. data/lib/mods_display/fields/contact.rb +15 -13
  26. data/lib/mods_display/fields/contents.rb +7 -6
  27. data/lib/mods_display/fields/description.rb +21 -21
  28. data/lib/mods_display/fields/field.rb +164 -109
  29. data/lib/mods_display/fields/format.rb +36 -33
  30. data/lib/mods_display/fields/genre.rb +12 -11
  31. data/lib/mods_display/fields/identifier.rb +34 -34
  32. data/lib/mods_display/fields/imprint.rb +258 -214
  33. data/lib/mods_display/fields/language.rb +18 -16
  34. data/lib/mods_display/fields/location.rb +27 -26
  35. data/lib/mods_display/fields/name.rb +113 -118
  36. data/lib/mods_display/fields/note.rb +33 -34
  37. data/lib/mods_display/fields/related_item.rb +64 -66
  38. data/lib/mods_display/fields/resource_type.rb +13 -11
  39. data/lib/mods_display/fields/sub_title.rb +6 -4
  40. data/lib/mods_display/fields/subject.rb +92 -90
  41. data/lib/mods_display/fields/title.rb +54 -49
  42. data/lib/mods_display/fields/values.rb +7 -8
  43. data/lib/mods_display/html.rb +117 -96
  44. data/lib/mods_display/model_extension.rb +17 -16
  45. data/lib/mods_display/relator_codes.rb +269 -267
  46. data/lib/mods_display/version.rb +1 -1
  47. data/mods_display.gemspec +13 -12
  48. data/spec/configuration/access_condition_spec.rb +5 -5
  49. data/spec/configuration/base_spec.rb +24 -24
  50. data/spec/fields/abstract_spec.rb +24 -14
  51. data/spec/fields/access_condition_spec.rb +80 -55
  52. data/spec/fields/audience_spec.rb +15 -12
  53. data/spec/fields/cartographics_spec.rb +17 -18
  54. data/spec/fields/collection_spec.rb +65 -19
  55. data/spec/fields/contact_spec.rb +11 -9
  56. data/spec/fields/contents_spec.rb +15 -12
  57. data/spec/fields/description_spec.rb +40 -22
  58. data/spec/fields/format_spec.rb +28 -18
  59. data/spec/fields/genre_spec.rb +18 -16
  60. data/spec/fields/identifier_spec.rb +46 -34
  61. data/spec/fields/imprint_spec.rb +151 -125
  62. data/spec/fields/language_spec.rb +36 -20
  63. data/spec/fields/location_spec.rb +43 -27
  64. data/spec/fields/name_spec.rb +92 -92
  65. data/spec/fields/note_spec.rb +53 -40
  66. data/spec/fields/related_item_spec.rb +42 -40
  67. data/spec/fields/resource_type_spec.rb +20 -14
  68. data/spec/fields/sub_title_spec.rb +11 -9
  69. data/spec/fields/subject_spec.rb +61 -56
  70. data/spec/fields/title_spec.rb +53 -40
  71. data/spec/fixtures/access_condition_fixtures.rb +50 -0
  72. data/spec/fixtures/cartographics_fixtures.rb +1 -1
  73. data/spec/fixtures/imprint_fixtures.rb +49 -1
  74. data/spec/fixtures/name_fixtures.rb +195 -2
  75. data/spec/fixtures/related_item_fixtures.rb +107 -0
  76. data/spec/fixtures/subjects_fixtures.rb +15 -2
  77. data/spec/fixtures/title_fixtures.rb +101 -0
  78. data/spec/integration/configuration_spec.rb +23 -20
  79. data/spec/integration/html_spec.rb +40 -29
  80. data/spec/integration/installation_spec.rb +14 -14
  81. data/spec/spec_helper.rb +5 -8
  82. metadata +25 -3
@@ -0,0 +1,50 @@
1
+ module AccessConditionFixtures
2
+ def simple_access_condition_fixture
3
+ <<-XML
4
+ <mods>
5
+ <accessCondition>Access Condition Note</accessCondition>
6
+ </mods>
7
+ XML
8
+ end
9
+
10
+ def restricted_access_fixture
11
+ <<-XML
12
+ <mods>
13
+ <accessCondition type='restrictionOnAccess'>Restrict Access Note1</accessCondition>
14
+ <accessCondition type='restriction on access'>Restrict Access Note2</accessCondition>
15
+ </mods>
16
+ XML
17
+ end
18
+
19
+ def copyright_access_fixture
20
+ <<-XML
21
+ <mods>
22
+ <accessCondition type='copyright'>This is a (c) copyright Note. Single instances of (c) should also be replaced in these notes.</accessCondition>
23
+ </mods>
24
+ XML
25
+ end
26
+
27
+ def cc_license_fixture
28
+ <<-XML
29
+ <mods>
30
+ <accessCondition type='license'>CC by-sa: This work is licensed under a Creative Commons Attribution-Noncommercial 3.0 Unported License</accessCondition>
31
+ </mods>
32
+ XML
33
+ end
34
+
35
+ def odc_license_fixture
36
+ <<-XML
37
+ <mods>
38
+ <accessCondition type='license'>ODC pddl: This work is licensed under a Open Data Commons Public Domain Dedication and License (PDDL)</accessCondition>
39
+ </mods>
40
+ XML
41
+ end
42
+
43
+ def no_license_fixture
44
+ <<-XML
45
+ <mods>
46
+ <accessCondition type='license'>Unknown something: This work is licensed under an Unknown License and will not be linked</accessCondition>
47
+ </mods>
48
+ XML
49
+ end
50
+ end
@@ -49,4 +49,4 @@ module CartographicsFixtures
49
49
  </mods>
50
50
  MODS
51
51
  end
52
- end
52
+ end
@@ -12,6 +12,7 @@ module ImprintFixtures
12
12
  </mods>
13
13
  MODS
14
14
  end
15
+
15
16
  def no_edition_mods
16
17
  <<-MODS
17
18
  <mods>
@@ -26,6 +27,7 @@ module ImprintFixtures
26
27
  </mods>
27
28
  MODS
28
29
  end
30
+
29
31
  def origin_info_mods
30
32
  <<-MODS
31
33
  <mods>
@@ -38,6 +40,7 @@ module ImprintFixtures
38
40
  </mods>
39
41
  MODS
40
42
  end
43
+
41
44
  def mixed_mods
42
45
  <<-MODS
43
46
  <mods>
@@ -50,6 +53,7 @@ module ImprintFixtures
50
53
  </mods>
51
54
  MODS
52
55
  end
56
+
53
57
  def display_form
54
58
  <<-MODS
55
59
  <mods>
@@ -66,6 +70,7 @@ module ImprintFixtures
66
70
  </mods>
67
71
  MODS
68
72
  end
73
+
69
74
  def display_label
70
75
  <<-MODS
71
76
  <mods>
@@ -82,6 +87,7 @@ module ImprintFixtures
82
87
  </mods>
83
88
  MODS
84
89
  end
90
+
85
91
  def date_range
86
92
  <<-MODS
87
93
  <mods>
@@ -92,6 +98,7 @@ module ImprintFixtures
92
98
  </mods>
93
99
  MODS
94
100
  end
101
+
95
102
  def open_date_range
96
103
  <<-MODS
97
104
  <mods>
@@ -101,6 +108,7 @@ module ImprintFixtures
101
108
  </mods>
102
109
  MODS
103
110
  end
111
+
104
112
  def encoded_date_range
105
113
  <<-MODS
106
114
  <mods>
@@ -111,6 +119,7 @@ module ImprintFixtures
111
119
  </mods>
112
120
  MODS
113
121
  end
122
+
114
123
  def dup_qualified_date
115
124
  <<-MODS
116
125
  <mods>
@@ -121,6 +130,7 @@ module ImprintFixtures
121
130
  </mods>
122
131
  MODS
123
132
  end
133
+
124
134
  def dup_unencoded_date
125
135
  <<-MODS
126
136
  <mods>
@@ -131,6 +141,7 @@ module ImprintFixtures
131
141
  </mods>
132
142
  MODS
133
143
  end
144
+
134
145
  def dup_copyright_date
135
146
  <<-MODS
136
147
  <mods>
@@ -141,6 +152,7 @@ module ImprintFixtures
141
152
  </mods>
142
153
  MODS
143
154
  end
155
+
144
156
  def dup_date
145
157
  <<-MODS
146
158
  <mods>
@@ -151,6 +163,7 @@ module ImprintFixtures
151
163
  </mods>
152
164
  MODS
153
165
  end
166
+
154
167
  def approximate_date
155
168
  <<-MODS
156
169
  <mods>
@@ -160,6 +173,7 @@ module ImprintFixtures
160
173
  </mods>
161
174
  MODS
162
175
  end
176
+
163
177
  def questionable_date
164
178
  <<-MODS
165
179
  <mods>
@@ -169,6 +183,7 @@ module ImprintFixtures
169
183
  </mods>
170
184
  MODS
171
185
  end
186
+
172
187
  def inferred_date
173
188
  <<-MODS
174
189
  <mods>
@@ -178,6 +193,7 @@ module ImprintFixtures
178
193
  </mods>
179
194
  MODS
180
195
  end
196
+
181
197
  def three_imprint_dates
182
198
  <<-MODS
183
199
  <mods>
@@ -189,6 +205,7 @@ module ImprintFixtures
189
205
  </mods>
190
206
  MODS
191
207
  end
208
+
192
209
  def qualified_imprint_date
193
210
  <<-MODS
194
211
  <mods>
@@ -198,6 +215,7 @@ module ImprintFixtures
198
215
  </mods>
199
216
  MODS
200
217
  end
218
+
201
219
  def imprint_date_range
202
220
  <<-MODS
203
221
  <mods>
@@ -209,6 +227,7 @@ module ImprintFixtures
209
227
  </mods>
210
228
  MODS
211
229
  end
230
+
212
231
  def encoded_place
213
232
  <<-MODS
214
233
  <mods>
@@ -234,6 +253,7 @@ module ImprintFixtures
234
253
  </mods>
235
254
  MODS
236
255
  end
256
+
237
257
  def xx_country_code
238
258
  <<-MODS
239
259
  <mods>
@@ -246,6 +266,7 @@ module ImprintFixtures
246
266
  </mods>
247
267
  MODS
248
268
  end
269
+
249
270
  def encoded_dates
250
271
  <<-MODS
251
272
  <mods>
@@ -258,6 +279,7 @@ module ImprintFixtures
258
279
  </mods>
259
280
  MODS
260
281
  end
282
+
261
283
  def bad_dates
262
284
  <<-MODS
263
285
  <mods>
@@ -275,6 +297,7 @@ module ImprintFixtures
275
297
  </mods>
276
298
  MODS
277
299
  end
300
+
278
301
  def invalid_dates
279
302
  <<-MODS
280
303
  <mods>
@@ -287,4 +310,29 @@ module ImprintFixtures
287
310
  </mods>
288
311
  MODS
289
312
  end
290
- end
313
+
314
+ def punctuation_imprint_fixture
315
+ <<-MODS
316
+ <mods>
317
+ <originInfo displayLabel="publisher">
318
+ <place>
319
+ <placeTerm>San Francisco :</placeTerm>
320
+ </place>
321
+ <publisher>Chronicle Books,</publisher>
322
+ <dateIssued>2015.</dateIssued>
323
+ </originInfo>
324
+ </mods>
325
+ MODS
326
+ end
327
+
328
+ def bc_ad_imprint_date_fixture
329
+ <<-MODS
330
+ <mods>
331
+ <originInfo>
332
+ <dateCreated encoding="edtf" keydate="yes" point="start">-0013</dateCreated>
333
+ <dateCreated point="end">0044</dateCreated>
334
+ </originInfo>
335
+ </mods>
336
+ MODS
337
+ end
338
+ end
@@ -1,3 +1,196 @@
1
1
  module NameFixtures
2
-
3
- end
2
+ def simple_name_fixture
3
+ <<-XML
4
+ <mods>
5
+ <name>
6
+ <namePart>John Doe</namePart>
7
+ </name>
8
+ </mods>
9
+ XML
10
+ end
11
+
12
+ def blank_name_fixture
13
+ <<-XML
14
+ <mods>
15
+ <name>
16
+ <namePart/>
17
+ <role>
18
+ <roleTerm></roleTerm>
19
+ </role>
20
+ </name>
21
+ </mods>
22
+ XML
23
+ end
24
+
25
+ def primary_name_fixture
26
+ <<-XML
27
+ <mods>
28
+ <name usage='primary'>
29
+ <namePart>John Doe</namePart>
30
+ <role>
31
+ <roleTerm>lithographer</roleTerm>
32
+ </role>
33
+ </name>
34
+ </mods>
35
+ XML
36
+ end
37
+
38
+ def contributor_fixture
39
+ <<-XML
40
+ <mods>
41
+ <name>
42
+ <namePart>John Doe</namePart>
43
+ <role>
44
+ <roleTerm>lithographer</roleTerm>
45
+ </role>
46
+ </name>
47
+ </mods>
48
+ XML
49
+ end
50
+
51
+ def encoded_role_fixture
52
+ <<-XML
53
+ <mods>
54
+ <name>
55
+ <namePart>John Doe</namePart>
56
+ <role>
57
+ <roleTerm type='code' authority='marcrelator'>ltg</roleTerm>
58
+ </role>
59
+ </name>
60
+ </mods>
61
+ XML
62
+ end
63
+
64
+ def mixed_role_fixture
65
+ <<-XML
66
+ <mods>
67
+ <name>
68
+ <role>
69
+ <roleTerm>publisher</roleTerm>
70
+ </role>
71
+ <namePart>John Doe</namePart>
72
+ <role>
73
+ <roleTerm type='text' authority='marcrelator'>engraver</roleTerm>
74
+ </role>
75
+ </name>
76
+ </mods>
77
+ XML
78
+ end
79
+
80
+ def numural_toa_fixture
81
+ <<-XML
82
+ <mods>
83
+ <name>
84
+ <namePart>Unqualfieid</namePart>
85
+ <namePart type='termsOfAddress'>XVII, ToA</namePart>
86
+ <namePart type='date'>date1-date2</namePart>
87
+ <namePart type='given'>Given Name</namePart>
88
+ <namePart type='family'>Family Name</namePart>
89
+ </name>
90
+ </mods>
91
+ XML
92
+ end
93
+
94
+ def simple_toa_fixture
95
+ <<-XML
96
+ <mods>
97
+ <name>
98
+ <namePart>Unqualfieid</namePart>
99
+ <namePart type='termsOfAddress'>Ier, empereur</namePart>
100
+ <namePart type='date'>date1-date2</namePart>
101
+ <namePart type='given'>Given Name</namePart>
102
+ <namePart type='family'>Family Name</namePart>
103
+ </name>
104
+ </mods>
105
+ XML
106
+ end
107
+
108
+ def display_form_name_fixture
109
+ <<-XML
110
+ <mods>
111
+ <name>
112
+ <namePart>John Doe</namePart>
113
+ <displayForm>Mr. John Doe</displayForm>
114
+ </name>
115
+ </mods>
116
+ XML
117
+ end
118
+
119
+ def collapse_label_name_fixture
120
+ <<-XML
121
+ <mods>
122
+ <name>
123
+ <namePart>John Doe</namePart>
124
+ </name>
125
+ <name>
126
+ <namePart>Jane Doe</namePart>
127
+ </name>
128
+ </mods>
129
+ XML
130
+ end
131
+
132
+ def complex_name_label_fixture
133
+ <<-XML
134
+ <mods>
135
+ <name>
136
+ <namePart>John Doe</namePart>
137
+ </name>
138
+ <name>
139
+ <namePart>Jane Doe</namePart>
140
+ <role>
141
+ <roleTerm>lithographer</roleTerm>
142
+ </role>
143
+ </name>
144
+ <name>
145
+ <namePart>John Dough</namePart>
146
+ </name>
147
+ <name>
148
+ <namePart>Jane Dough</namePart>
149
+ </name>
150
+ </mods>
151
+ XML
152
+ end
153
+
154
+ def complex_role_name_fixture
155
+ <<-XML
156
+ <mods>
157
+ <name>
158
+ <namePart>John Doe</namePart>
159
+ <role>
160
+ <roleTerm type='text'>Depicted</roleTerm>
161
+ <roleTerm type='code'>dpt</roleTerm>
162
+ </role>
163
+ </name>
164
+ </mods>
165
+ XML
166
+ end
167
+
168
+ def name_with_role_fixture
169
+ <<-XML
170
+ <mods>
171
+ <name>
172
+ <namePart>John Doe</namePart>
173
+ <role>
174
+ <roleTerm type='text'>Depicted</roleTerm>
175
+ </role>
176
+ </name>
177
+ </mods>
178
+ XML
179
+ end
180
+
181
+ def multiple_roles_fixture
182
+ <<-XML
183
+ <mods>
184
+ <name>
185
+ <namePart>John Doe</namePart>
186
+ <role>
187
+ <roleTerm type='text'>Depicted</roleTerm>
188
+ </role>
189
+ <role>
190
+ <roleTerm type='text'>Artist</roleTerm>
191
+ </role>
192
+ </name>
193
+ </mods>
194
+ XML
195
+ end
196
+ end