geoblacklight 6.0.0.pre.beta.1 → 6.0.0.pre.beta.3

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 (115) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +14 -3
  3. data/app/assets/stylesheets/geoblacklight/record.css +1 -2
  4. data/app/assets/stylesheets/geoblacklight/search.css +3 -4
  5. data/app/assets/stylesheets/geoblacklight.css +0 -1
  6. data/app/components/geoblacklight/document/download_link_component.html.erb +1 -1
  7. data/app/components/geoblacklight/document/download_links_component.html.erb +1 -1
  8. data/app/components/geoblacklight/document/download_links_component.rb +1 -1
  9. data/app/components/geoblacklight/document/preview_component.html.erb +1 -1
  10. data/app/components/geoblacklight/document/preview_component.rb +45 -0
  11. data/app/components/geoblacklight/iiif_drag_drop_component.html.erb +1 -1
  12. data/app/components/geoblacklight/iiif_drag_drop_component.rb +1 -1
  13. data/app/components/geoblacklight/login_link_component.html.erb +1 -1
  14. data/app/components/geoblacklight/login_link_component.rb +17 -1
  15. data/app/components/geoblacklight/metadata_description_markdown_component.rb +1 -1
  16. data/app/components/geoblacklight/relations/relation_component.html.erb +2 -4
  17. data/app/components/geoblacklight/relations/relation_component.rb +0 -4
  18. data/app/components/geoblacklight/search_result_component.html.erb +2 -4
  19. data/app/components/geoblacklight/search_result_component.rb +0 -3
  20. data/app/components/geoblacklight/static_map_component.rb +2 -3
  21. data/app/controllers/relations_controller.rb +2 -0
  22. data/app/controllers/viewer_record_controller.rb +2 -0
  23. data/app/helpers/geoblacklight_helper.rb +5 -19
  24. data/app/javascript/geoblacklight/controllers/overview_map_controller.js +4 -3
  25. data/app/javascript/geoblacklight/core.js +0 -2
  26. data/app/javascript/geoblacklight/initializers/field_truncation.js +1 -4
  27. data/app/models/concerns/geoblacklight/bbox_filter_field.rb +0 -13
  28. data/app/models/concerns/geoblacklight/solr_document/preview.rb +58 -0
  29. data/app/models/concerns/geoblacklight/solr_document.rb +20 -23
  30. data/app/views/catalog/_document_split.html.erb +1 -1
  31. data/config/importmap.rb +5 -6
  32. data/geoblacklight.gemspec +1 -1
  33. data/lib/generators/geoblacklight/install_generator.rb +3 -6
  34. data/lib/generators/geoblacklight/templates/assets/customizations.css +13 -4
  35. data/lib/generators/geoblacklight/templates/catalog_controller.rb +4 -6
  36. data/lib/generators/geoblacklight/templates/settings.yml +1 -25
  37. data/lib/geoblacklight/configuration/settings_builder.rb +0 -2
  38. data/lib/geoblacklight/configuration.rb +1 -19
  39. data/lib/geoblacklight/constants.rb +1 -0
  40. data/lib/geoblacklight/references.rb +0 -9
  41. data/lib/geoblacklight/version.rb +1 -1
  42. data/lib/geoblacklight.rb +0 -1
  43. data/spec/components/geoblacklight/citation_component_spec.rb +2 -2
  44. data/spec/components/geoblacklight/{item_map_viewer_component_spec.rb → document/preview_component_spec.rb} +37 -1
  45. data/spec/components/geoblacklight/document/sidebar_component_spec.rb +1 -1
  46. data/spec/components/geoblacklight/document_component_spec.rb +1 -1
  47. data/spec/components/geoblacklight/download_links_component_spec.rb +1 -1
  48. data/spec/components/geoblacklight/iiif_drag_drop_component_spec.rb +7 -7
  49. data/spec/components/geoblacklight/login_link_component_spec.rb +20 -12
  50. data/spec/components/geoblacklight/relations/relation_component_spec.rb +3 -11
  51. data/spec/components/geoblacklight/search_result_component_spec.rb +4 -12
  52. data/spec/components/geoblacklight/static_map_component_spec.rb +19 -10
  53. data/spec/factories/user.rb +6 -1
  54. data/spec/features/axe_spec.rb +1 -0
  55. data/spec/features/restricted_viewer_spec.rb +1 -3
  56. data/spec/features/search_results_map_spec.rb +13 -0
  57. data/spec/features/search_spec.rb +1 -1
  58. data/spec/features/sign_in_spec.rb +26 -0
  59. data/spec/features/truncated_metadata_spec.rb +0 -5
  60. data/spec/fixtures/solr_documents/README.md +63 -57
  61. data/spec/fixtures/solr_documents/b1g_iiif_manifest.json +1 -1
  62. data/spec/fixtures/solr_documents/baruch_documentation_download.json +1 -0
  63. data/spec/fixtures/solr_documents/bbox-spans-180.json +3 -3
  64. data/spec/fixtures/solr_documents/bluemarble.json +28 -0
  65. data/spec/fixtures/solr_documents/complex-geom.json +3 -3
  66. data/spec/fixtures/solr_documents/cornell-roads-fgdc.json +19 -0
  67. data/spec/fixtures/solr_documents/dalian.json +38 -0
  68. data/spec/fixtures/solr_documents/esri-tiled_map_layer.json +1 -1
  69. data/spec/fixtures/solr_documents/iiif-eastern-hemisphere.json +2 -2
  70. data/spec/fixtures/solr_documents/metadata_no_provider.json +0 -1
  71. data/spec/fixtures/solr_documents/modis-ndvi.json +36 -0
  72. data/spec/fixtures/solr_documents/panama.json +37 -0
  73. data/spec/fixtures/solr_documents/public_cog_princeton.json +0 -2
  74. data/spec/fixtures/solr_documents/stanford-geojson.json +39 -0
  75. data/spec/fixtures/solr_documents/usgs-htmc-index-ca-24000.json +36 -0
  76. data/spec/fixtures/solr_documents/usgs-tnm-index-dem1.json +28 -0
  77. data/spec/helpers/geoblacklight_helper_spec.rb +0 -32
  78. data/spec/lib/geoblacklight/references_spec.rb +8 -14
  79. data/spec/models/concerns/geoblacklight/bbox_filter_field_spec.rb +0 -24
  80. data/spec/models/concerns/geoblacklight/solr_document_spec.rb +30 -23
  81. data/spec/requests/bookmarks_spec.rb +1 -0
  82. data/spec/requests/catalog_search_spec.rb +1 -1
  83. data/spec/requests/catalog_show_spec.rb +2 -2
  84. data/spec/requests/index_view_spec.rb +6 -6
  85. data/spec/requests/metadata_spec.rb +1 -1
  86. data/spec/requests/missing_metadata_spec.rb +13 -13
  87. data/spec/requests/search_results_spec.rb +4 -3
  88. data/spec/requests/viewer_record_spec.rb +1 -3
  89. data/spec/requests/viewer_requests_spec.rb +3 -5
  90. data/spec/spec_helper.rb +11 -1
  91. data/spec/support/authentication.rb +37 -0
  92. data/spec/support/features/session_helpers.rb +15 -13
  93. data/spec/test_app_templates/lib/generators/test_app_generator.rb +1 -1
  94. data/template.rb +1 -1
  95. metadata +17 -26
  96. data/app/assets/stylesheets/geoblacklight/index_maps.css +0 -29
  97. data/app/components/geoblacklight/item_map_viewer_component.html.erb +0 -1
  98. data/app/components/geoblacklight/item_map_viewer_component.rb +0 -52
  99. data/app/controllers/wms_controller.rb +0 -17
  100. data/app/javascript/geoblacklight/initializers/tooltips.js +0 -51
  101. data/app/models/concerns/geoblacklight/solr_document/inspection.rb +0 -17
  102. data/lib/geoblacklight/geometry.rb +0 -86
  103. data/lib/geoblacklight/item_viewer.rb +0 -84
  104. data/lib/geoblacklight/routes/wms.rb +0 -15
  105. data/lib/geoblacklight/wms_layer/feature_info_response.rb +0 -37
  106. data/lib/geoblacklight/wms_layer.rb +0 -34
  107. data/spec/controllers/wms_controller_spec.rb +0 -34
  108. data/spec/fixtures/solr_documents/no_locn_geometry.json +0 -17
  109. data/spec/fixtures/solr_documents/no_spatial.json +0 -28
  110. data/spec/javascripts/metadata_download_button_spec.js +0 -17
  111. data/spec/lib/geoblacklight/geometry_spec.rb +0 -60
  112. data/spec/lib/geoblacklight/item_viewer_spec.rb +0 -77
  113. data/spec/lib/geoblacklight/wms_layer/feature_info_response_spec.rb +0 -54
  114. data/spec/lib/geoblacklight/wms_layer_spec.rb +0 -115
  115. data/spec/models/concerns/geoblacklight/solr_document/inspection_spec.rb +0 -19
