geoblacklight 4.0.0 → 4.1.1

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 (232) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +23 -8
  3. data/.gitignore +3 -0
  4. data/.standard.yml +1 -0
  5. data/Gemfile +13 -11
  6. data/README.md +1 -1
  7. data/Rakefile +42 -50
  8. data/app/assets/images/blacklight/american-geographical-society-library-uwm-libraries.svg +26 -0
  9. data/app/assets/images/blacklight/arizona.svg +4 -0
  10. data/app/assets/images/blacklight/circle-info-solid.svg +1 -0
  11. data/app/assets/images/blacklight/fire-solid.svg +1 -0
  12. data/app/assets/images/blacklight/lightbulb-solid.svg +1 -0
  13. data/app/assets/images/blacklight/nebraska.svg +4 -0
  14. data/app/assets/images/blacklight/rutgers.svg +5 -0
  15. data/app/assets/images/blacklight/triangle-exclamation-solid.svg +1 -0
  16. data/app/assets/javascripts/geoblacklight/basemaps.js +1 -1
  17. data/app/assets/stylesheets/geoblacklight/modules/sidebar.scss +8 -0
  18. data/app/components/geoblacklight/display_note_component.html.erb +1 -0
  19. data/app/components/geoblacklight/display_note_component.rb +47 -0
  20. data/app/components/geoblacklight/icon_facet_item_component.rb +2 -2
  21. data/app/controllers/download_controller.rb +36 -37
  22. data/app/controllers/relation_controller.rb +1 -0
  23. data/app/controllers/wms_controller.rb +1 -0
  24. data/app/helpers/arcgis_helper.rb +2 -1
  25. data/app/helpers/blacklight_helper.rb +2 -1
  26. data/app/helpers/carto_helper.rb +3 -2
  27. data/app/helpers/geoblacklight/geoblacklight_helper_behavior.rb +2 -1
  28. data/app/helpers/geoblacklight_helper.rb +47 -36
  29. data/app/models/concerns/geoblacklight/bbox_filter_query.rb +1 -1
  30. data/app/models/concerns/geoblacklight/solr_document/arcgis.rb +1 -0
  31. data/app/models/concerns/geoblacklight/solr_document/carto.rb +1 -0
  32. data/app/models/concerns/geoblacklight/solr_document/citation.rb +3 -2
  33. data/app/models/concerns/geoblacklight/solr_document/finder.rb +1 -0
  34. data/app/models/concerns/geoblacklight/solr_document/inspection.rb +1 -0
  35. data/app/models/concerns/geoblacklight/solr_document.rb +17 -9
  36. data/app/models/concerns/geoblacklight/suppressed_records_search_behavior.rb +2 -1
  37. data/app/presenters/geoblacklight/document_presenter.rb +3 -2
  38. data/app/views/catalog/_citation.html.erb +35 -10
  39. data/app/views/catalog/_show_default_display_note.html.erb +7 -0
  40. data/app/views/catalog/_show_sidebar.html.erb +1 -0
  41. data/app/views/catalog/_show_sidebar_static_map.html.erb +10 -0
  42. data/app/views/relation/index.json.jbuilder +1 -1
  43. data/config/initializers/new_gbl_settings_defaults_4.1.yml +104 -0
  44. data/config/initializers/rails_config.rb +5 -1
  45. data/config/locales/geoblacklight.en.yml +18 -10
  46. data/geoblacklight.gemspec +36 -40
  47. data/lib/generators/geoblacklight/assets_generator.rb +15 -15
  48. data/lib/generators/geoblacklight/install_generator.rb +24 -23
  49. data/lib/generators/geoblacklight/templates/catalog_controller.rb +66 -71
  50. data/lib/generators/geoblacklight/templates/settings.gbl_v1.yml +2 -2
  51. data/lib/generators/geoblacklight/templates/settings.yml +76 -24
  52. data/lib/geoblacklight/bounding_box.rb +1 -0
  53. data/lib/geoblacklight/constants.rb +26 -25
  54. data/lib/geoblacklight/download/geojson_download.rb +10 -9
  55. data/lib/geoblacklight/download/geotiff_download.rb +6 -5
  56. data/lib/geoblacklight/download/hgl_download.rb +4 -3
  57. data/lib/geoblacklight/download/kmz_download.rb +11 -10
  58. data/lib/geoblacklight/download/shapefile_download.rb +10 -9
  59. data/lib/geoblacklight/download.rb +12 -11
  60. data/lib/geoblacklight/engine.rb +10 -9
  61. data/lib/geoblacklight/exceptions.rb +3 -0
  62. data/lib/geoblacklight/faraday_middleware/follow_redirects.rb +14 -11
  63. data/lib/geoblacklight/geometry.rb +6 -5
  64. data/lib/geoblacklight/item_viewer.rb +4 -3
  65. data/lib/geoblacklight/metadata/base.rb +4 -3
  66. data/lib/geoblacklight/metadata/fgdc.rb +1 -0
  67. data/lib/geoblacklight/metadata/html.rb +5 -4
  68. data/lib/geoblacklight/metadata/iso19139.rb +1 -0
  69. data/lib/geoblacklight/metadata.rb +1 -0
  70. data/lib/geoblacklight/metadata_transformer/base.rb +5 -4
  71. data/lib/geoblacklight/metadata_transformer/fgdc.rb +1 -0
  72. data/lib/geoblacklight/metadata_transformer/iso19139.rb +1 -0
  73. data/lib/geoblacklight/metadata_transformer.rb +6 -2
  74. data/lib/geoblacklight/reference.rb +3 -2
  75. data/lib/geoblacklight/references.rb +12 -7
  76. data/lib/geoblacklight/relation/ancestors.rb +4 -3
  77. data/lib/geoblacklight/relation/descendants.rb +4 -3
  78. data/lib/geoblacklight/relation/relation_response.rb +3 -2
  79. data/lib/geoblacklight/routes/downloadable.rb +3 -2
  80. data/lib/geoblacklight/routes/exportable.rb +4 -3
  81. data/lib/geoblacklight/routes/wms.rb +2 -1
  82. data/lib/geoblacklight/routes.rb +4 -3
  83. data/lib/geoblacklight/version.rb +2 -1
  84. data/lib/geoblacklight/view_helper_override.rb +3 -2
  85. data/lib/geoblacklight/wms_layer/feature_info_response.rb +5 -4
  86. data/lib/geoblacklight/wms_layer.rb +4 -3
  87. data/lib/geoblacklight.rb +32 -31
  88. data/lib/tasks/geoblacklight.rake +45 -44
  89. data/schema/geoblacklight-schema-aardvark.json +6 -0
  90. data/spec/components/geoblacklight/display_note_component_spec.rb +27 -0
  91. data/spec/components/geoblacklight/homepage_feature_facet_component_spec.rb +11 -10
  92. data/spec/components/geoblacklight/icon_facet_item_component_spec.rb +8 -7
  93. data/spec/config/initializers/rails_config_spec.rb +10 -9
  94. data/spec/controllers/catalog_controller_spec.rb +27 -26
  95. data/spec/controllers/download_controller_spec.rb +50 -49
  96. data/spec/controllers/relation_controller_spec.rb +5 -4
  97. data/spec/controllers/wms_controller_spec.rb +10 -9
  98. data/spec/factories/user.rb +3 -2
  99. data/spec/features/bookmarks_spec.rb +7 -6
  100. data/spec/features/citations_spec.rb +12 -0
  101. data/spec/features/configurable_basemap_spec.rb +12 -11
  102. data/spec/features/data_dictionary_download_spec.rb +11 -10
  103. data/spec/features/download_layer_spec.rb +64 -63
  104. data/spec/features/empty_search_spec.rb +6 -5
  105. data/spec/features/esri_viewer_spec.rb +33 -32
  106. data/spec/features/exports_spec.rb +18 -17
  107. data/spec/features/full_screen_controll_spec.rb +8 -8
  108. data/spec/features/help_text_spec.rb +6 -5
  109. data/spec/features/home_page_spec.rb +30 -29
  110. data/spec/features/iiif_viewer_spec.rb +6 -5
  111. data/spec/features/index_map_spec.rb +17 -16
  112. data/spec/features/layer_inspection_spec.rb +8 -7
  113. data/spec/features/layer_opacity_spec.rb +15 -14
  114. data/spec/features/layer_preview_spec.rb +11 -10
  115. data/spec/features/layer_with_no_references_spec.rb +5 -4
  116. data/spec/features/linkified_attribute_table_spec.rb +8 -7
  117. data/spec/features/metadata_panel_spec.rb +32 -31
  118. data/spec/features/missing_metadata_spec.rb +18 -17
  119. data/spec/features/multiple_downloads_spec.rb +11 -10
  120. data/spec/features/oembed_spec.rb +6 -5
  121. data/spec/features/relations_spec.rb +51 -26
  122. data/spec/features/saved_searches_spec.rb +7 -6
  123. data/spec/features/search_bar_spec.rb +9 -8
  124. data/spec/features/search_results_complex_geometry_spec.rb +12 -11
  125. data/spec/features/search_results_icons_spec.rb +10 -9
  126. data/spec/features/search_results_map_spec.rb +21 -20
  127. data/spec/features/search_results_overlap_ratio_spec.rb +17 -16
  128. data/spec/features/search_spec.rb +19 -18
  129. data/spec/features/show_page_download_spec.rb +15 -14
  130. data/spec/features/show_page_metadata_spec.rb +9 -8
  131. data/spec/features/show_page_sidebar_static_map_spec.rb +21 -0
  132. data/spec/features/sms_spec.rb +12 -11
  133. data/spec/features/split_view.html.erb_spec.rb +56 -55
  134. data/spec/features/suppressed_records_spec.rb +10 -9
  135. data/spec/features/tilejson_spec.rb +12 -9
  136. data/spec/features/tms_spec.rb +6 -5
  137. data/spec/features/web_services_modal_spec.rb +39 -38
  138. data/spec/features/wmts_spec.rb +20 -17
  139. data/spec/features/xyz_spec.rb +6 -5
  140. data/spec/fixtures/manifests/tilejson.json +1 -1
  141. data/spec/fixtures/manifests/wmts-single.xml +5 -5
  142. data/spec/fixtures/solr_documents/actual-papermap1.json +1 -1
  143. data/spec/fixtures/solr_documents/actual-point1.json +1 -1
  144. data/spec/fixtures/solr_documents/actual-polygon1.json +1 -1
  145. data/spec/fixtures/solr_documents/actual-raster1.json +1 -1
  146. data/spec/fixtures/solr_documents/baruch_ancestor1.json +1 -1
  147. data/spec/fixtures/solr_documents/baruch_ancestor2.json +1 -1
  148. data/spec/fixtures/solr_documents/baruch_documentation_download.json +2 -2
  149. data/spec/fixtures/solr_documents/cornell_html_metadata.json +1 -1
  150. data/spec/fixtures/solr_documents/display-note.json +52 -0
  151. data/spec/fixtures/solr_documents/esri-dynamic-layer-all-layers.json +1 -1
  152. data/spec/fixtures/solr_documents/esri-dynamic-layer-single-layer.json +1 -1
  153. data/spec/fixtures/solr_documents/esri-feature-layer.json +1 -1
  154. data/spec/fixtures/solr_documents/esri-image-map-layer.json +1 -1
  155. data/spec/fixtures/solr_documents/esri-tiled_map_layer.json +1 -1
  156. data/spec/fixtures/solr_documents/esri-wms-layer.json +1 -1
  157. data/spec/fixtures/solr_documents/harvard_raster.json +1 -1
  158. data/spec/fixtures/solr_documents/iiif-eastern-hemisphere.json +1 -1
  159. data/spec/fixtures/solr_documents/index-map-polygon-no-downloadurl.json +1 -1
  160. data/spec/fixtures/solr_documents/index-map-polygon.json +1 -1
  161. data/spec/fixtures/solr_documents/index-map-stanford.json +1 -1
  162. data/spec/fixtures/solr_documents/index_map_point.json +1 -1
  163. data/spec/fixtures/solr_documents/princeton-parent.json +1 -1
  164. data/spec/fixtures/solr_documents/public_direct_download.json +1 -1
  165. data/spec/fixtures/solr_documents/public_iiif_princeton.json +1 -1
  166. data/spec/fixtures/solr_documents/restricted-line.json +1 -1
  167. data/spec/fixtures/solr_documents/tilejson.json +3 -3
  168. data/spec/fixtures/solr_documents/umn_metro_result1.json +2 -2
  169. data/spec/fixtures/solr_documents/umn_state_result1.json +1 -1
  170. data/spec/fixtures/solr_documents/umn_state_result2.json +1 -1
  171. data/spec/fixtures/solr_documents/uva_slug_colon.json +1 -1
  172. data/spec/fixtures/solr_documents/wmts-multiple.json +1 -1
  173. data/spec/fixtures/solr_documents/wmts-single-layer.json +7 -7
  174. data/spec/fixtures/solr_documents/xyz.json +3 -3
  175. data/spec/helpers/arcgis_helper_spec.rb +8 -7
  176. data/spec/helpers/carto_helper_spec.rb +6 -5
  177. data/spec/helpers/geoblacklight/geoblacklight_helper_behavior_spec.rb +10 -15
  178. data/spec/helpers/geoblacklight_helper_spec.rb +139 -138
  179. data/spec/lib/geoblacklight/bounding_box_spec.rb +14 -13
  180. data/spec/lib/geoblacklight/document_presenter_spec.rb +26 -25
  181. data/spec/lib/geoblacklight/download/geojson_download_spec.rb +8 -7
  182. data/spec/lib/geoblacklight/download/geotiff_download_spec.rb +8 -7
  183. data/spec/lib/geoblacklight/download/hgl_download_spec.rb +16 -15
  184. data/spec/lib/geoblacklight/download/kmz_download_spec.rb +9 -8
  185. data/spec/lib/geoblacklight/download/shapefile_download_spec.rb +8 -7
  186. data/spec/lib/geoblacklight/download_spec.rb +61 -60
  187. data/spec/lib/geoblacklight/geometry_spec.rb +29 -28
  188. data/spec/lib/geoblacklight/item_viewer_spec.rb +25 -24
  189. data/spec/lib/geoblacklight/metadata/base_spec.rb +44 -43
  190. data/spec/lib/geoblacklight/metadata/html_spec.rb +7 -6
  191. data/spec/lib/geoblacklight/metadata_spec.rb +15 -14
  192. data/spec/lib/geoblacklight/metadata_transformer/base_spec.rb +13 -12
  193. data/spec/lib/geoblacklight/metadata_transformer/fgdc_spec.rb +8 -7
  194. data/spec/lib/geoblacklight/metadata_transformer/iso19139_spec.rb +8 -7
  195. data/spec/lib/geoblacklight/metadata_transformer_spec.rb +15 -14
  196. data/spec/lib/geoblacklight/reference_spec.rb +28 -27
  197. data/spec/lib/geoblacklight/references_spec.rb +89 -76
  198. data/spec/lib/geoblacklight/relation/ancestors_spec.rb +17 -16
  199. data/spec/lib/geoblacklight/relation/descendants_spec.rb +17 -16
  200. data/spec/lib/geoblacklight/relation/relation_response_spec.rb +29 -28
  201. data/spec/lib/geoblacklight/view_helper_override_spec.rb +14 -13
  202. data/spec/lib/geoblacklight/wms_layer/feature_info_response_spec.rb +19 -18
  203. data/spec/lib/geoblacklight/wms_layer_spec.rb +31 -30
  204. data/spec/models/concerns/geoblacklight/bbox_filter_field_spec.rb +31 -31
  205. data/spec/models/concerns/geoblacklight/bbox_filter_query_spec.rb +32 -32
  206. data/spec/models/concerns/geoblacklight/solr_document/carto_spec.rb +16 -15
  207. data/spec/models/concerns/geoblacklight/solr_document/citation_spec.rb +7 -6
  208. data/spec/models/concerns/geoblacklight/solr_document/finder_spec.rb +16 -17
  209. data/spec/models/concerns/geoblacklight/solr_document/inspection_spec.rb +7 -6
  210. data/spec/models/concerns/geoblacklight/solr_document_spec.rb +121 -107
  211. data/spec/models/concerns/geoblacklight/suppressed_records_search_behavior_spec.rb +8 -7
  212. data/spec/presenters/geoblacklight/bbox_item_presenter_spec.rb +10 -10
  213. data/spec/routing/catalog_routing_spec.rb +4 -3
  214. data/spec/spec_helper.rb +35 -38
  215. data/spec/support/backport_test_helpers.rb +6 -5
  216. data/spec/support/features/session_helpers.rb +8 -7
  217. data/spec/support/features.rb +2 -1
  218. data/spec/support/fixtures.rb +2 -1
  219. data/spec/tasks/geoblacklight_spec.rb +10 -9
  220. data/spec/test_app_templates/lib/generators/test_app_generator.rb +16 -15
  221. data/spec/views/catalog/_document_split.html.erb_spec.rb +3 -2
  222. data/spec/views/catalog/_index_split.html.erb_spec.rb +3 -2
  223. data/spec/views/catalog/_results_pagination.html.erb_spec.rb +5 -4
  224. data/spec/views/catalog/_show_downloads.html.erb_spec.rb +11 -10
  225. data/spec/views/catalog/_show_tools.html.erb_spec.rb +13 -12
  226. data/template.rb +9 -8
  227. metadata +40 -216
  228. data/.gitmodules +0 -0
  229. data/.rubocop.yml +0 -111
  230. data/.rubocop_todo.yml +0 -437
  231. data/config/initializers/new_gbl_settings_defaults_3_4.yml +0 -6
  232. /data/app/assets/images/blacklight/{berkeley.svg → university-of-california-berkeley.svg} +0 -0
