qa 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +284 -2
  3. data/app/controllers/qa/linked_data_terms_controller.rb +127 -0
  4. data/config/authorities/linked_data/agrovoc.json +61 -0
  5. data/config/authorities/linked_data/loc.json +46 -0
  6. data/config/authorities/linked_data/oclc_fast.json +78 -0
  7. data/config/initializers/linked_data_authorities.rb +17 -0
  8. data/config/routes.rb +3 -0
  9. data/lib/qa.rb +15 -0
  10. data/lib/qa/authorities.rb +2 -0
  11. data/lib/qa/authorities/base.rb +1 -1
  12. data/lib/qa/authorities/crossref.rb +16 -0
  13. data/lib/qa/authorities/crossref/generic_authority.rb +63 -0
  14. data/lib/qa/authorities/geonames.rb +2 -1
  15. data/lib/qa/authorities/linked_data.rb +10 -0
  16. data/lib/qa/authorities/linked_data/config.rb +80 -0
  17. data/lib/qa/authorities/linked_data/config/search_config.rb +170 -0
  18. data/lib/qa/authorities/linked_data/config/term_config.rb +186 -0
  19. data/lib/qa/authorities/linked_data/find_term.rb +148 -0
  20. data/lib/qa/authorities/linked_data/generic_authority.rb +49 -0
  21. data/lib/qa/authorities/linked_data/rdf_helper.rb +102 -0
  22. data/lib/qa/authorities/linked_data/search_query.rb +143 -0
  23. data/lib/qa/version.rb +1 -1
  24. data/spec/controllers/linked_data_terms_controller_spec.rb +202 -0
  25. data/spec/fixtures/authorities/linked_data/lod_full_config.json +111 -0
  26. data/spec/fixtures/authorities/linked_data/lod_lang_defaults.json +54 -0
  27. data/spec/fixtures/authorities/linked_data/lod_lang_multi_defaults.json +54 -0
  28. data/spec/fixtures/authorities/linked_data/lod_lang_no_defaults.json +52 -0
  29. data/spec/fixtures/authorities/linked_data/lod_lang_param.json +66 -0
  30. data/spec/fixtures/authorities/linked_data/lod_min_config.json +49 -0
  31. data/spec/fixtures/authorities/linked_data/lod_search_only_config.json +55 -0
  32. data/spec/fixtures/authorities/linked_data/lod_sort.json +27 -0
  33. data/spec/fixtures/authorities/linked_data/lod_term_only_config.json +59 -0
  34. data/spec/fixtures/funders-find-response.json +1 -0
  35. data/spec/fixtures/funders-noquery.json +1 -0
  36. data/spec/fixtures/funders-noresults.json +1 -0
  37. data/spec/fixtures/funders-result.json +1 -0
  38. data/spec/fixtures/journals-find-response-two-issn.json +1 -0
  39. data/spec/fixtures/journals-find-response.json +1 -0
  40. data/spec/fixtures/journals-noquery.json +1 -0
  41. data/spec/fixtures/journals-noresults.json +1 -0
  42. data/spec/fixtures/journals-result.json +705 -0
  43. data/spec/fixtures/lod_agrovoc_query_many_results.json +1 -0
  44. data/spec/fixtures/lod_agrovoc_query_no_results.json +1 -0
  45. data/spec/fixtures/lod_agrovoc_term_found.rdf.xml +217 -0
  46. data/spec/fixtures/lod_lang_search_en.rdf.xml +42 -0
  47. data/spec/fixtures/lod_lang_search_enfr.rdf.xml +48 -0
  48. data/spec/fixtures/lod_lang_search_enfrde.rdf.xml +54 -0
  49. data/spec/fixtures/lod_lang_search_fr.rdf.xml +42 -0
  50. data/spec/fixtures/lod_lang_term_en.rdf.xml +65 -0
  51. data/spec/fixtures/lod_lang_term_enfr.rdf.xml +71 -0
  52. data/spec/fixtures/lod_lang_term_enfr_noalt.rdf.xml +69 -0
  53. data/spec/fixtures/lod_lang_term_enfrde.rdf.xml +79 -0
  54. data/spec/fixtures/lod_lang_term_fr.rdf.xml +65 -0
  55. data/spec/fixtures/lod_loc_term_found.rdf.xml +262 -0
  56. data/spec/fixtures/lod_oclc_all_query_3_results.rdf.xml +142 -0
  57. data/spec/fixtures/lod_oclc_personalName_query_3_results.rdf.xml +128 -0
  58. data/spec/fixtures/lod_oclc_query_no_results.rdf.xml +13 -0
  59. data/spec/fixtures/lod_oclc_term_found.rdf.xml +51 -0
  60. data/spec/lib/authorities/crossref_spec.rb +180 -0
  61. data/spec/lib/authorities/geonames_spec.rb +2 -2
  62. data/spec/lib/authorities/linked_data/config_spec.rb +143 -0
  63. data/spec/lib/authorities/linked_data/find_term_spec.rb +5 -0
  64. data/spec/lib/authorities/linked_data/generic_authority_spec.rb +580 -0
  65. data/spec/lib/authorities/linked_data/search_config_spec.rb +385 -0
  66. data/spec/lib/authorities/linked_data/search_query_spec.rb +79 -0
  67. data/spec/lib/authorities/linked_data/term_config_spec.rb +419 -0
  68. data/spec/routing/linked_data_route_spec.rb +35 -0
  69. data/spec/spec_helper.rb +2 -0
  70. metadata +184 -39