@@ -0,0 +1,39 @@
1
+ {
2
+ "id": "stanford-rv900sk6861",
3
+ "dct_title_s": "Home Owners' Loan Corporation Graded Neighborhoods, United States, 1935 [GeoJSON]",
4
+ "dct_description_sm": [
5
+ "GeoJSON containing digitized polygons showing graded neighborhoods as designated by the Home Owners' Loan Corporation (HOLC) in 1935. Polygons were digitized from georeferenced HOLC Maps. The HOLC was established in 1933 by the U.S Congress to refinance mortgages in default and prevent foreclosures. In 1935 they created residential security maps for 239 cities to indicate the level of security for real-estate investments. The maps were graded such as the newest areas, which were considered desirable for lending received a \"Type A\" grade. These areas were primarily wealthy suburbs on the outskirts of town. Still Desirable neighborhoods were given a \"Type B\" grade and older neighborhoods were given a \"Type C\" grade and considered Declining. Lastly \"Type D\" neighborhoods were regarded as most risky for mortgage lending.",
6
+ "This dataset is part of the Mapping Inequality project. Mapping Inequality brings one of the country's most important archives to the public. HOLC's documents contain a wealth of information about how government officials, lenders, and real estate interests surveyed and ensured the economic health of American cities. And with the help of ongoing research, we continue to learn at what cost such measures were realized"
7
+ ],
8
+ "dct_language_sm": ["eng"],
9
+ "dct_creator_sm": ["University of Richmond. Digital Scholarship Lab"],
10
+ "dct_publisher_sm": ["University of Richmond. Digital Scholarship Lab"],
11
+ "dct_issued_s": "2021",
12
+ "dct_subject_sm": [
13
+ "Discrimination in mortgage loans",
14
+ "Home Owners' Loan Corporation",
15
+ "Boundaries",
16
+ "Planning and Cadastral"
17
+ ],
18
+ "dct_spatial_sm": ["United States"],
19
+ "dcat_theme_sm": ["Boundaries", "Property"],
20
+ "dct_temporal_sm": ["1935"],
21
+ "gbl_dateRange_drsim": ["[1935 TO 1935]"],
22
+ "gbl_indexYear_im": [1935],
23
+ "schema_provider_s": "Stanford",
24
+ "dct_identifier_sm": ["https://purl.stanford.edu/rv900sk6861"],
25
+ "gbl_resourceClass_sm": ["Datasets"],
26
+ "gbl_resourceType_sm": ["Polygon data"],
27
+ "dct_format_s": "GeoJSON",
28
+ "locn_geometry": "ENVELOPE(-122.767500, -70.949167, 47.722500, 25.705278)",
29
+ "dcat_bbox": "ENVELOPE(-122.767500, -70.949167, 47.722500, 25.705278)",
30
+ "pcdm_memberOf_sm": ["stanford-vq093gx9796"],
31
+ "dct_rights_sm": [
32
+ "You are free to share (copy and redistribute the material in any medium or format), adapt (remix, transform, and build upon the material) for any purpose, even commercially. The licensor cannot revoke these freedoms as long as you follow the license terms. You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use. You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits. http://creativecommons.org/licenses/by/4.0/"
33
+ ],
34
+ "dct_license_sm": ["https://creativecommons.org/licenses/by/4.0/legalcode"],
35
+ "dct_accessRights_s": "Public",
36
+ "gbl_mdModified_dt": "2026-07-24T21:00:59Z",
37
+ "gbl_mdVersion_s": "Aardvark",
38
+ "dct_references_s": "{\"http://schema.org/url\":\"https://purl.stanford.edu/rv900sk6861\",\"https://schema.org/relatedLink\":\"https://searchworks.stanford.edu/view/rv900sk6861\",\"http://geojson.org/geojson-spec.html\":\"https://stacks.stanford.edu/file/druid:rv900sk6861/fullDownload.geojson\",\"http://schema.org/downloadUrl\":[{\"url\":\"https://stacks.stanford.edu/object/rv900sk6861.zip\",\"label\":\"Zipped object\"}]}"
39
+ }
@@ -0,0 +1,36 @@
1
+ {
2
+ "id": "usgs-htmc-index-ca-24000",
3
+ "dct_title_s": "Index to USGS 1:24000-scale Quadrangles of California",
4
+ "dct_description_sm": [
5
+ "Outlines of the USGS topographic maps at 1:24,000 scale that cover California, from the Historical Topographic Map Collection: 10,486 maps of 2,960 sheets, dated 1904 to 2004.",
6
+ "Each map is outlined separately, so a sheet's editions and printings overlap, with the latest on top. Each outline gives the map's record ID and links to its GeoTIFF, thumbnail and ScienceBase page."
7
+ ],
8
+ "dct_temporal_sm": ["1904-2004"],
9
+ "gbl_indexYear_im": [
10
+ 1904, 1905, 1906, 1907, 1908, 1909, 1910, 1911, 1912, 1913, 1914, 1915, 1916, 1917, 1918, 1919, 1920, 1921, 1922,
11
+ 1923, 1924, 1925, 1926, 1927, 1928, 1929, 1930, 1931, 1932, 1933, 1934, 1935, 1936, 1937, 1938, 1939, 1940, 1941,
12
+ 1942, 1943, 1944, 1945, 1946, 1947, 1948, 1949, 1950, 1951, 1952, 1953, 1954, 1955, 1956, 1957, 1958, 1959, 1960,
13
+ 1961, 1962, 1963, 1964, 1965, 1966, 1967, 1968, 1969, 1970, 1971, 1972, 1973, 1974, 1975, 1976, 1977, 1978, 1979,
14
+ 1980, 1981, 1982, 1983, 1984, 1985, 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
15
+ 1999, 2000, 2001, 2002, 2003, 2004
16
+ ],
17
+ "gbl_dateRange_drsim": ["[1904 TO 2004]"],
18
+ "dct_spatial_sm": ["California"],
19
+ "dct_language_sm": ["eng"],
20
+ "schema_provider_s": "U.S. Geological Survey",
21
+ "gbl_resourceClass_sm": ["Maps"],
22
+ "gbl_resourceType_sm": ["Index maps", "Topographic maps"],
23
+ "dcat_keyword_sm": ["Historical Topographic Maps"],
24
+ "dct_format_s": "GeoJSON",
25
+ "locn_geometry": "ENVELOPE(-124.5, -114.125, 42.125, 32.5)",
26
+ "dcat_bbox": "ENVELOPE(-124.5, -114.125, 42.125, 32.5)",
27
+ "pcdm_memberOf_sm": ["usgs-htmc"],
28
+ "dct_rights_sm": [
29
+ "This index map is dedicated to the public domain under CC0 1.0. The maps it outlines are in the U.S. Public Domain."
30
+ ],
31
+ "dct_license_sm": ["https://creativecommons.org/publicdomain/zero/1.0/"],
32
+ "dct_accessRights_s": "Public",
33
+ "gbl_mdModified_dt": "2022-11-19T00:00:00Z",
34
+ "gbl_mdVersion_s": "Aardvark",
35
+ "dct_references_s": "{\"https://openindexmaps.org\":\"https://raw.githubusercontent.com/OpenGeoMetadata/gov.usgs.htmc/main/index-maps/htmc/usgs-htmc-index-ca-24000.geojson\",\"http://schema.org/downloadUrl\":[{\"url\":\"https://raw.githubusercontent.com/OpenGeoMetadata/gov.usgs.htmc/main/index-maps/htmc/usgs-htmc-index-ca-24000.geojson\",\"label\":\"GeoJSON (7.5 MB)\"}]}"
36
+ }
@@ -0,0 +1,28 @@
1
+ {
2
+ "id": "usgs-tnm-index-dem1",
3
+ "dct_title_s": "Index to USGS 3DEP 1 Arc-Second DEM Tiles",
4
+ "dct_creator_sm": ["Geological Survey (U.S.)"],
5
+ "dct_publisher_sm": ["Geological Survey (U.S.)"],
6
+ "dct_temporal_sm": ["2013-2026"],
7
+ "gbl_indexYear_im": [2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024, 2025, 2026],
8
+ "gbl_dateRange_drsim": ["[2013 TO 2026]"],
9
+ "dct_spatial_sm": ["United States"],
10
+ "dct_language_sm": ["eng"],
11
+ "schema_provider_s": "U.S. Geological Survey",
12
+ "gbl_resourceClass_sm": ["Maps"],
13
+ "gbl_resourceType_sm": ["Index maps"],
14
+ "dcat_theme_sm": ["Elevation"],
15
+ "dcat_keyword_sm": ["The National Map", "3D Elevation Program"],
16
+ "dct_format_s": "GeoJSON",
17
+ "locn_geometry": "ENVELOPE(133.99833333, -51.99833333, 84.00166667, -15.00166667)",
18
+ "dcat_bbox": "ENVELOPE(133.99833333, -51.99833333, 84.00166667, -15.00166667)",
19
+ "pcdm_memberOf_sm": ["usgs-tnm-dem1"],
20
+ "dct_rights_sm": [
21
+ "This index map is dedicated to the public domain under CC0 1.0. The data it outlines is in the U.S. Public Domain."
22
+ ],
23
+ "dct_license_sm": ["https://creativecommons.org/publicdomain/zero/1.0/"],
24
+ "dct_accessRights_s": "Public",
25
+ "gbl_mdModified_dt": "2026-10-31T02:10:23Z",
26
+ "gbl_mdVersion_s": "Aardvark",
27
+ "dct_references_s": "{\"https://openindexmaps.org\":\"https://raw.githubusercontent.com/OpenGeoMetadata/gov.usgs.tnm/main/index-maps/usgs-tnm-index-dem1.geojson\",\"http://schema.org/downloadUrl\":[{\"url\":\"https://raw.githubusercontent.com/OpenGeoMetadata/gov.usgs.tnm/main/index-maps/usgs-tnm-index-dem1.geojson\",\"label\":\"GeoJSON (2.4 MB)\"}],\"http://www.opengis.net/cat/csw/csdgm\":\"https://www.sciencebase.gov/catalog/file/get/4f70aa71e4b058caae3f8de1?f=__disk__f9%2F14%2F47%2Ff91447e90685efbd560afe5e172568154e56dadb\"}"
28
+ }
@@ -45,12 +45,6 @@ RSpec.describe GeoblacklightHelper, type: :helper do
45
45
  end