@@ -1,261 +1,262 @@
1
1
  # frozen_string_literal: true
2
- require 'spec_helper'
2
+
3
+ require "spec_helper"
3
4
 
4
5
  describe GeoblacklightHelper, type: :helper do
5
6
  include BlacklightHelper
6
7
  include ActionView::Helpers::UrlHelper
7
8
  include ActionView::Helpers::TranslationHelper
8
9
 
9
- describe '#geoblacklight_icon' do
10
- it 'supports in use cases' do
10
+ describe "#geoblacklight_icon" do
11
+ it "supports in use cases" do
11
12
  {
12
- 'Paper map' => 'paper-map',
13
- 'Michigan State' => 'michigan-state',
14
- 'CD ROM' => 'cd-rom',
15
- 'Lewis & Clark' => 'lewis-clark'
13
+ "Paper map" => "paper-map",
14
+ "Michigan State" => "michigan-state",
15
+ "CD ROM" => "cd-rom",
16
+ "Lewis & Clark" => "lewis-clark"
16
17
  }.each_key do |key|
17
18
  html = Capybara.string(geoblacklight_icon(key))
18
19
  expect(html).to have_xpath "//*[local-name() = 'svg']"
19
20
  end
20
21
  end
21
- it 'handles nil values' do
22
+ it "handles nil values" do
22
23
  html = Capybara.string(geoblacklight_icon(nil))