@@ -0,0 +1,419 @@
1
+ require 'spec_helper'
2
+
3
+ describe Qa::Authorities::LinkedData::TermConfig do
4
+ let(:full_config) { Qa::Authorities::LinkedData::Config.new(:LOD_FULL_CONFIG).term }
5
+ let(:min_config) { Qa::Authorities::LinkedData::Config.new(:LOD_MIN_CONFIG).term }
6
+ let(:search_only_config) { Qa::Authorities::LinkedData::Config.new(:LOD_SEARCH_ONLY_CONFIG).term }
7
+
8
+ describe '#term_config' do
9
+ let(:full_term_config) do
10
+ {
11
+ url: {
12
+ :@context => 'http://www.w3.org/ns/hydra/context.jsonld',
13
+ :@type => 'IriTemplate',
14
+ template: 'http://localhost/test_default/term/{?subauth}/{?term_id}?param1={?param1}&param2={?param2}',
15
+ variableRepresentation: 'BasicRepresentation',
16
+ mapping: [
17
+ {
18
+ :@type => 'IriTemplateMapping',
19
+ variable: 'term_id',
20
+ property: 'hydra:freetextQuery',
21
+ required: true
22
+ },
23
+ {
24
+ :@type => 'IriTemplateMapping',
25
+ variable: 'subauth',
26
+ property: 'hydra:freetextQuery',
27
+ required: false,
28
+ default: 'term_sub2_name'
29
+ },
30
+ {
31
+ :@type => 'IriTemplateMapping',
32
+ variable: 'param1',
33
+ property: 'hydra:freetextQuery',
34
+ required: false,
35
+ default: 'alpha'
36
+ },
37
+ {
38
+ :@type => 'IriTemplateMapping',
39
+ variable: 'param2',
40
+ property: 'hydra:freetextQuery',
41
+ required: false,
42
+ default: 'beta'
43
+ }
44
+ ]
45
+ },
46
+ qa_replacement_patterns: {
47
+ term_id: 'term_id',
48
+ subauth: 'subauth'
49
+ },
50
+ term_id: 'ID',
51
+ language: ['en'],
52
+ results: {
53
+ id_predicate: 'http://purl.org/dc/terms/identifier',
54
+ label_predicate: 'http://www.w3.org/2004/02/skos/core#prefLabel',
55
+ altlabel_predicate: 'http://www.w3.org/2004/02/skos/core#altLabel',
56
+ broader_predicate: 'http://www.w3.org/2004/02/skos/core#broader',
57
+ narrower_predicate: 'http://www.w3.org/2004/02/skos/core#narrower',
58
+ sameas_predicate: 'http://www.w3.org/2004/02/skos/core#exactMatch'
59
+ },
60
+ subauthorities: {
61
+ term_sub1_key: 'term_sub1_name',
62
+ term_sub2_key: 'term_sub2_name',
63
+ term_sub3_key: 'term_sub3_name'
64
+ }
65
+ }
66
+ end
67
+
68
+ it 'returns nil if only search configuration is defined' do
69
+ expect(search_only_config.send(:term_config)).to be_empty
70
+ end
71
+ it 'returns hash of term configuration' do
72
+ expect(full_config.send(:term_config)).to eq full_term_config
73
+ end
74
+ end
75
+
76
+ describe '#supports_term?' do
77
+ it 'returns false if term is NOT configured' do
78
+ expect(search_only_config.supports_term?).to eq false
79
+ end
80
+ it 'returns true if term is configured' do
81
+ expect(full_config.supports_term?).to eq true
82
+ end
83
+ end
84
+
85
+ describe '#term_url' do
86
+ let(:url_config) do
87
+ {
88
+ :@context => 'http://www.w3.org/ns/hydra/context.jsonld',
89
+ :@type => 'IriTemplate',
90
+ template: 'http://localhost/test_default/term/{?subauth}/{?term_id}?param1={?param1}&param2={?param2}',
91
+ variableRepresentation: 'BasicRepresentation',
92
+ mapping: [
93
+ {
94
+ :@type => 'IriTemplateMapping',
95
+ variable: 'term_id',
96
+ property: 'hydra:freetextQuery',
97
+ required: true
98
+ },
99
+ {
100
+ :@type => 'IriTemplateMapping',
101
+ variable: 'subauth',
102
+ property: 'hydra:freetextQuery',
103
+ required: false,
104
+ default: 'term_sub2_name'
105
+ },
106
+ {
107
+ :@type => 'IriTemplateMapping',
108
+ variable: 'param1',
109
+ property: 'hydra:freetextQuery',
110
+ required: false,
111
+ default: 'alpha'
112
+ },
113
+ {
114
+ :@type => 'IriTemplateMapping',
115
+ variable: 'param2',
116
+ property: 'hydra:freetextQuery',
117
+ required: false,
118
+ default: 'beta'
119
+ }
120
+ ]
121
+ }
122
+ end
123
+
124
+ it 'returns nil if only search configuration is defined' do
125
+ expect(search_only_config.term_url).to eq nil
126
+ end
127
+ it 'returns the term url from the configuration' do
128
+ expect(full_config.term_url).to eq url_config
129
+ end
130
+ end
131
+
132
+ describe '#term_url' do
133
+ it 'returns nil if only search configuration is defined' do
134
+ expect(search_only_config.term_url_template).to eq nil
135
+ end
136
+ it 'returns the term url from the configuration' do
137
+ expected_url = 'http://localhost/test_default/term/{?subauth}/{?term_id}?param1={?param1}&param2={?param2}'
138
+ expect(full_config.term_url_template).to eq expected_url
139
+ end
140
+ end
141
+
142
+ describe '#term_id_expects_id?' do
143
+ it 'returns false if term_id specifies a URI is required' do
144
+ expect(min_config.term_id_expects_id?).to eq false
145
+ end
146
+ it 'returns true if term_id specifies an ID is required' do
147
+ expect(full_config.term_id_expects_id?).to eq true
148
+ end
149
+ end
150
+
151
+ describe '#term_id_expects_uri?' do
152
+ it 'returns false if term_id specifies a ID is required' do
153
+ expect(full_config.term_id_expects_uri?).to eq false
154
+ end
155
+ it 'returns true if term_id specifies an URI is required' do
156
+ expect(min_config.term_id_expects_uri?).to eq true
157
+ end
158
+ end
159
+
160
+ describe '#term_language' do
161
+ it 'returns nil if only search configuration is defined' do
162
+ expect(search_only_config.term_language).to eq nil
163
+ end
164
+ it 'returns nil if language is not specified' do
165
+ expect(min_config.term_language).to eq nil
166
+ end
167
+ it 'returns the preferred language for selecting literal values if configured for term' do
168
+ expect(full_config.term_language).to eq [:en]
169
+ end
170
+ end
171
+
172
+ describe '#term_results' do
173
+ let(:results_config) do
174
+ {
175
+ id_predicate: 'http://purl.org/dc/terms/identifier',
176
+ label_predicate: 'http://www.w3.org/2004/02/skos/core#prefLabel',
177
+ altlabel_predicate: 'http://www.w3.org/2004/02/skos/core#altLabel',
178
+ broader_predicate: 'http://www.w3.org/2004/02/skos/core#broader',
179
+ narrower_predicate: 'http://www.w3.org/2004/02/skos/core#narrower',
180
+ sameas_predicate: 'http://www.w3.org/2004/02/skos/core#exactMatch'
181
+ }
182
+ end
183
+ it 'returns nil if only search configuration is defined' do
184
+ expect(search_only_config.term_results).to eq nil
185
+ end
186
+ it 'returns hash of predicates' do
187
+ expect(full_config.term_results).to eq results_config
188
+ end
189
+ end
190
+
191
+ describe '#term_results_id_predicate' do
192
+ it 'returns nil if only search configuration is defined' do
193
+ expect(search_only_config.term_results_id_predicate).to eq nil
194
+ end
195
+ it 'returns the predicate that holds the ID in term results' do
196
+ expect(full_config.term_results_id_predicate).to eq RDF::URI('http://purl.org/dc/terms/identifier')
197
+ end
198
+ end
199
+
200
+ describe '#term_results_label_predicate' do
201
+ it 'returns nil if only search configuration is defined' do
202
+ expect(search_only_config.term_results_label_predicate).to eq nil
203
+ end
204
+ it 'returns the predicate that holds the label in term results' do
205
+ expect(full_config.term_results_label_predicate).to eq RDF::URI('http://www.w3.org/2004/02/skos/core#prefLabel')
206
+ end
207
+ end
208
+
209
+ describe '#term_results_altlabel_predicate' do
210
+ it 'returns nil if only search configuration is defined' do
211
+ expect(search_only_config.term_results_altlabel_predicate).to eq nil
212
+ end
213
+ it 'return nil if altlabel predicate is not defined' do
214
+ expect(min_config.term_results_altlabel_predicate).to eq nil
215
+ end
216
+ it 'returns the predicate that holds the altlabel in term results' do
217
+ expect(full_config.term_results_altlabel_predicate).to eq RDF::URI('http://www.w3.org/2004/02/skos/core#altLabel')
218
+ end
219
+ end
220
+
221
+ describe '#term_results_broader_predicate' do
222
+ it 'returns nil if only search configuration is defined' do
223
+ expect(search_only_config.term_results_broader_predicate).to eq nil
224
+ end
225
+ it 'return nil if broader predicate is not defined' do
226
+ expect(min_config.term_results_broader_predicate).to eq nil
227
+ end
228
+ it 'returns the predicate that holds any broader terms in term results' do
229
+ expect(full_config.term_results_broader_predicate).to eq RDF::URI('http://www.w3.org/2004/02/skos/core#broader')
230
+ end
231
+ end
232
+
233
+ describe '#term_results_narrower_predicate' do
234
+ it 'returns nil if only search configuration is defined' do
235
+ expect(search_only_config.term_results_narrower_predicate).to eq nil
236
+ end
237
+ it 'return nil if narrower predicate is not defined' do
238
+ expect(min_config.term_results_narrower_predicate).to eq nil
239
+ end
240
+ it 'returns the predicate that holds any narrower terms in term results' do
241
+ expect(full_config.term_results_narrower_predicate).to eq RDF::URI('http://www.w3.org/2004/02/skos/core#narrower')
242
+ end
243
+ end
244
+
245
+ describe '#term_results_sameas_predicate' do
246
+ it 'returns nil if only search configuration is defined' do
247
+ expect(search_only_config.term_results_sameas_predicate).to eq nil
248
+ end
249
+ it 'return nil if sameas predicate is not defined' do
250
+ expect(min_config.term_results_sameas_predicate).to eq nil
251
+ end
252
+ it 'returns the predicate that holds any sameas terms in term results' do
253
+ expect(full_config.term_results_sameas_predicate).to eq RDF::URI('http://www.w3.org/2004/02/skos/core#exactMatch')
254
+ end
255
+ end
256
+
257
+ describe '#term_replacements?' do
258
+ it 'returns false if only search configuration is defined' do
259
+ expect(search_only_config.term_replacements?).to eq false
260
+ end
261
+ it 'returns false if the configuration does NOT define replacements' do
262
+ expect(min_config.term_replacements?).to eq false
263
+ end
264
+ it 'returns true if the configuration defines replacements' do
265
+ expect(full_config.term_replacements?).to eq true
266
+ end
267
+ end
268
+
269
+ describe '#term_replacement_count' do
270
+ it 'returns 0 if only search configuration is defined' do
271
+ expect(search_only_config.term_replacement_count).to eq 0
272
+ end
273
+ it 'returns 0 if replacement_count is NOT defined' do
274
+ expect(min_config.term_replacement_count).to eq 0
275
+ end
276
+ it 'returns the number of replacements if defined' do
277
+ expect(full_config.term_replacement_count).to eq 2
278
+ end
279
+ end
280
+
281
+ describe '#term_replacements' do
282
+ it 'returns empty hash if only search configuration is defined' do
283
+ empty_hash = {}
284
+ expect(search_only_config.term_replacements).to eq empty_hash
285
+ end
286
+ it 'returns empty hash if no replacement patterns are defined' do
287
+ empty_hash = {}
288
+ expect(min_config.term_replacements).to eq empty_hash
289
+ end
290
+ it 'returns hash of all replacement patterns' do
291
+ expected_hash = {
292
+ param1: { :@type => 'IriTemplateMapping', variable: 'param1', property: 'hydra:freetextQuery', required: false, default: 'alpha' },
293
+ param2: { :@type => 'IriTemplateMapping', variable: 'param2', property: 'hydra:freetextQuery', required: false, default: 'beta' }
294
+ }
295
+ expect(full_config.term_replacements).to eq expected_hash
296
+ end
297
+ end
298
+
299
+ describe '#term_subauthorities?' do
300
+ it 'returns false if only search configuration is defined' do
301
+ expect(search_only_config.term_subauthorities?).to eq false
302
+ end
303
+ it 'returns false if the configuration does NOT define subauthorities' do
304
+ expect(min_config.term_subauthorities?).to eq false
305
+ end
306
+ it 'returns true if the configuration defines subauthorities' do
307
+ expect(full_config.term_subauthorities?).to eq true
308
+ end
309
+ end
310
+
311
+ describe '#term_subauthority?' do
312
+ it 'returns false if only search configuration is defined' do
313
+ expect(search_only_config.term_subauthority?('fake_subauth')).to eq false
314
+ end
315
+ it 'returns false if there are no subauthorities configured' do
316
+ expect(min_config.term_subauthority?('fake_subauth')).to eq false
317
+ end
318
+ it 'returns false if the requested subauthority is NOT configured' do
319
+ expect(full_config.term_subauthority?('fake_subauth')).to eq false
320
+ end
321
+ it 'returns true if the requested subauthority is configured' do
322
+ expect(full_config.term_subauthority?('term_sub2_key')).to eq true
323
+ end
324
+ end
325
+
326
+ describe '#term_subauthority_count' do
327
+ it 'returns 0 if only search configuration is defined' do
328
+ expect(search_only_config.term_subauthority_count).to eq 0
329
+ end
330
+ it 'returns 0 if the configuration does NOT define subauthorities' do
331
+ expect(min_config.term_subauthority_count).to eq 0
332
+ end
333
+ it 'returns the number of subauthorities if defined' do
334
+ expect(full_config.term_subauthority_count).to eq 3
335
+ end
336
+ end
337
+
338
+ describe '#term_subauthorities' do
339
+ it 'returns empty hash if only search configuration is defined' do
340
+ empty_hash = {}
341
+ expect(search_only_config.term_subauthorities).to eq empty_hash
342
+ end
343
+ it 'returns empty hash if no subauthorities are defined' do
344
+ empty_hash = {}
345
+ expect(min_config.term_subauthorities).to eq empty_hash
346
+ end
347
+ it 'returns hash of all subauthority key-value patterns defined' do
348
+ expected_hash = {
349
+ term_sub1_key: 'term_sub1_name',
350
+ term_sub2_key: 'term_sub2_name',
351
+ term_sub3_key: 'term_sub3_name'
352
+ }
353
+ expect(full_config.term_subauthorities).to eq expected_hash
354
+ end
355
+ end
356
+
357
+ describe '#term_subauthority_replacement_pattern' do
358
+ it 'returns empty hash if only search configuration is defined' do
359
+ empty_hash = {}
360
+ expect(search_only_config.term_subauthority_replacement_pattern).to eq empty_hash
361
+ end
362
+ it 'returns empty hash if no subauthorities are defined' do
363
+ empty_hash = {}
364
+ expect(min_config.term_subauthority_replacement_pattern).to eq empty_hash
365
+ end
366
+ it 'returns hash replacement pattern for subauthority and the default value' do
367
+ expected_hash = { pattern: 'subauth', default: 'term_sub2_name' }
368
+ expect(full_config.term_subauthority_replacement_pattern).to eq expected_hash
369
+ end
370
+ end
371
+
372
+ describe '#term_url_with_replacements' do
373
+ it 'returns nil if only search configuration is defined' do
374
+ expect(search_only_config.term_url_with_replacements('C123')).to eq nil
375
+ end
376
+ it 'returns the url with query substitution applied' do
377
+ expected_url = 'http://localhost/test_default/term/term_sub2_name/C123?param1=alpha&param2=beta'
378
+ expect(full_config.term_url_with_replacements('C123')).to eq expected_url
379
+ end
380
+ it 'returns the url with default subauthority when NOT specified' do
381
+ expected_url = 'http://localhost/test_default/term/term_sub2_name/C123?param1=alpha&param2=beta'
382
+ expect(full_config.term_url_with_replacements('C123')).to eq expected_url
383
+ end
384
+ it 'returns the url with subauthority substitution when specified' do
385
+ expected_url = 'http://localhost/test_default/term/term_sub3_name/C123?param1=alpha&param2=beta'
386
+ expect(full_config.term_url_with_replacements('C123', 'term_sub3_key')).to eq expected_url
387
+ end
388
+ it 'returns the url with default values when replacements are NOT specified' do
389
+ expected_url = 'http://localhost/test_default/term/term_sub2_name/C123?param1=alpha&param2=beta'
390
+ expect(full_config.term_url_with_replacements('C123')).to eq expected_url
391
+ end
392
+ it 'returns the url with replacement substitution values when replacements are specified' do
393
+ expected_url = 'http://localhost/test_default/term/term_sub2_name/C123?param1=golf&param2=hotel'
394
+ expect(full_config.term_url_with_replacements('C123', nil, param1: 'golf', param2: 'hotel')).to eq expected_url
395
+ end
396
+
397
+ context 'when subauthorities are not defined' do
398
+ it 'returns the url with query substitution applied' do
399
+ expected_url = 'http://localhost/test_default/term/C123'
400
+ expect(min_config.term_url_with_replacements('C123')).to eq expected_url
401
+ end
402
+ it 'and subauth param is included returns the url with query substitution applied ignoring the subauth' do
403
+ expected_url = 'http://localhost/test_default/term/C123'
404
+ expect(min_config.term_url_with_replacements('C123', 'fake_subauth_key')).to eq expected_url
405
+ end
406
+ end
407
+
408
+ context 'when replacements are not defined' do
409
+ it 'returns the url with query substitution applied' do
410
+ expected_url = 'http://localhost/test_default/term/C123'
411
+ expect(min_config.term_url_with_replacements('C123')).to eq expected_url
412
+ end
413
+ it 'and replacements param is included returns the url with query substitution applied ignoring the replacements' do
414
+ expected_url = 'http://localhost/test_default/term/C123'
415
+ expect(min_config.term_url_with_replacements('C123', nil, fake_replacement_key: 'fake_value')).to eq expected_url
416
+ end
417
+ end
418
+ end
419
+ end
@@ -0,0 +1,35 @@
1
+ require 'spec_helper'
2
+
3
+ describe "QA Routes", type: :routing do
4
+ routes { Qa::Engine.routes }
5
+
6
+ context 'searching for terms' do
7
+ it 'routes to searching for an authority' do
8
+ expect(get: '/search/linked_data/test_authority').to route_to(controller: 'qa/linked_data_terms',
9
+ action: 'search',
10
+ vocab: 'test_authority')
11
+ end
12
+ it 'routes to searching for an authority and a subauthority' do
13
+ expect(get: '/search/linked_data/test_authority/test_subauthority').to route_to(controller: 'qa/linked_data_terms',
14
+ action: 'search',
15
+ vocab: 'test_authority',
16
+ subauthority: 'test_subauthority')
17
+ end
18
+ end
19
+
20
+ context 'displaying a single term' do
21
+ it 'routes to an authority' do
22
+ expect(get: '/show/linked_data/test_authority/term_id').to route_to(controller: 'qa/linked_data_terms',
23
+ action: 'show',
24
+ vocab: 'test_authority',
25
+ id: 'term_id')
26
+ end
27
+ it 'routes to an authority with a subauthority' do
28
+ expect(get: '/show/linked_data/test_authority/test_subauthority/term_id').to route_to(controller: 'qa/linked_data_terms',
29
+ action: 'show',
30
+ vocab: 'test_authority',
31
+ subauthority: 'test_subauthority',
32
+ id: 'term_id')
33
+ end
34
+ end
35
+ end