46
46
  end
47
47
 
48
- describe "#markdown_to_html" do
49
- it "transforms markdown into HTML" do
50
- expect(helper.markdown_to_html("a **short** description")).to eq "<p>a <strong>short</strong> description</p>\n"
51
- end
52
- end
53
-
54
48
  describe "#geoblacklight_thumbnail" do
55
49
  let(:references_field) { Geoblacklight.configuration.fields.references }
56
50
  let(:document) { SolrDocument.new(document_attributes) }
@@ -148,30 +142,4 @@ RSpec.describe GeoblacklightHelper, type: :helper do
148
142
  end
149
143
  end
150
144
  end
151
-
152
- describe "#results_js_map_selector" do
153
- context "viewing bookmarks" do
154
- let(:controller_name) { "bookmarks" }
155
-
156
- it "returns bookmarks data-page selector" do
157
- expect(results_js_map_selector(controller_name)).to eq "bookmarks"
158
- end
159
- end
160
-
161
- context "viewing catalog results" do
162
- let(:controller_name) { "catalog" }
163
-
164
- it "returns index data-page selector" do
165
- expect(results_js_map_selector(controller_name)).to eq "index"
166
- end
167
- end
168
-
169
- context "calling outside of intended scope" do
170
- let(:controller_name) { "outside" }
171
-
172
- it "returns default data-page value" do
173
- expect(results_js_map_selector(controller_name)).to eq "index"
174
- end
175
- end
176
- end
177
145
  end