23
- expect(html).to have_css '.icon-missing'
24
+ expect(html).to have_css ".icon-missing"
24
25
  end
25
26
  end
26
27
 
27
- describe '#proper_case_format' do
28
- it 'returns a properly cased format' do
29
- expect(proper_case_format('GEOJSON')).to eq 'GeoJSON'
28
+ describe "#proper_case_format" do
29
+ it "returns a properly cased format" do
30
+ expect(proper_case_format("GEOJSON")).to eq "GeoJSON"
30
31
  end
31
32
  end
32
33
 
33
- describe '#download_text' do
34
- it 'returns download text concatenated with proper case format' do
35
- expect(download_text('GEOJSON')).to eq 'Original GeoJSON'
34
+ describe "#download_text" do
35
+ it "returns download text concatenated with proper case format" do
36
+ expect(download_text("GEOJSON")).to eq "Original GeoJSON"
36
37
  end
37
38
  end
38
39
 
39
- describe '#download_text' do
40
- it 'returns download text concatenated with proper case format' do
41
- expect(download_text('GEOJSON')).to eq 'Original GeoJSON'
40
+ describe "#download_text" do
41
+ it "returns download text concatenated with proper case format" do
42
+ expect(download_text("GEOJSON")).to eq "Original GeoJSON"
42
43
  end
43
44
  end
44
45
 
45
- describe '#download_link_file' do
46
- let(:label) { 'Test Link Text' }
47
- let(:id) { 'test-id' }
48
- let(:url) { 'http://example.com/urn:hul.harvard.edu:HARVARD.SDE2.TG10USAIANNH/data.zip' }
46
+ describe "#download_link_file" do
47
+ let(:label) { "Test Link Text" }
48
+ let(:id) { "test-id" }
49
+ let(:url) { "http://example.com/urn:hul.harvard.edu:HARVARD.SDE2.TG10USAIANNH/data.zip" }
49
50
 
50
- it 'generates a link to download the original file' do
51
+ it "generates a link to download the original file" do
51
52
  expect(download_link_file(label, id, url)).to eq '<a contentUrl="http://example.com/urn:hul.harvard.edu:HARVARD.SDE2.TG10USAIANNH/data.zip" data-download="trigger" data-download-type="direct" data-download-id="test-id" href="http://example.com/urn:hul.harvard.edu:HARVARD.SDE2.TG10USAIANNH/data.zip">Test Link Text</a>'
52
53
  end
53
54
  end
54
55
 
55
- describe '#download_link_hgl' do
56
- let(:text) { 'Test Link Text' }
56
+ describe "#download_link_hgl" do
57
+ let(:text) { "Test Link Text" }
57
58
  let(:document) { instance_double(SolrDocument) }
58
59
 
59
60
  before do
60
- allow(document).to receive(:id).and_return('test-id')
61
- allow(document).to receive(:to_s).and_return('test-id')
61
+ allow(document).to receive(:id).and_return("test-id")
62
+ allow(document).to receive(:to_s).and_return("test-id")
62
63
  end
63
64
 
64
- it 'generates a link to the HGL route' do
65
+ it "generates a link to the HGL route" do
65
66
  expect(download_link_hgl(text, document)).to eq '<a data-blacklight-modal="trigger" data-download="trigger" data-download-type="harvard-hgl" data-download-id="test-id" href="/download/hgl/test-id">Test Link Text</a>'
66
67
  end
67
68
  end
68
69
 
69
- describe '#download_link_iiif' do
70
+ describe "#download_link_iiif" do
70
71
  let(:references_field) { Settings.FIELDS.REFERENCES }
71
72
  let(:document_attributes) do
72
73
  {
73
74
  references_field => {
74
- 'http://iiif.io/api/image' => 'https://example.edu/image/info.json'
75
+ "http://iiif.io/api/image" => "https://example.edu/image/info.json"
75
76
  }.to_json
76
77
  }
77
78
  end
78
79
  let(:document) { SolrDocument.new(document_attributes) }
79
80
 
80
81
  before do
81
- allow_any_instance_of(Geoblacklight::Reference).to receive(:to_hash).and_return(iiif: 'https://example.edu/image/info.json')
82
+ allow_any_instance_of(Geoblacklight::Reference).to receive(:to_hash).and_return(iiif: "https://example.edu/image/info.json")
82
83
  end
83
84
 
84
- it 'generates a link to download the JPG file from the IIIF server' do
85
+ it "generates a link to download the JPG file from the IIIF server" do
85
86
  assign(:document, document)
86
87
  expect(helper.download_link_iiif).to eq '<a contentUrl="https://example.edu/image/full/full/0/default.jpg" data-download="trigger" href="https://example.edu/image/full/full/0/default.jpg">Original JPG</a>'
87
88
  end
88
89
  end
89
90
 
90
- describe '#download_link_generated' do
91
- let(:download_type) { 'SHAPEFILE' }
91
+ describe "#download_link_generated" do
92
+ let(:download_type) { "SHAPEFILE" }
92
93
  let(:document) { instance_double(SolrDocument) }
93
94
 
94
95
  before do