@@ -4,11 +4,11 @@ require "spec_helper"
4
4
 
5
5
  RSpec.describe Geoblacklight::References do
6
6
  let(:references_field) { Geoblacklight.configuration.fields.references }
7
- let(:file_format_field) { Geoblacklight.configuration.fields.format }
7
+ let(:format_field) { Geoblacklight.configuration.fields.format }
8
8
  let(:typical_ogp_shapefile) do
9
9
  described_class.new(
10
10
  SolrDocument.new(
11
- file_format_field => "Shapefile",
11
+ format_field => "Shapefile",
12
12
  references_field => {
13
13
  "http://www.opengis.net/def/serviceType/ogc/wms" => "http://hgl.harvard.edu:8080/geoserver/wms",
14
14
  "http://www.opengis.net/def/serviceType/ogc/wfs" => "http://hgl.harvard.edu:8080/geoserver/wfs"
@@ -19,7 +19,7 @@ RSpec.describe Geoblacklight::References do
19
19
  let(:no_service_shapefile) do
20
20
  described_class.new(
21
21
  SolrDocument.new(
22
- file_format_field => "Shapefile",
22
+ format_field => "Shapefile",
23
23
  references_field => {}.to_json
24
24
  )
25
25
  )
@@ -27,7 +27,7 @@ RSpec.describe Geoblacklight::References do
27
27
  let(:typical_ogp_geotiff) do
28
28
  described_class.new(
29
29
  SolrDocument.new(
30
- file_format_field => "GeoTIFF",
30
+ format_field => "GeoTIFF",
31
31
  references_field => {
32
32
  "http://www.opengis.net/def/serviceType/ogc/wms" => "http://hgl.harvard.edu:8080/geoserver/wms",
33
33
  "http://www.opengis.net/def/serviceType/ogc/wfs" => "http://hgl.harvard.edu:8080/geoserver/wfs"
@@ -38,7 +38,7 @@ RSpec.describe Geoblacklight::References do
38
38
  let(:typical_arcgrid) do
39
39
  described_class.new(
40
40
  SolrDocument.new(
41
- file_format_field => "ArcGRID",
41
+ format_field => "ArcGRID",
42
42
  references_field => {
43
43
  "http://www.opengis.net/def/serviceType/ogc/wms" => "http://hgl.harvard.edu:8080/geoserver/wms",
44
44
  "http://www.opengis.net/def/serviceType/ogc/wfs" => "http://hgl.harvard.edu:8080/geoserver/wfs"
@@ -49,7 +49,7 @@ RSpec.describe Geoblacklight::References do
49
49
  let(:complex_shapefile) do
50
50
  described_class.new(
51
51
  SolrDocument.new(
52
- file_format_field => "Shapefile",
52
+ format_field => "Shapefile",
53
53
  references_field => {
54
54
  "http://schema.org/downloadUrl" => "http://example.com/urn:hul.harvard.edu:HARVARD.SDE2.TG10USAIANNH/data.zip",
55
55
  "http://www.isotc211.org/schemas/2005/gmd/" => "http://example.com/urn:hul.harvard.edu:HARVARD.SDE2.TG10USAIANNH/iso19139.xml",
@@ -64,7 +64,7 @@ RSpec.describe Geoblacklight::References do
64
64
  let(:direct_download_only) do
65
65
  described_class.new(
66
66
  SolrDocument.new(
67
- file_format_field => "GeoTIFF",
67
+ format_field => "GeoTIFF",
68
68
  references_field => {
69
69
  "http://schema.org/downloadUrl" => "http://example.com/layer-id-geotiff.tiff"
70
70
  }.to_json
@@ -74,7 +74,7 @@ RSpec.describe Geoblacklight::References do
74
74
  let(:simple_iiif_image) do
75
75
  described_class.new(
76
76
  SolrDocument.new(
77
- file_format_field => "Raster",
77
+ format_field => "Raster",
78
78
  references_field => {
79
79
  "http://schema.org/url" => "http://arks.princeton.edu/ark:/88435/02870w62c",
80
80
  "http://iiif.io/api/image" => "https://iiif-cloud.princeton.edu/iiif/2/6c%2F52%2F12%2F6c5212e81bc845f59bb1cdc740a88bad%2Fintermediate_file/info.json"
@@ -128,12 +128,6 @@ RSpec.describe Geoblacklight::References do
128
128
  expect(custom_fields.reference_field).to eq :new_ref_field
129
129
  end
130
130
  end
131
- describe "format" do
132
- it "returns format" do
133
- expect(complex_shapefile.format).to eq "Shapefile"
134
- expect(direct_download_only.format).to eq "GeoTIFF"
135
- end
136
- end
137
131
  describe "refs" do
138
132
  it "is a set of enumberable references" do
139
133
  complex_shapefile.refs.each do |reference|
@@ -13,7 +13,6 @@ RSpec.describe Geoblacklight::BboxFilterField do
13
13
  config.add_facet_field "bbox", filter_class: described_class
14
14
  end
15
15
  end
16
- let(:facet_config) { blacklight_config.facet_fields["bbox"] }
17
16
  let(:controller) { double }
18
17
 
19
18
  describe "#add" do
@@ -59,29 +58,6 @@ RSpec.describe Geoblacklight::BboxFilterField do
59
58
  expect(filter.values.first).to be_a(Geoblacklight::BoundingBox).and(have_attributes(to_param: bbox_value))
60
59
  end
61
60
  end
62
-
63
- describe "#needs_normalization?" do
64
- it "returns false for the expected keyed representation of the bounding box" do
65
- expect(filter.needs_normalization?(search_state.params)).to be false
66
- end
67
- end
68
-
69
- context "when array param represented by facebook as a Hash" do
70
- let(:filter) { described_class.new(facet_config, search_state) }
71
- let(:params) { {bbox: {"0" => bbox_value}} }
72
-
73
- describe "#normalize" do
74
- it "converts the parameters to a list" do
75
- expect(filter.normalize(search_state.params[:bbox])).to eql [bbox_value]
76
- end
77
- end
78
-
79
- describe "#needs_normalization?" do
80
- it "returns true for the hash-as-array keyed representation of the bounding box" do
81
- expect(filter.needs_normalization?(search_state.params[:bbox])).to be true
82
- end
83
- end
84
- end
85
61
  end
86
62
 
87
63
  context "with a malformed bbox" do
@@ -185,46 +185,53 @@ RSpec.describe Geoblacklight::SolrDocument do
185
185
  end
186
186
  end
187
187
  end
188
- describe "item_viewer" do
189
- let(:document_attributes) { {} }
190
- it "is a ItemViewer" do
191
- expect(document.item_viewer).to be_an Geoblacklight::ItemViewer
188
+ describe "#previewable?" do
189
+ describe "with an oembed reference" do
190
+ let(:document_attributes) { JSON.parse(read_fixture("solr_documents/oembed.json")) }
191
+ it "is previewable" do
192
+ expect(document.previewable?).to be true
193
+ end
192
194
  end
193
- end
194
- describe "viewer_protocol" do
195
- describe "with a wms reference" do
195
+
196
+ describe "when there is only a IIIF reference" do
197
+ let(:document_attributes) { JSON.parse(read_fixture("solr_documents/public_iiif_princeton.json")) }
198
+ it "is true" do
199
+ expect(document.previewable?).to be true
200
+ end
201
+ end
202
+
203
+ describe "without any preview reference" do
196
204
  let(:document_attributes) do
197
205
  {
198
206
  references_field => {
199
- "http://www.opengis.net/def/serviceType/ogc/wms" => "http://www.example.com/wms"
207
+ "http://schema.org/url" => "http://www.example.com/landing-page"
200
208
  }.to_json
201
209
  }
202
210
  end
203
- it "returns wms protocol" do
204
- expect(document.viewer_protocol).to eq "wms"
211
+ it "is not previewable" do
212
+ expect(document.previewable?).to be false
205
213
  end
206
214
  end
207
- let(:document_attributes) { {} }
208
- it "returns no protocol" do
209
- expect(document.viewer_protocol).to be nil
210
- end
211
215
  end
212
- describe "viewer_endpoint" do
213
- describe "with a wms reference" do
216
+ describe "#iiif_previewable?" do
217
+ describe "when there is only a IIIF reference" do
218
+ let(:document_attributes) { JSON.parse(read_fixture("solr_documents/public_iiif_princeton.json")) }
219
+ it "is true" do
220
+ expect(document.iiif_previewable?).to be true
221
+ end
222
+ end
223
+ describe "with both a IIIF reference and a map reference" do
214
224
  let(:document_attributes) do
215
225
  {
216
226
  references_field => {
217
- "http://www.opengis.net/def/serviceType/ogc/wms" => "http://www.example.com/wms"
227
+ "http://iiif.io/api/image" => "http://www.example.com/info.json",
228
+ "urn:x-esri:serviceType:ArcGIS#FeatureLayer" => "http://www.example.com/FeatureServer/0"
218
229
  }.to_json
219
230
  }
220
231
  end
221
- it "returns wms endpoint" do
222
- expect(document.viewer_endpoint).to eq "http://www.example.com/wms"
232
+ it "is true" do
233
+ expect(document.iiif_previewable?).to be true
223
234
  end
224
235
  end
225
- let(:document_attributes) { {} }
226
- it "returns no endpoint" do
227
- expect(document.viewer_endpoint).to eq ""
228
- end
229
236
  end
230
237
  end
@@ -4,6 +4,7 @@ require "spec_helper"
4
4
 
5
5
  RSpec.describe "Bookmarks", type: :request do
6
6
  it "lists a newly created bookmark" do
7
+ skip_without_authentication
7
8
  post bookmarks_path, params: {id: "berkeley-s7pq31"}
8
9
  get bookmarks_path
9
10
 
@@ -38,6 +38,6 @@ RSpec.describe "Catalog search", type: :request do
38
38
 
39
39
  documents = response_page.all(".document")
40
40
  expect(documents.first["data-document-id"]).to eq("02236876-9c21-42f6-9870-d2562da8e44f")
41
- expect(documents.last["data-document-id"]).to eq("05d-03-nogeomtype")
41
+ expect(documents.last["data-document-id"]).to eq("05d-p16022coll246-nogeo")
42
42
  end
43
43
  end
@@ -28,8 +28,8 @@ RSpec.describe "Catalog show page", type: :request do
28
28
  get solr_document_path("stanford-dp018hs9766")
29
29
 
30
30
  metadata = response_page.find(".document-metadata")
31
- expect(metadata).to have_css("dt", count: 16)
32
- expect(metadata).to have_css("dd:not(.read-more-slot)", count: 20)
31
+ expect(metadata).to have_css("dt", count: 15)
32
+ expect(metadata).to have_css("dd:not(.read-more-slot)", count: 19)
33
33
  expect(metadata).to have_css("div.truncate-abstract", count: 1)
34
34
  end
35
35
 
@@ -10,8 +10,7 @@ RSpec.describe "Catalog index view", type: :request do
10
10
  end
11
11
 
12
12
  it "renders documents and the map container" do
13
- expect(response_page).to have_css("#documents")
14
- expect(response_page).to have_css(".document", count: 4)
13
+ expect(response_page).to have_css("#documents .document")
15
14
  expect(response_page).to have_css("#overview-map")
16
15
  end
17
16
 
@@ -21,13 +20,14 @@ RSpec.describe "Catalog index view", type: :request do
21
20
 
22
21
  expect(overview_results.pluck("id")).to eq rows.map { |row| row["data-map-id"] }
23
22
  expect(overview_results.pluck("place")).to eq rows.map { |row| row["data-document-counter"].to_i }
24
- expect(overview_results.pluck("geometry")).to all(include("type"))
23
+ expect(overview_results.pluck("geometry")).to all(start_with("ENVELOPE("))
25
24
  end
26
25
 
27
26
  it "gives the map the number shown beside each result, so both count the same way" do
28
- expect(response_page).to have_css(".document[data-document-counter]", count: 4)
29
- expect(response_page.all(".document").map { |result| result["data-document-counter"] })
30
- .to eq %w[1 2 3 4]
27
+ counters = response_page.all(".document").map { |result| result["data-document-counter"] }
28
+
29
+ expect(counters.length).to be > 1
30
+ expect(counters).to eq (1..counters.length).map(&:to_s)
31
31
  end
32
32
 
33
33
  context "on the second page of results" do
@@ -11,7 +11,7 @@ RSpec.describe "Metadata", type: :request do
11
11
 
12
12
  before do
13
13
  allow(Faraday).to receive(:new).and_call_original
14
- stub_metadata_request("http://purl.stanford.edu/bc576pk4911.mods", mods)
14
+ stub_metadata_request("https://purl.stanford.edu/bc576pk4911.mods", mods)
15
15
  stub_metadata_request("https://stacks.stanford.edu/file/druid:bc576pk4911/SANB_a2725322-fgdc.xml", fgdc)
16
16
  stub_metadata_request("https://stacks.stanford.edu/file/druid:bc576pk4911/SANB_a2725322-iso19139.xml", iso19139)
17
17
  get metadata_solr_document_path("stanford-bc576pk4911")
@@ -6,23 +6,23 @@ RSpec.describe "Records with missing metadata", type: :request do
6
6
  let(:response_page) { Capybara.string(response.body) }
7
7
 
8
8
  it "renders search results when spatial metadata is absent" do
9
- get search_catalog_path(q: "ASTER Global Emissivity")
9
+ get search_catalog_path(q: "Ames Library of South Asia Maps")
10
10
 
11
11
  expect(response).to have_http_status(:ok)
12
12
  expect(response_page).to have_css("#overview-map")
13
13
  end
14
14
 
15
- {
16
- "aster-global-emissivity-dataset-1-kilometer-v003-ag1kmcad20" => "WXS identifier and spatial metadata",
17
- "05d-03-noGeomType" => "geometry type",
18
- "99-0001-noprovider" => "provider",
19
- "05d-p16022coll246-noGeo" => "geometry"
20
- }.each do |document_id, missing_value|
21
- it "renders a show page without #{missing_value}" do
22
- get solr_document_path(document_id)
23
-
24
- expect(response).to have_http_status(:ok)
25
- expect(response_page).to have_css("dl.document-metadata")
26
- end
15
+ it "renders a show page when spatial metadata is absent" do
16
+ get solr_document_path("05d-p16022coll246-noGeo")
17
+
18
+ expect(response).to have_http_status(:ok)
19
+ expect(response_page).to have_css("dl.document-metadata")
20
+ end
21
+
22
+ it "renders a show page when there is no provider set" do
23
+ get solr_document_path("99-0001-noprovider")
24
+
25
+ expect(response).to have_http_status(:ok)
26
+ expect(response_page).to have_css("dl.document-metadata")
27
27
  end
28
28
  end
@@ -43,6 +43,7 @@ RSpec.describe "Search results", type: :request do
43
43
  expect(result_ids).to start_with(
44
44
  "e9c71086-6b25-4950-8e1c-84c2794e3382",
45
45
  "2eddde2f-c222-41ca-bd07-2fd74a21f4de",
46
+ "31567cf1-bad8-4bc5-8d57-44b96c207ecc",
46
47
  "02236876-9c21-42f6-9870-d2562da8e44f"
47
48
  )
48
49
  end
@@ -55,8 +56,8 @@ RSpec.describe "Search results", type: :request do
55
56
  f: {Geoblacklight.configuration.fields.provider => ["Cornell"]}
56
57
  )
57
58
 
58
- expect(result_ids.index("cugir-008186")).to be < 4
59
- expect(result_ids.index("cugir-008186-no-downloadurl")).to be < 4
60
- expect(result_ids.index("cugir-007741")).to eq(4)
59
+ expect(result_ids.last).to eq("cugir-007741")
60
+ expect(result_ids.index("cugir-008186")).to be < result_ids.index("cugir-007741")
61
+ expect(result_ids.index("cugir-008186-no-downloadurl")).to be < result_ids.index("cugir-007741")
61
62
  end
62
63
  end
@@ -3,8 +3,6 @@
3
3
  require "spec_helper"
4
4
 
5
5
  RSpec.describe "Viewer record", type: :request do
6
- include Devise::Test::IntegrationHelpers
7
-
8
6
  let(:references) { JSON.parse(response.parsed_body[Geoblacklight.configuration.fields.references]) }
9
7
 
10
8
  # Restricted, and provided by this app's own institution, so signing in makes the difference
@@ -19,7 +17,7 @@ RSpec.describe "Viewer record", type: :request do
19
17
  end
20
18
 
21
19
  it "hands over the same record once that reader signs in" do
22
- sign_in FactoryBot.create(:user)
20
+ sign_in
23
21
  get viewer_solr_document_path(restricted)
24
22
 
25
23
  expect(references.keys).to include("https://github.com/cogeotiff/cog-spec", "http://schema.org/downloadUrl")
@@ -3,8 +3,6 @@
3
3
  require "spec_helper"
4
4
 
5
5
  RSpec.describe "Viewer requests", type: :request do
6
- include Devise::Test::IntegrationHelpers
7
-
8
6
  let(:origins) { ["https://stacks.stanford.edu/"] }
9
7
 
10
8
  # Restricted, and provided by this app's own institution, so signing in makes the difference
@@ -22,7 +20,7 @@ RSpec.describe "Viewer requests", type: :request do
22
20
  end
23
21
 
24
22
  it "names the services a signed-in reader's requests need to carry cookies to" do
25
- sign_in FactoryBot.create(:user)
23
+ sign_in
26
24
  get solr_document_path(restricted)
27
25
 
28
26
  expect(JSON.parse(restricted_origins)).to eq origins
@@ -35,7 +33,7 @@ RSpec.describe "Viewer requests", type: :request do
35
33
  end
36
34
 
37
35
  it "names none for a public record, which has nothing that needs authorizing" do
38
- sign_in FactoryBot.create(:user)
36
+ sign_in
39
37
  get solr_document_path("berkeley-s7pq31")
40
38
 
41
39
  expect(restricted_origins).to be_nil
@@ -45,7 +43,7 @@ RSpec.describe "Viewer requests", type: :request do
45
43
  let(:origins) { [] }
46
44
 
47
45
  it "names none" do
48
- sign_in FactoryBot.create(:user)
46
+ sign_in
49
47
  get solr_document_path(restricted)
50
48
 
51
49
  expect(restricted_origins).to be_nil
data/spec/spec_helper.rb CHANGED
@@ -44,6 +44,11 @@ Capybara.register_driver :chrome_headless do |app|
44
44
  options.add_argument("--disable-gpu")
45
45
  options.add_argument("--no-sandbox")
46
46
  options.add_argument("--window-size=1280,1024")
47
+ # Scroll without animating. Bootstrap puts `scroll-behavior: smooth` on :root, so when
48
+ # ChromeDriver sets scrollTop to bring an element into view before clicking it, the page only
49
+ # starts to move and ChromeDriver reads back the element's old, off-screen position. The click
50
+ # then fails and is left to Capybara's retry, which a busy page can outlast.
51
+ options.add_argument("--disable-smooth-scrolling")
47
52
  # Software WebGL, which the viewer and the overview map both need: they draw with MapLibre, and
48
53
  # headless Chrome has no GPU to give them. SwiftShader is Chrome's own CPU renderer, and since
49
54
  # Chrome 128 it has to be asked for by name before WebGL will fall back to it at all.
@@ -54,6 +59,11 @@ Capybara.register_driver :chrome_headless do |app|
54
59
  # layers from external hosts; in CI those requests can hang and prevent
55
60
  # `load` from ever firing, causing Net::ReadTimeout on #visit.
56
61
  options.page_load_strategy = :eager
62
+ # Don't check the password the specs sign in with against Google's list of breached passwords.
63
+ # It is on that list ("password"), so a moment after a sign-in Chrome puts its "Change your
64
+ # password" dialog over the tab. Nothing on screen shows it in headless Chrome, but it
65
+ # steals clicks from other elements in the page, which makes specs intermittently fail.
66
+ options.add_preference("profile.password_manager_leak_detection", false)
57
67
 
58
68
  # Allow longer TCP reads to prevent timeout in the case of loading fixture
59
69
  # eee6150b-ce2f-4837-9d17-ce72a0c1c26f, as part of relations_spec.rb
@@ -77,6 +87,6 @@ RSpec.configure do |config|
77
87
 
78
88
  config.use_transactional_fixtures = true
79
89
 
80
- config.include Devise::Test::ControllerHelpers, type: :controller
90
+ config.include Devise::Test::ControllerHelpers, type: :controller if defined?(Devise)
81
91
  config.include ViewComponent::TestHelpers, type: :component
82
92
  end
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ # The app can be generated using Devise auth, Rails auth, or no auth. These
4
+ # are for signing in and/or skipping tests depending on which is the case.
5
+ module AuthenticationHelpers
6
+ # :devise, :rails, or nil if the app has no authentication
7
+ def self.provider
8
+ if defined?(Devise)
9
+ :devise
10
+ elsif ApplicationController.respond_to?(:allow_unauthenticated_access)
11
+ :rails
12
+ end
13
+ end
14
+
15
+ def skip_without_authentication
16
+ skip "the test app has no authentication" unless AuthenticationHelpers.provider
17
+ end
18
+
19
+ module Requests
20
+ # Sign a new user in by posting the sign-in form
21
+ def sign_in
22
+ skip_without_authentication
23
+ user = FactoryBot.create(:user)
24
+
25
+ if AuthenticationHelpers.provider == :devise
26
+ post user_session_path, params: {user: {email: user.email, password: user.password}}
27
+ else
28
+ post session_path, params: {email_address: user.email_address, password: user.password}
29
+ end
30
+ end
31
+ end
32
+ end
33
+
34
+ RSpec.configure do |config|
35
+ config.include AuthenticationHelpers
36
+ config.include AuthenticationHelpers::Requests, type: :request
37
+ end
@@ -2,24 +2,26 @@
2
2
 
3
3
  module Features
4
4
  module SessionHelpers
5
- def sign_up_with(email, password)
6
- visit new_user_registration_path
7
- fill_in "Email", with: email
8
- fill_in "Password", with: password
9
- click_button "Sign up"
10
- end
11
-
12
5
  def sign_in
13
- user = FactoryBot.create(:user)
14
- user.save
15
- visit new_user_session_path
16
- fill_in "user_email", with: user.email
17
- fill_in "user_password", with: user.password
18
- click_button "Log in"
6
+ skip_without_authentication
7
+ visit (AuthenticationHelpers.provider == :devise) ? new_user_session_path : new_session_path
8
+ fill_in_sign_in_form FactoryBot.create(:user)
19
9
  # Wait for the persistent "Log Out" nav link rather than the one-shot
20
10
  # "Signed in successfully." flash, which can render and then become
21
11
  # non-visible before Capybara's default wait time elapses.
22
12
  expect(page).to have_link "Log Out"
23
13
  end
14
+
15
+ def fill_in_sign_in_form(user)
16
+ if AuthenticationHelpers.provider == :devise
17
+ fill_in "user_email", with: user.email
18
+ fill_in "user_password", with: user.password
19
+ click_button "Log in"
20
+ else
21
+ fill_in "email_address", with: user.email_address
22
+ fill_in "password", with: user.password
23
+ click_button "Sign in"
24
+ end
25
+ end
24
26
  end
25
27
  end