95
- allow(document).to receive(:id).and_return('test-id')
96
- allow(document).to receive(:to_s).and_return('test-id')
96
+ allow(document).to receive(:id).and_return("test-id")
97
+ allow(document).to receive(:to_s).and_return("test-id")
97
98
  end
98
99
 
99
- it 'generates a link to download the JPG file from the IIIF server' do
100
+ it "generates a link to download the JPG file from the IIIF server" do
100
101
  # Stub I18n to ensure the link can be customized via `export_` labels.
101
102
  allow(helper).to receive(:t).and_call_original
102
- allow(helper).to receive(:t).with('geoblacklight.download.export_shapefile_link').and_return('Shapefile Export Customization')
103
+ allow(helper).to receive(:t).with("geoblacklight.download.export_shapefile_link").and_return("Shapefile Export Customization")
103
104
  expect(helper.download_link_generated(download_type, document)).to eq '<a data-download-path="/download/test-id?type=SHAPEFILE" data-download="trigger" data-download-type="SHAPEFILE" data-download-id="test-id" href="">Export Shapefile Export Customization</a>'
104
105
  end
105
106
  end
106
107
 
107
- describe '#geoblacklight_basemap' do
108
+ describe "#geoblacklight_basemap" do
108
109
  let(:blacklight_config) { double }
109
- it 'without configuration' do
110
+ it "without configuration" do
110
111
  expect(blacklight_config).to receive(:basemap_provider).and_return(nil)
111
- expect(geoblacklight_basemap).to eq 'positron'
112
+ expect(geoblacklight_basemap).to eq "positron"
112
113
  end
113
- it 'with custom configuration' do
114
- expect(blacklight_config).to receive(:basemap_provider).and_return('positron')
115
- expect(geoblacklight_basemap).to eq 'positron'
114
+ it "with custom configuration" do
115
+ expect(blacklight_config).to receive(:basemap_provider).and_return("positron")
116
+ expect(geoblacklight_basemap).to eq "positron"
116
117
  end
117
118
  end
118
119
 
119
- describe '#iiif_jpg_url' do
120
+ describe "#iiif_jpg_url" do
120
121
  let(:document) { SolrDocument.new(document_attributes) }
121
122
  let(:references_field) { Settings.FIELDS.REFERENCES }
122
123
  let(:document_attributes) do
123
124
  {
124
125
  references_field => {
125
- 'http://iiif.io/api/image' => 'https://example.edu/image/info.json'
126
+ "http://iiif.io/api/image" => "https://example.edu/image/info.json"
126
127
  }.to_json
127
128
  }
128
129
  end
129
130
 
130
- it 'returns JPG download URL when given URL to a IIIF info.json' do
131
+ it "returns JPG download URL when given URL to a IIIF info.json" do
131
132
  assign(:document, document)
132
- expect(helper.iiif_jpg_url).to eq 'https://example.edu/image/full/full/0/default.jpg'
133
+ expect(helper.iiif_jpg_url).to eq "https://example.edu/image/full/full/0/default.jpg"
133
134
  end
134
135
  end
135
136
 
136
- describe '#snippit' do
137
+ describe "#snippit" do
137
138
  let(:document) { SolrDocument.new(document_attributes) }
138
139
  let(:references_field) { Settings.FIELDS.REFERENCES }
139
- context 'as a String' do
140
+ context "as a String" do
140
141
  let(:document_attributes) do
141
142
  {
142
- value: 'This is a really long string that should get truncated when it gets rendered' \
143
- 'in the index view to give a brief description of the contents of a particular document' \
144
- 'indexed into Solr'
143
+ value: "This is a really long string that should get truncated when it gets rendered" \
144
+ "in the index view to give a brief description of the contents of a particular document" \
145
+ "indexed into Solr"
145
146
  }
146
147
  end
147
- it 'truncates longer strings to 150 characters' do
148
+ it "truncates longer strings to 150 characters" do
148
149
  expect(helper.snippit(document).length).to eq 150
149
150
  end
150
- it 'truncated string ends with ...' do
151
- expect(helper.snippit(document)[-3..-1]).to eq '...'
151
+ it "truncated string ends with ..." do
152
+ expect(helper.snippit(document)[-3..]).to eq "..."
152
153
  end
153
154
  end
154
- context 'as an Array' do
155
+ context "as an Array" do
155
156
  let(:document_attributes) do
156
157
  {
157
- value: ['This is a really long string that should get truncated when it gets rendered' \
158
- 'in the index view to give a brief description of the contents of a particular document' \
159
- 'indexed into Solr']
158
+ value: ["This is a really long string that should get truncated when it gets rendered" \
159
+ "in the index view to give a brief description of the contents of a particular document" \
160
+ "indexed into Solr"]
160
161
  }
161
162
  end
162
- it 'truncates longer strings to 150 characters' do
163
+ it "truncates longer strings to 150 characters" do
163
164
  expect(helper.snippit(document).length).to eq 150
164
165
  end
165
- it 'truncated string ends with ...' do
166
- expect(helper.snippit(document)[-3..-1]).to eq '...'
166
+ it "truncated string ends with ..." do
167
+ expect(helper.snippit(document)[-3..]).to eq "..."
167
168
  end
168
169
  end
169
- context 'as a multivalued Array' do
170
+ context "as a multivalued Array" do
170
171
  let(:document_attributes) do
171
172
  {
172
173
  value: %w[short description]
173
174
  }
174
175
  end
175
- it 'uses both values' do
176
- expect(helper.snippit(document)).to eq 'short description'
176
+ it "uses both values" do
177
+ expect(helper.snippit(document)).to eq "short description"
177
178
  end
178
- it 'does not truncate' do
179
- expect(helper.snippit(document)[-3..-1]).not_to eq '...'
179
+ it "does not truncate" do
180
+ expect(helper.snippit(document)[-3..]).not_to eq "..."
180
181
  end
181
182
  end
182
183
  end
183
184
 
184
- describe '#render_web_services' do
185
- let(:reference) { instance_double(Geoblacklight::Reference, type: 'wms') }
186
- it 'with a reference to a defined partial' do
185
+ describe "#render_web_services" do
186
+ let(:reference) { instance_double(Geoblacklight::Reference, type: "wms") }
187
+ it "with a reference to a defined partial" do
187
188
  expect(helper).to receive(:render)
188
- .with(partial: 'web_services_wms', locals: { reference: reference })
189
+ .with(partial: "web_services_wms", locals: {reference: reference})
189
190
  helper.render_web_services(reference)
190
191
  end
191
- context 'when the partial is missing' do
192
- let(:reference) { instance_double(Geoblacklight::Reference, type: 'iiif') }
192
+ context "when the partial is missing" do
193
+ let(:reference) { instance_double(Geoblacklight::Reference, type: "iiif") }
193
194
 
194
- it 'with a reference to a missing partial' do
195
+ it "with a reference to a missing partial" do
195
196
  expect(helper).to receive(:render)
196
- .with(partial: 'web_services_iiif', locals: { reference: reference })
197
- .and_raise ActionView::MissingTemplate.new({}, '', '', '', '')
197
+ .with(partial: "web_services_iiif", locals: {reference: reference})
198
+ .and_raise ActionView::MissingTemplate.new({}, "", "", "", "")
198
199
  expect(helper).to receive(:render)
199
- .with(partial: 'web_services_default', locals: { reference: reference })
200
+ .with(partial: "web_services_default", locals: {reference: reference})
200
201
  helper.render_web_services(reference)
201
202
  end
202
203
  end
203
204
  end
204
205
 
205
- describe '#leaflet_options' do
206
- it 'returns a hash of options for leaflet' do
206
+ describe "#leaflet_options" do
207
+ it "returns a hash of options for leaflet" do
207
208
  expect(leaflet_options[:VIEWERS][:WMS][:CONTROLS]).to eq(%w[Opacity Fullscreen])
208
209
  end
209
210
  end
210
211
 
211
- describe '#render_value_as_truncate_abstract' do
212
- context 'with multiple values' do
212
+ describe "#render_value_as_truncate_abstract" do
213
+ context "with multiple values" do
213
214
  let(:document) { SolrDocument.new(value: %w[short description]) }
214
- it 'wraps in correct DIV class' do
215
+ it "wraps in correct DIV class" do
215
216
  expect(helper.render_value_as_truncate_abstract(document)).to eq '<div class="truncate-abstract">short description</div>'
216
217
  end
217
218
  end
218
219
  end
219
220
 
220
- describe '#render_transformed_metadata' do
221
+ describe "#render_transformed_metadata" do
221
222
  let(:metadata) { instance_double(Geoblacklight::Metadata::Base) }
222
- context 'with valid XML data' do
223
+ context "with valid XML data" do
223
224
  before do
224
- allow(metadata).to receive(:transform).and_return('<div>test</div>')
225
+ allow(metadata).to receive(:transform).and_return("<div>test</div>")
225
226
  end
226
227
 
227
- it 'renders the partial with metadata content' do
228
+ it "renders the partial with metadata content" do
228
229
  expect(helper).to receive(:render)
229
- .with(partial: 'catalog/metadata/content', locals: { content: '<div>test</div>' })
230
+ .with(partial: "catalog/metadata/content", locals: {content: "<div>test</div>"})
230
231
  helper.render_transformed_metadata(metadata)
231
232
  end
232
233
  end
233
234
 
234
- context 'with valid XML data without an HTML transform' do
235
+ context "with valid XML data without an HTML transform" do
235
236
  before do
236
237
  allow(metadata).to receive(:transform).and_raise(Geoblacklight::MetadataTransformer::TransformError)
237
- allow(metadata).to receive(:to_xml).and_return('<data></data>')
238
+ allow(metadata).to receive(:to_xml).and_return("<data></data>")
238
239
  end
239
240
 
240
- it 'renders the partial with metadata content' do
241
- expect(helper).to receive(:render).with(partial: 'catalog/metadata/markup', locals: { content: '<data></data>' })
241
+ it "renders the partial with metadata content" do
242
+ expect(helper).to receive(:render).with(partial: "catalog/metadata/markup", locals: {content: "<data></data>"})
242
243
  helper.render_transformed_metadata(metadata)
243
244
  end
244
245
  end
245
246
 
246
- context 'without XML data' do
247
+ context "without XML data" do
247
248
  before do
248
249
  allow(metadata).to receive(:transform).and_raise(Geoblacklight::MetadataTransformer::ParseError)
249
250
  end
250
251
 
251
- it 'renders the partial with metadata content' do
252
- expect(helper).to receive(:render).with(partial: 'catalog/metadata/missing')
252
+ it "renders the partial with metadata content" do
253
+ expect(helper).to receive(:render).with(partial: "catalog/metadata/missing")
253
254
  helper.render_transformed_metadata(metadata)
254
255
  end
255
256
  end
256
257
  end
257
258
 
258
- describe '#first_metadata?' do
259
+ describe "#first_metadata?" do
259
260
  let(:metadata) { instance_double(Geoblacklight::Metadata::Base) }
260
261
  let(:references) { instance_double(Geoblacklight::References) }
261
262
  let(:document) { instance_double(SolrDocument) }
@@ -263,96 +264,96 @@ describe GeoblacklightHelper, type: :helper do
263
264
  before do
264
265
  allow(document).to receive(:references).and_return(references)
265
266
  allow(references).to receive(:shown_metadata).and_return([metadata])
266
- allow(metadata).to receive(:type).and_return('fgdc')
267
+ allow(metadata).to receive(:type).and_return("fgdc")
267
268
  end
268
269
 
269
- it 'confirms that a metadata resource is the first item reference' do
270
+ it "confirms that a metadata resource is the first item reference" do
270
271
  expect(helper.first_metadata?(document, metadata)).to be true
271
272
  end
272
273
  end
273
274
 
274
- describe '#show_help_text?' do
275
- let(:feature) { 'viewer_protocol' }
276
- let(:translation_key) { 'wms' }
275
+ describe "#show_help_text?" do
276
+ let(:feature) { "viewer_protocol" }
277
+ let(:translation_key) { "wms" }
277
278
 
278
- it 'confirms help text is available' do
279
+ it "confirms help text is available" do
279
280
  expect(helper.show_help_text?(feature, translation_key)).to be true
280
281
  end
281
282
  end
282
283
 
283
- describe '#render_help_text_entry' do
284
- let(:feature) { 'viewer_protocol' }
285
- let(:translation_key) { 'wms' }
284
+ describe "#render_help_text_entry" do
285
+ let(:feature) { "viewer_protocol" }
286
+ let(:translation_key) { "wms" }
286
287
 
287
- context 'valid entry' do
288
- it 'renders help text entry for the wms viewer protocol' do
288
+ context "valid entry" do
289
+ it "renders help text entry for the wms viewer protocol" do
289
290
  expect(helper.render_help_text_entry(feature, translation_key)).to eq '<h3 class="help-text viewer_protocol h6"><a data-toggle="popover" data-title="Web Map Service (WMS)" data-content="A Web Map Service displays a geospatial dataset as map images.">Web Map Service (WMS)</a></h3>'
290
291
  end
291
292
  end
292
293
 
293
- context 'invalid entry' do
294
- it 'renders an empty span' do
295
- expect(helper.render_help_text_entry('foo', 'bar')).to eq '<span class="help-text translation-missing"></span>'
294
+ context "invalid entry" do
295
+ it "renders an empty span" do
296
+ expect(helper.render_help_text_entry("foo", "bar")).to eq '<span class="help-text translation-missing"></span>'
296
297
  end
297
298
  end
298
299
  end
299
300
 
300
- describe '#relations_icon' do
301
- context 'when configured to use the geometry type' do
301
+ describe "#relations_icon" do
302
+ context "when configured to use the geometry type" do
302
303
  before do
303
304
  allow(Settings).to receive(:USE_GEOM_FOR_RELATIONS_ICON).and_return(true)
304
305
  end
305
306
 
306
- it 'renders a goemetry type as the icon' do
307
- html = Capybara.string(helper.relations_icon({ Settings.FIELDS.GEOM_TYPE => 'polygon' }, 'leaf'))
308
- expect(html.title.strip).to eq 'Polygon'
307
+ it "renders a goemetry type as the icon" do
308
+ html = Capybara.string(helper.relations_icon({Settings.FIELDS.GEOM_TYPE => "polygon"}, "leaf"))
309
+ expect(html.title.strip).to eq "Polygon"
309
310
  end
310
311
 
311
- it 'has the svg_tooltip class so that the Bootstrap tooltip is applied' do
312
- html = Capybara.string(helper.relations_icon({ Settings.FIELDS.GEOM_TYPE => 'polygon' }, 'leaf'))
313
- expect(html).to have_css('.blacklight-icons.svg_tooltip')
312
+ it "has the svg_tooltip class so that the Bootstrap tooltip is applied" do
313
+ html = Capybara.string(helper.relations_icon({Settings.FIELDS.GEOM_TYPE => "polygon"}, "leaf"))
314
+ expect(html).to have_css(".blacklight-icons.svg_tooltip")
314
315
  end
315
316
  end
316
317
 
317
- context 'when not confiugred to use the geometry type' do
318
+ context "when not confiugred to use the geometry type" do
318
319
  before do
319
320
  allow(Settings).to receive(:USE_GEOM_FOR_RELATIONS_ICON).and_return(false)
320
321
  end
321
322
 
322
- it 'renders the provided icon' do
323
- html = Capybara.string(helper.relations_icon({ Settings.FIELDS.GEOM_TYPE => 'polygon' }, 'leaf'))
324
- expect(html.title.strip).to eq 'Leaf'
323
+ it "renders the provided icon" do
324
+ html = Capybara.string(helper.relations_icon({Settings.FIELDS.GEOM_TYPE => "polygon"}, "leaf"))
325
+ expect(html.title.strip).to eq "Leaf"
325
326
  end
326
327
 
327
- it 'does not have the svg_tooltip class' do
328
- html = Capybara.string(helper.relations_icon({ Settings.FIELDS.GEOM_TYPE => 'polygon' }, 'leaf'))
329
- expect(html).not_to have_css('.blacklight-icons.svg_tooltip')
328
+ it "does not have the svg_tooltip class" do
329
+ html = Capybara.string(helper.relations_icon({Settings.FIELDS.GEOM_TYPE => "polygon"}, "leaf"))
330
+ expect(html).not_to have_css(".blacklight-icons.svg_tooltip")
330
331
  end
331
332
  end
332
333
  end
333
334
 
334
- describe '#results_js_map_selector' do
335
- context 'viewing bookmarks' do
336
- let(:controller_name) { 'bookmarks' }
335
+ describe "#results_js_map_selector" do
336
+ context "viewing bookmarks" do
337
+ let(:controller_name) { "bookmarks" }
337
338
 
338
- it 'returns bookmarks data-map selector' do
339
- expect(results_js_map_selector(controller_name)).to eq 'bookmarks'
339
+ it "returns bookmarks data-map selector" do
340
+ expect(results_js_map_selector(controller_name)).to eq "bookmarks"
340
341
  end
341
342
  end
342
343
 
343
- context 'viewing catalog results' do
344
- let(:controller_name) { 'catalog' }
344
+ context "viewing catalog results" do
345
+ let(:controller_name) { "catalog" }
345
346
 
346
- it 'returns index data-map selector' do
347
- expect(results_js_map_selector(controller_name)).to eq 'index'
347
+ it "returns index data-map selector" do
348
+ expect(results_js_map_selector(controller_name)).to eq "index"
348
349
  end
349
350
  end
350
351
 
351
- context 'calling outside of intended scope' do
352
- let(:controller_name) { 'outside' }
352
+ context "calling outside of intended scope" do
353
+ let(:controller_name) { "outside" }
353
354
 
354
- it 'returns default data-map value' do
355
- expect(results_js_map_selector(controller_name)).to eq 'index'
355
+ it "returns default data-map value" do
356
+ expect(results_js_map_selector(controller_name)).to eq "index"
356
357
  end
357
358
  end
358
359
  end
@@ -1,28 +1,29 @@
1
1
  # frozen_string_literal: true
2
- require 'spec_helper'
2
+
3
+ require "spec_helper"
3
4
 
4
5
  describe Geoblacklight::BoundingBox do
5
- describe '#initialize' do
6
- it 'handles multiple input types as arguments' do
7
- expect(described_class.new('1', '1', '1', '1')).to be_an described_class
6
+ describe "#initialize" do
7
+ it "handles multiple input types as arguments" do
8
+ expect(described_class.new("1", "1", "1", "1")).to be_an described_class
8
9
  expect(described_class.new(1, 2, 3, 3)).to be_an described_class
9
10
  expect(described_class.new(1.1, 2.1, 3.1, 3.1)).to be_an described_class
10
11
  end
11
12
  end
12
- describe '#to_envelope' do
13
+ describe "#to_envelope" do
13
14
  let(:example_box) { described_class.new(-160, -80, 120, 70) }
14
- it 'creates an envelope syntax version of the bounding box' do
15
- expect(example_box.to_envelope).to eq 'ENVELOPE(-160, 120, 70, -80)'
15
+ it "creates an envelope syntax version of the bounding box" do
16
+ expect(example_box.to_envelope).to eq "ENVELOPE(-160, 120, 70, -80)"
16
17
  end
17
18
  end
18
- describe '#from_rectangle' do
19
- let(:example_box) { described_class.from_rectangle('-160 -80 120 70') }
20
- it 'parses and creates a Geoblacklight::BoundingBox from a Solr lat-lon' do
19
+ describe "#from_rectangle" do
20
+ let(:example_box) { described_class.from_rectangle("-160 -80 120 70") }
21
+ it "parses and creates a Geoblacklight::BoundingBox from a Solr lat-lon" do
21
22
  expect(example_box).to be_an described_class
22
- expect(example_box.to_envelope).to eq 'ENVELOPE(-160, 120, 70, -80)'
23
+ expect(example_box.to_envelope).to eq "ENVELOPE(-160, 120, 70, -80)"
23
24
  end
24
- it 'checks for valididity' do
25
- expect { described_class.from_rectangle('-160 -80 120') }.to raise_error Geoblacklight::Exceptions::WrongBoundingBoxFormat
25
+ it "checks for valididity" do
26
+ expect { described_class.from_rectangle("-160 -80 120") }.to raise_error Geoblacklight::Exceptions::WrongBoundingBoxFormat
26
27
  end
27
28
  end
28
29
  end
@@ -1,16 +1,17 @@
1
1
  # frozen_string_literal: true
2
- require 'spec_helper'
2
+
3
+ require "spec_helper"
3
4
 
4
5
  describe Geoblacklight::DocumentPresenter do
5
6
  # Please see https://github.com/projectblacklight/blacklight/blob/v6.15.0/spec/presenters/index_presenter_spec.rb#L4
6
7
  subject { presenter }
7
- let(:request_context) { double(document_index_view_type: 'list') }
8
+ let(:request_context) { double(document_index_view_type: "list") }
8
9
  let(:blacklight_config) do
9
10
  Blacklight::Configuration.new.configure do |config|
10
- config.add_index_field 'gbl_wxsIdentifier_s'
11
- config.add_index_field 'index_display'
12
- config.add_index_field 'period'
13
- config.add_index_field 'multi_display'
11
+ config.add_index_field "gbl_wxsIdentifier_s"
12
+ config.add_index_field "index_display"
13
+ config.add_index_field "period"
14
+ config.add_index_field "multi_display"
14
15
  end
15
16
  end
16
17
  let(:solr_fields) { Settings.FIELDS }
@@ -21,41 +22,41 @@ describe Geoblacklight::DocumentPresenter do
21
22
  let(:document) do
22
23
  SolrDocument.new(
23
24
  id: 1,
24
- gbl_wxsIdentifier_s: 'druid:abc123',
25
- non_index_field: 'do not render',
26
- period: 'Ends with period.',
25
+ gbl_wxsIdentifier_s: "druid:abc123",
26
+ non_index_field: "do not render",
27
+ period: "Ends with period.",
27
28
  multi_display: %w[blue blah]
28
29
  )
29
30
  end
30
31
 
31
- describe '#index_fields_display' do
32
+ describe "#index_fields_display" do
32
33
  let(:rendered_index_text) { subject.index_fields_display }
33
- let(:multi_valued_text) { document['multi_display'].join(' and ') }
34
- let(:combined_fields) { document['gbl_wxsIdentifier_s'] + '. ' + document['period'] }
34
+ let(:multi_valued_text) { document["multi_display"].join(" and ") }
35
+ let(:combined_fields) { document["gbl_wxsIdentifier_s"] + ". " + document["period"] }
35
36
 
36
- context 'with multi-valued field' do
37
- it 'each value is separated by comma' do
37
+ context "with multi-valued field" do
38
+ it "each value is separated by comma" do
38
39
  expect(rendered_index_text).to include(multi_valued_text)
39
40
  end
40
41
  end
41
- context 'with document fields not configured as index field' do
42
- it 'does not render' do
43
- expect(rendered_index_text).not_to include(document['non_index_field'])
42
+ context "with document fields not configured as index field" do
43
+ it "does not render" do
44
+ expect(rendered_index_text).not_to include(document["non_index_field"])
44
45
  end
45
46
  end
46
- context 'with multiple document index fields present' do
47
- it 'separates fields by period followed by a space' do
47
+ context "with multiple document index fields present" do
48
+ it "separates fields by period followed by a space" do
48
49
  expect(rendered_index_text).to include(combined_fields)
49
50
  end
50
- context 'with index field ending in period' do
51
- it 'renders only 1 period' do
52
- expect(rendered_index_text).to include(document['period'] + ' ')
51
+ context "with index field ending in period" do
52
+ it "renders only 1 period" do
53
+ expect(rendered_index_text).to include(document["period"] + " ")
53
54
  end
54
55
  end
55
56
  end
56
- context 'with document empty configured index field' do
57
- it 'does not render a period followed by a space' do
58
- expect(rendered_index_text).not_to include('. .')
57
+ context "with document empty configured index field" do
58
+ it "does not render a period followed by a space" do
59
+ expect(rendered_index_text).not_to include(". .")
59
60
  end
60
61
  end
61
62
  end