geoblacklight 4.0.0 → 4.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +21 -6
- data/.solr_wrapper +1 -0
- data/.standard.yml +1 -0
- data/Gemfile +13 -11
- data/README.md +1 -1
- data/Rakefile +42 -50
- data/app/assets/images/blacklight/american-geographical-society-library-uwm-libraries.svg +26 -0
- data/app/assets/images/blacklight/arizona.svg +4 -0
- data/app/assets/images/blacklight/circle-info-solid.svg +1 -0
- data/app/assets/images/blacklight/fire-solid.svg +1 -0
- data/app/assets/images/blacklight/lightbulb-solid.svg +1 -0
- data/app/assets/images/blacklight/nebraska.svg +4 -0
- data/app/assets/images/blacklight/rutgers.svg +5 -0
- data/app/assets/images/blacklight/triangle-exclamation-solid.svg +1 -0
- data/app/assets/stylesheets/geoblacklight/modules/sidebar.scss +8 -0
- data/app/components/geoblacklight/display_note_component.html.erb +1 -0
- data/app/components/geoblacklight/display_note_component.rb +47 -0
- data/app/components/geoblacklight/icon_facet_item_component.rb +2 -2
- data/app/controllers/download_controller.rb +36 -37
- data/app/controllers/relation_controller.rb +1 -0
- data/app/controllers/wms_controller.rb +1 -0
- data/app/helpers/arcgis_helper.rb +2 -1
- data/app/helpers/blacklight_helper.rb +2 -1
- data/app/helpers/carto_helper.rb +3 -2
- data/app/helpers/geoblacklight/geoblacklight_helper_behavior.rb +2 -1
- data/app/helpers/geoblacklight_helper.rb +44 -36
- data/app/models/concerns/geoblacklight/bbox_filter_query.rb +1 -1
- data/app/models/concerns/geoblacklight/solr_document/arcgis.rb +1 -0
- data/app/models/concerns/geoblacklight/solr_document/carto.rb +1 -0
- data/app/models/concerns/geoblacklight/solr_document/citation.rb +3 -2
- data/app/models/concerns/geoblacklight/solr_document/finder.rb +1 -0
- data/app/models/concerns/geoblacklight/solr_document/inspection.rb +1 -0
- data/app/models/concerns/geoblacklight/solr_document.rb +17 -9
- data/app/models/concerns/geoblacklight/suppressed_records_search_behavior.rb +2 -1
- data/app/presenters/geoblacklight/document_presenter.rb +3 -2
- data/app/views/catalog/_show_default_display_note.html.erb +7 -0
- data/app/views/catalog/_show_sidebar.html.erb +1 -0
- data/app/views/catalog/_show_sidebar_static_map.html.erb +10 -0
- data/app/views/relation/index.json.jbuilder +1 -1
- data/config/initializers/new_gbl_settings_defaults_4.1.yml +104 -0
- data/config/initializers/rails_config.rb +5 -1
- data/config/locales/geoblacklight.en.yml +18 -10
- data/geoblacklight.gemspec +36 -40
- data/lib/generators/geoblacklight/assets_generator.rb +15 -15
- data/lib/generators/geoblacklight/install_generator.rb +24 -23
- data/lib/generators/geoblacklight/templates/catalog_controller.rb +66 -71
- data/lib/generators/geoblacklight/templates/settings.yml +74 -22
- data/lib/geoblacklight/bounding_box.rb +1 -0
- data/lib/geoblacklight/constants.rb +26 -25
- data/lib/geoblacklight/download/geojson_download.rb +10 -9
- data/lib/geoblacklight/download/geotiff_download.rb +6 -5
- data/lib/geoblacklight/download/hgl_download.rb +4 -3
- data/lib/geoblacklight/download/kmz_download.rb +11 -10
- data/lib/geoblacklight/download/shapefile_download.rb +10 -9
- data/lib/geoblacklight/download.rb +12 -11
- data/lib/geoblacklight/engine.rb +10 -9
- data/lib/geoblacklight/exceptions.rb +3 -0
- data/lib/geoblacklight/faraday_middleware/follow_redirects.rb +12 -11
- data/lib/geoblacklight/geometry.rb +6 -5
- data/lib/geoblacklight/item_viewer.rb +4 -3
- data/lib/geoblacklight/metadata/base.rb +4 -3
- data/lib/geoblacklight/metadata/fgdc.rb +1 -0
- data/lib/geoblacklight/metadata/html.rb +5 -4
- data/lib/geoblacklight/metadata/iso19139.rb +1 -0
- data/lib/geoblacklight/metadata.rb +1 -0
- data/lib/geoblacklight/metadata_transformer/base.rb +5 -4
- data/lib/geoblacklight/metadata_transformer/fgdc.rb +1 -0
- data/lib/geoblacklight/metadata_transformer/iso19139.rb +1 -0
- data/lib/geoblacklight/metadata_transformer.rb +6 -2
- data/lib/geoblacklight/reference.rb +3 -2
- data/lib/geoblacklight/references.rb +11 -6
- data/lib/geoblacklight/relation/ancestors.rb +4 -3
- data/lib/geoblacklight/relation/descendants.rb +4 -3
- data/lib/geoblacklight/relation/relation_response.rb +3 -2
- data/lib/geoblacklight/routes/downloadable.rb +3 -2
- data/lib/geoblacklight/routes/exportable.rb +4 -3
- data/lib/geoblacklight/routes/wms.rb +2 -1
- data/lib/geoblacklight/routes.rb +4 -3
- data/lib/geoblacklight/version.rb +2 -1
- data/lib/geoblacklight/view_helper_override.rb +3 -2
- data/lib/geoblacklight/wms_layer/feature_info_response.rb +5 -4
- data/lib/geoblacklight/wms_layer.rb +4 -3
- data/lib/geoblacklight.rb +32 -31
- data/lib/tasks/geoblacklight.rake +45 -44
- data/schema/geoblacklight-schema-aardvark.json +6 -0
- data/spec/components/geoblacklight/display_note_component_spec.rb +27 -0
- data/spec/components/geoblacklight/homepage_feature_facet_component_spec.rb +11 -10
- data/spec/components/geoblacklight/icon_facet_item_component_spec.rb +8 -7
- data/spec/config/initializers/rails_config_spec.rb +10 -9
- data/spec/controllers/catalog_controller_spec.rb +27 -26
- data/spec/controllers/download_controller_spec.rb +50 -49
- data/spec/controllers/relation_controller_spec.rb +5 -4
- data/spec/controllers/wms_controller_spec.rb +10 -9
- data/spec/factories/user.rb +3 -2
- data/spec/features/bookmarks_spec.rb +7 -6
- data/spec/features/configurable_basemap_spec.rb +12 -11
- data/spec/features/data_dictionary_download_spec.rb +11 -10
- data/spec/features/download_layer_spec.rb +64 -63
- data/spec/features/empty_search_spec.rb +6 -5
- data/spec/features/esri_viewer_spec.rb +33 -32
- data/spec/features/exports_spec.rb +18 -17
- data/spec/features/full_screen_controll_spec.rb +8 -8
- data/spec/features/help_text_spec.rb +6 -5
- data/spec/features/home_page_spec.rb +30 -29
- data/spec/features/iiif_viewer_spec.rb +6 -5
- data/spec/features/index_map_spec.rb +17 -16
- data/spec/features/layer_inspection_spec.rb +8 -7
- data/spec/features/layer_opacity_spec.rb +15 -14
- data/spec/features/layer_preview_spec.rb +11 -10
- data/spec/features/layer_with_no_references_spec.rb +5 -4
- data/spec/features/linkified_attribute_table_spec.rb +8 -7
- data/spec/features/metadata_panel_spec.rb +32 -31
- data/spec/features/missing_metadata_spec.rb +18 -17
- data/spec/features/multiple_downloads_spec.rb +11 -10
- data/spec/features/oembed_spec.rb +6 -5
- data/spec/features/relations_spec.rb +51 -26
- data/spec/features/saved_searches_spec.rb +7 -6
- data/spec/features/search_bar_spec.rb +9 -8
- data/spec/features/search_results_complex_geometry_spec.rb +12 -11
- data/spec/features/search_results_icons_spec.rb +10 -9
- data/spec/features/search_results_map_spec.rb +21 -20
- data/spec/features/search_results_overlap_ratio_spec.rb +17 -16
- data/spec/features/search_spec.rb +19 -18
- data/spec/features/show_page_download_spec.rb +15 -14
- data/spec/features/show_page_metadata_spec.rb +9 -8
- data/spec/features/show_page_sidebar_static_map_spec.rb +21 -0
- data/spec/features/sms_spec.rb +12 -11
- data/spec/features/split_view.html.erb_spec.rb +56 -55
- data/spec/features/suppressed_records_spec.rb +10 -9
- data/spec/features/tilejson_spec.rb +9 -8
- data/spec/features/tms_spec.rb +6 -5
- data/spec/features/web_services_modal_spec.rb +37 -36
- data/spec/features/wmts_spec.rb +16 -15
- data/spec/features/xyz_spec.rb +6 -5
- data/spec/fixtures/solr_documents/actual-papermap1.json +1 -1
- data/spec/fixtures/solr_documents/actual-point1.json +1 -1
- data/spec/fixtures/solr_documents/actual-polygon1.json +1 -1
- data/spec/fixtures/solr_documents/actual-raster1.json +1 -1
- data/spec/fixtures/solr_documents/baruch_ancestor1.json +1 -1
- data/spec/fixtures/solr_documents/baruch_ancestor2.json +1 -1
- data/spec/fixtures/solr_documents/baruch_documentation_download.json +2 -2
- data/spec/fixtures/solr_documents/cornell_html_metadata.json +1 -1
- data/spec/fixtures/solr_documents/display-note.json +52 -0
- data/spec/fixtures/solr_documents/esri-dynamic-layer-all-layers.json +1 -1
- data/spec/fixtures/solr_documents/esri-dynamic-layer-single-layer.json +1 -1
- data/spec/fixtures/solr_documents/esri-feature-layer.json +1 -1
- data/spec/fixtures/solr_documents/esri-image-map-layer.json +1 -1
- data/spec/fixtures/solr_documents/esri-tiled_map_layer.json +1 -1
- data/spec/fixtures/solr_documents/esri-wms-layer.json +1 -1
- data/spec/fixtures/solr_documents/harvard_raster.json +1 -1
- data/spec/fixtures/solr_documents/iiif-eastern-hemisphere.json +1 -1
- data/spec/fixtures/solr_documents/index-map-polygon-no-downloadurl.json +1 -1
- data/spec/fixtures/solr_documents/index-map-polygon.json +1 -1
- data/spec/fixtures/solr_documents/index-map-stanford.json +1 -1
- data/spec/fixtures/solr_documents/index_map_point.json +1 -1
- data/spec/fixtures/solr_documents/princeton-parent.json +1 -1
- data/spec/fixtures/solr_documents/public_direct_download.json +1 -1
- data/spec/fixtures/solr_documents/public_iiif_princeton.json +1 -1
- data/spec/fixtures/solr_documents/restricted-line.json +1 -1
- data/spec/fixtures/solr_documents/tilejson.json +2 -2
- data/spec/fixtures/solr_documents/umn_metro_result1.json +2 -2
- data/spec/fixtures/solr_documents/umn_state_result1.json +1 -1
- data/spec/fixtures/solr_documents/umn_state_result2.json +1 -1
- data/spec/fixtures/solr_documents/uva_slug_colon.json +1 -1
- data/spec/fixtures/solr_documents/wmts-multiple.json +1 -1
- data/spec/fixtures/solr_documents/wmts-single-layer.json +6 -6
- data/spec/fixtures/solr_documents/xyz.json +3 -3
- data/spec/helpers/arcgis_helper_spec.rb +8 -7
- data/spec/helpers/carto_helper_spec.rb +6 -5
- data/spec/helpers/geoblacklight/geoblacklight_helper_behavior_spec.rb +10 -15
- data/spec/helpers/geoblacklight_helper_spec.rb +139 -138
- data/spec/lib/geoblacklight/bounding_box_spec.rb +14 -13
- data/spec/lib/geoblacklight/document_presenter_spec.rb +26 -25
- data/spec/lib/geoblacklight/download/geojson_download_spec.rb +8 -7
- data/spec/lib/geoblacklight/download/geotiff_download_spec.rb +8 -7
- data/spec/lib/geoblacklight/download/hgl_download_spec.rb +16 -15
- data/spec/lib/geoblacklight/download/kmz_download_spec.rb +9 -8
- data/spec/lib/geoblacklight/download/shapefile_download_spec.rb +8 -7
- data/spec/lib/geoblacklight/download_spec.rb +61 -60
- data/spec/lib/geoblacklight/geometry_spec.rb +29 -28
- data/spec/lib/geoblacklight/item_viewer_spec.rb +25 -24
- data/spec/lib/geoblacklight/metadata/base_spec.rb +44 -43
- data/spec/lib/geoblacklight/metadata/html_spec.rb +7 -6
- data/spec/lib/geoblacklight/metadata_spec.rb +15 -14
- data/spec/lib/geoblacklight/metadata_transformer/base_spec.rb +13 -12
- data/spec/lib/geoblacklight/metadata_transformer/fgdc_spec.rb +8 -7
- data/spec/lib/geoblacklight/metadata_transformer/iso19139_spec.rb +8 -7
- data/spec/lib/geoblacklight/metadata_transformer_spec.rb +15 -14
- data/spec/lib/geoblacklight/reference_spec.rb +28 -27
- data/spec/lib/geoblacklight/references_spec.rb +89 -76
- data/spec/lib/geoblacklight/relation/ancestors_spec.rb +17 -16
- data/spec/lib/geoblacklight/relation/descendants_spec.rb +17 -16
- data/spec/lib/geoblacklight/relation/relation_response_spec.rb +29 -28
- data/spec/lib/geoblacklight/view_helper_override_spec.rb +14 -13
- data/spec/lib/geoblacklight/wms_layer/feature_info_response_spec.rb +19 -18
- data/spec/lib/geoblacklight/wms_layer_spec.rb +31 -30
- data/spec/models/concerns/geoblacklight/bbox_filter_field_spec.rb +31 -31
- data/spec/models/concerns/geoblacklight/bbox_filter_query_spec.rb +32 -32
- data/spec/models/concerns/geoblacklight/solr_document/carto_spec.rb +16 -15
- data/spec/models/concerns/geoblacklight/solr_document/citation_spec.rb +7 -6
- data/spec/models/concerns/geoblacklight/solr_document/finder_spec.rb +16 -17
- data/spec/models/concerns/geoblacklight/solr_document/inspection_spec.rb +7 -6
- data/spec/models/concerns/geoblacklight/solr_document_spec.rb +121 -107
- data/spec/models/concerns/geoblacklight/suppressed_records_search_behavior_spec.rb +8 -7
- data/spec/presenters/geoblacklight/bbox_item_presenter_spec.rb +10 -10
- data/spec/routing/catalog_routing_spec.rb +4 -3
- data/spec/spec_helper.rb +34 -33
- data/spec/support/backport_test_helpers.rb +6 -5
- data/spec/support/features/session_helpers.rb +8 -7
- data/spec/support/features.rb +2 -1
- data/spec/support/fixtures.rb +2 -1
- data/spec/tasks/geoblacklight_spec.rb +10 -9
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +16 -15
- data/spec/views/catalog/_document_split.html.erb_spec.rb +3 -2
- data/spec/views/catalog/_index_split.html.erb_spec.rb +3 -2
- data/spec/views/catalog/_results_pagination.html.erb_spec.rb +5 -4
- data/spec/views/catalog/_show_downloads.html.erb_spec.rb +11 -10
- data/spec/views/catalog/_show_tools.html.erb_spec.rb +13 -12
- data/template.rb +9 -8
- metadata +29 -212
- data/.gitmodules +0 -0
- data/.rubocop.yml +0 -111
- data/.rubocop_todo.yml +0 -437
- data/config/initializers/new_gbl_settings_defaults_3_4.yml +0 -6
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
2
|
+
|
3
|
+
require "spec_helper"
|
3
4
|
|
4
5
|
describe Geoblacklight::References do
|
5
6
|
let(:references_field) { Settings.FIELDS.REFERENCES }
|
@@ -7,10 +8,10 @@ describe Geoblacklight::References do
|
|
7
8
|
let(:typical_ogp_shapefile) do
|
8
9
|
described_class.new(
|
9
10
|
SolrDocument.new(
|
10
|
-
file_format_field =>
|
11
|
+
file_format_field => "Shapefile",
|
11
12
|
references_field => {
|
12
|
-
|
13
|
-
|
13
|
+
"http://www.opengis.net/def/serviceType/ogc/wms" => "http://hgl.harvard.edu:8080/geoserver/wms",
|
14
|
+
"http://www.opengis.net/def/serviceType/ogc/wfs" => "http://hgl.harvard.edu:8080/geoserver/wfs"
|
14
15
|
}.to_json
|
15
16
|
)
|
16
17
|
)
|
@@ -18,7 +19,7 @@ describe Geoblacklight::References do
|
|
18
19
|
let(:no_service_shapefile) do
|
19
20
|
described_class.new(
|
20
21
|
SolrDocument.new(
|
21
|
-
file_format_field =>
|
22
|
+
file_format_field => "Shapefile",
|
22
23
|
references_field => {}.to_json
|
23
24
|
)
|
24
25
|
)
|
@@ -26,10 +27,10 @@ describe Geoblacklight::References do
|
|
26
27
|
let(:typical_ogp_geotiff) do
|
27
28
|
described_class.new(
|
28
29
|
SolrDocument.new(
|
29
|
-
file_format_field =>
|
30
|
+
file_format_field => "GeoTIFF",
|
30
31
|
references_field => {
|
31
|
-
|
32
|
-
|
32
|
+
"http://www.opengis.net/def/serviceType/ogc/wms" => "http://hgl.harvard.edu:8080/geoserver/wms",
|
33
|
+
"http://www.opengis.net/def/serviceType/ogc/wfs" => "http://hgl.harvard.edu:8080/geoserver/wfs"
|
33
34
|
}.to_json
|
34
35
|
)
|
35
36
|
)
|
@@ -37,10 +38,10 @@ describe Geoblacklight::References do
|
|
37
38
|
let(:typical_arcgrid) do
|
38
39
|
described_class.new(
|
39
40
|
SolrDocument.new(
|
40
|
-
file_format_field =>
|
41
|
+
file_format_field => "ArcGRID",
|
41
42
|
references_field => {
|
42
|
-
|
43
|
-
|
43
|
+
"http://www.opengis.net/def/serviceType/ogc/wms" => "http://hgl.harvard.edu:8080/geoserver/wms",
|
44
|
+
"http://www.opengis.net/def/serviceType/ogc/wfs" => "http://hgl.harvard.edu:8080/geoserver/wfs"
|
44
45
|
}.to_json
|
45
46
|
)
|
46
47
|
)
|
@@ -48,14 +49,14 @@ describe Geoblacklight::References do
|
|
48
49
|
let(:complex_shapefile) do
|
49
50
|
described_class.new(
|
50
51
|
SolrDocument.new(
|
51
|
-
file_format_field =>
|
52
|
+
file_format_field => "Shapefile",
|
52
53
|
references_field => {
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
54
|
+
"http://schema.org/downloadUrl" => "http://example.com/urn:hul.harvard.edu:HARVARD.SDE2.TG10USAIANNH/data.zip",
|
55
|
+
"http://www.isotc211.org/schemas/2005/gmd/" => "http://example.com/urn:hul.harvard.edu:HARVARD.SDE2.TG10USAIANNH/iso19139.xml",
|
56
|
+
"http://www.loc.gov/mods/v3" => "http://example.com/urn:hul.harvard.edu:HARVARD.SDE2.TG10USAIANNH/mods.xml",
|
57
|
+
"http://schema.org/url" => "http://example.com/urn:hul.harvard.edu:HARVARD.SDE2.TG10USAIANNH/homepage",
|
58
|
+
"http://www.opengis.net/def/serviceType/ogc/wms" => "http://hgl.harvard.edu:8080/geoserver/wms",
|
59
|
+
"http://www.opengis.net/def/serviceType/ogc/wfs" => "http://hgl.harvard.edu:8080/geoserver/wfs"
|
59
60
|
}.to_json
|
60
61
|
)
|
61
62
|
)
|
@@ -63,9 +64,9 @@ describe Geoblacklight::References do
|
|
63
64
|
let(:direct_download_only) do
|
64
65
|
described_class.new(
|
65
66
|
SolrDocument.new(
|
66
|
-
file_format_field =>
|
67
|
+
file_format_field => "GeoTIFF",
|
67
68
|
references_field => {
|
68
|
-
|
69
|
+
"http://schema.org/downloadUrl" => "http://example.com/layer-id-geotiff.tiff"
|
69
70
|
}.to_json
|
70
71
|
)
|
71
72
|
)
|
@@ -73,10 +74,10 @@ describe Geoblacklight::References do
|
|
73
74
|
let(:simple_iiif_image) do
|
74
75
|
described_class.new(
|
75
76
|
SolrDocument.new(
|
76
|
-
file_format_field =>
|
77
|
+
file_format_field => "Raster",
|
77
78
|
references_field => {
|
78
|
-
|
79
|
-
|
79
|
+
"http://schema.org/url" => "http://arks.princeton.edu/ark:/88435/02870w62c",
|
80
|
+
"http://iiif.io/api/image" => "https://iiif-cloud.princeton.edu/iiif/2/6c%2F52%2F12%2F6c5212e81bc845f59bb1cdc740a88bad%2Fintermediate_file/info.json"
|
80
81
|
}.to_json
|
81
82
|
)
|
82
83
|
)
|
@@ -85,10 +86,10 @@ describe Geoblacklight::References do
|
|
85
86
|
described_class.new(
|
86
87
|
SolrDocument.new(
|
87
88
|
references_field => {
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
89
|
+
"urn:x-esri:serviceType:ArcGIS#NotValid" => "foo",
|
90
|
+
"urn:x-esri:serviceType:ArcGIS#TiledMapLayer" => "foo",
|
91
|
+
"urn:x-esri:serviceType:ArcGIS#DynamicMapLayer" => "foo",
|
92
|
+
"urn:x-esri:serviceType:ArcGIS#ImageMapLayer" => "foo"
|
92
93
|
}.to_json
|
93
94
|
)
|
94
95
|
)
|
@@ -98,119 +99,131 @@ describe Geoblacklight::References do
|
|
98
99
|
SolrDocument.new, :new_ref_field
|
99
100
|
)
|
100
101
|
end
|
101
|
-
describe
|
102
|
-
it
|
102
|
+
describe "#initialize" do
|
103
|
+
it "parses configured references field to @refs" do
|
103
104
|
expect(typical_ogp_shapefile.instance_variable_get(:@refs)).to be_an Array
|
104
105
|
end
|
105
|
-
it
|
106
|
+
it "empty references return an empty array" do
|
106
107
|
empty_refs = no_service_shapefile.instance_variable_get(:@refs)
|
107
108
|
expect(empty_refs).to be_an Array
|
108
109
|
expect(empty_refs).to eq []
|
109
110
|
end
|
110
|
-
it
|
111
|
+
it "sets @references_field" do
|
111
112
|
expect(typical_ogp_shapefile.reference_field).to eq references_field
|
112
113
|
expect(custom_fields.reference_field).to eq :new_ref_field
|
113
114
|
end
|
114
115
|
end
|
115
|
-
describe
|
116
|
-
it
|
117
|
-
expect(complex_shapefile.format).to eq
|
118
|
-
expect(direct_download_only.format).to eq
|
116
|
+
describe "format" do
|
117
|
+
it "returns format" do
|
118
|
+
expect(complex_shapefile.format).to eq "Shapefile"
|
119
|
+
expect(direct_download_only.format).to eq "GeoTIFF"
|
119
120
|
end
|
120
121
|
end
|
121
|
-
describe
|
122
|
-
it
|
122
|
+
describe "refs" do
|
123
|
+
it "is a set of enumberable references" do
|
123
124
|
complex_shapefile.refs.each do |reference|
|
124
125
|
expect(reference).to be_an Geoblacklight::Reference
|
125
126
|
end
|
126
127
|
end
|
127
128
|
end
|
128
|
-
describe
|
129
|
-
it
|
129
|
+
describe "shown_metadata_refs" do
|
130
|
+
it "is a set of metadata references exposed by the configuration" do
|
130
131
|
expect(complex_shapefile.shown_metadata_refs.count).to eq 2
|
131
|
-
expect(complex_shapefile.shown_metadata_refs.first.type.to_s).to eq
|
132
|
-
expect(complex_shapefile.shown_metadata_refs.last.type.to_s).to eq
|
132
|
+
expect(complex_shapefile.shown_metadata_refs.first.type.to_s).to eq "mods"
|
133
|
+
expect(complex_shapefile.shown_metadata_refs.last.type.to_s).to eq "iso19139"
|
133
134
|
end
|
134
|
-
context
|
135
|
+
context "with an overridden order for the formats" do
|
135
136
|
before do
|
136
|
-
stub_const(
|
137
|
+
stub_const("Settings", Module.new)
|
137
138
|
allow(Settings).to receive_messages(
|
138
139
|
METADATA_SHOWN: %w[iso19139 mods],
|
139
|
-
FIELDS: OpenStruct.new(FORMAT:
|
140
|
+
FIELDS: OpenStruct.new(FORMAT: "dct_format_s")
|
140
141
|
)
|
141
142
|
end
|
142
|
-
it
|
143
|
-
expect(complex_shapefile.shown_metadata_refs.first.type.to_s).to eq
|
144
|
-
expect(complex_shapefile.shown_metadata_refs.last.type.to_s).to eq
|
143
|
+
it "is ordered by the configuration" do
|
144
|
+
expect(complex_shapefile.shown_metadata_refs.first.type.to_s).to eq "iso19139"
|
145
|
+
expect(complex_shapefile.shown_metadata_refs.last.type.to_s).to eq "mods"
|
145
146
|
end
|
146
147
|
end
|
147
148
|
end
|
148
|
-
describe
|
149
|
-
it
|
149
|
+
describe "shown_metadata" do
|
150
|
+
it "is a set of metadata resources exposed by the configuration" do
|
150
151
|
expect(complex_shapefile.shown_metadata.count).to eq 2
|
151
152
|
expect(complex_shapefile.shown_metadata.first).to be_a Geoblacklight::Metadata::Base
|
152
153
|
end
|
153
154
|
end
|
154
|
-
describe
|
155
|
-
it
|
155
|
+
describe "direct_download" do
|
156
|
+
it "returns the direct download link" do
|
156
157
|
download = complex_shapefile.download
|
157
158
|
expect(download).to be_an Geoblacklight::Reference
|
158
|
-
expect(download.endpoint).to eq(
|
159
|
-
expect(direct_download_only.download.endpoint).to eq
|
159
|
+
expect(download.endpoint).to eq("http://example.com/urn:hul.harvard.edu:HARVARD.SDE2.TG10USAIANNH/data.zip")
|
160
|
+
expect(direct_download_only.download.endpoint).to eq "http://example.com/layer-id-geotiff.tiff"
|
160
161
|
end
|
161
|
-
it
|
162
|
+
it "does not return if download not available" do
|
162
163
|
expect(typical_ogp_shapefile.download).to be_nil
|
163
164
|
end
|
164
165
|
end
|
165
|
-
describe
|
166
|
-
it
|
167
|
-
expect(complex_shapefile.preferred_download[:file_download][:download]).to eq
|
168
|
-
expect(direct_download_only.preferred_download[:file_download][:download]).to eq
|
166
|
+
describe "preferred_download" do
|
167
|
+
it "returns the direct download if available" do
|
168
|
+
expect(complex_shapefile.preferred_download[:file_download][:download]).to eq "http://example.com/urn:hul.harvard.edu:HARVARD.SDE2.TG10USAIANNH/data.zip"
|
169
|
+
expect(direct_download_only.preferred_download[:file_download][:download]).to eq "http://example.com/layer-id-geotiff.tiff"
|
169
170
|
end
|
170
|
-
it
|
171
|
+
it "returns nil if there is no direct download" do
|
171
172
|
expect(typical_ogp_shapefile.preferred_download).to be_nil
|
172
173
|
expect(typical_ogp_geotiff.preferred_download).to be_nil
|
173
174
|
end
|
174
175
|
end
|
175
|
-
describe
|
176
|
-
it
|
176
|
+
describe "download_types" do
|
177
|
+
it "returns available downloads by format" do
|
177
178
|
types = complex_shapefile.download_types
|
178
|
-
expect(types.first[1]).to eq wfs:
|
179
|
+
expect(types.first[1]).to eq wfs: "http://hgl.harvard.edu:8080/geoserver/wfs"
|
179
180
|
expect(types.count).to eq 3
|
180
181
|
expect(direct_download_only.download_types).to be_nil
|
181
182
|
end
|
182
|
-
it
|
183
|
+
it "onlies return available downloads if no direct is present" do
|
183
184
|
types = typical_ogp_shapefile.download_types
|
184
|
-
expect(types.first[1]).to eq wfs:
|
185
|
+
expect(types.first[1]).to eq wfs: "http://hgl.harvard.edu:8080/geoserver/wfs"
|
185
186
|
expect(types.count).to eq 3
|
186
187
|
end
|
187
188
|
end
|
188
|
-
describe
|
189
|
-
it
|
189
|
+
describe "#esri_webservices" do
|
190
|
+
it "returns webservices that are esri specific" do
|
190
191
|
expect(some_esri_services.esri_webservices.length).to eq 3
|
191
192
|
end
|
192
193
|
end
|
193
|
-
describe
|
194
|
-
it
|
194
|
+
describe "#method_missing" do
|
195
|
+
it "defaults to the base behavior if the method signature is not a URI key" do
|
195
196
|
expect { typical_ogp_shapefile.invalid }.to raise_error(NoMethodError)
|
196
197
|
end
|
197
198
|
end
|
198
|
-
describe
|
199
|
-
|
199
|
+
describe "#respond_to_missing?" do
|
200
|
+
context "with a valid method" do
|
201
|
+
it "returns true" do
|
202
|
+
expect(typical_ogp_shapefile.respond_to?(:download_types)).to be true
|
203
|
+
end
|
204
|
+
end
|
205
|
+
context "with a invalid method" do
|
206
|
+
it "returns false" do
|
207
|
+
expect(typical_ogp_shapefile.respond_to?(:invalid)).to be false
|
208
|
+
end
|
209
|
+
end
|
210
|
+
end
|
211
|
+
describe "downloads_by_format" do
|
212
|
+
it "returns shapefile" do
|
200
213
|
expect(typical_ogp_shapefile.downloads_by_format.count).to eq 3
|
201
214
|
end
|
202
|
-
it
|
215
|
+
it "returns geotiff" do
|
203
216
|
expect(typical_ogp_geotiff.downloads_by_format.count).to eq 1
|
204
|
-
expect(typical_ogp_geotiff.downloads_by_format[:geotiff][:wms]).to eq
|
217
|
+
expect(typical_ogp_geotiff.downloads_by_format[:geotiff][:wms]).to eq "http://hgl.harvard.edu:8080/geoserver/wms"
|
205
218
|
end
|
206
|
-
it
|
219
|
+
it "returns arcgrid as geotiff" do
|
207
220
|
expect(typical_arcgrid.downloads_by_format.count).to eq 1
|
208
|
-
expect(typical_arcgrid.downloads_by_format[:geotiff][:wms]).to eq
|
221
|
+
expect(typical_arcgrid.downloads_by_format[:geotiff][:wms]).to eq "http://hgl.harvard.edu:8080/geoserver/wms"
|
209
222
|
end
|
210
|
-
it
|
223
|
+
it "does not return shapefile if wms and wfs are not present" do
|
211
224
|
expect(no_service_shapefile.downloads_by_format).to be_nil
|
212
225
|
end
|
213
|
-
it
|
226
|
+
it "does not return GeoTIFF if wms is not present" do
|
214
227
|
expect(direct_download_only.downloads_by_format).to be_nil
|
215
228
|
end
|
216
229
|
end
|
@@ -1,33 +1,34 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
2
|
+
|
3
|
+
require "spec_helper"
|
3
4
|
|
4
5
|
describe Geoblacklight::Relation::Ancestors do
|
5
6
|
let(:repository) { Blacklight::Solr::Repository.new(CatalogController.blacklight_config) }
|
6
|
-
let(:ancestors) { described_class.new(
|
7
|
-
let(:empty_ancestors) { described_class.new(
|
7
|
+
let(:ancestors) { described_class.new("nyu_2451_34502", Settings.FIELDS.SOURCE, repository) }
|
8
|
+
let(:empty_ancestors) { described_class.new("harvard-g7064-s2-1834-k3", Settings.FIELDS.SOURCE, repository) }
|
8
9
|
|
9
|
-
describe
|
10
|
-
it
|
10
|
+
describe "#create_search_params" do
|
11
|
+
it "assembles the correct search params for finding ancestor documents" do
|
11
12
|
expect(ancestors.create_search_params).to eq(fq: ["{!join from=#{Settings.FIELDS.SOURCE} to=#{Settings.FIELDS.ID}}#{Settings.FIELDS.ID}:nyu_2451_34502"], fl: [Settings.FIELDS.TITLE.to_s, Settings.FIELDS.ID, Settings.FIELDS.RESOURCE_TYPE])
|
12
13
|
end
|
13
14
|
end
|
14
15
|
|
15
|
-
describe
|
16
|
-
it
|
17
|
-
expect(ancestors.execute_query).to include(
|
16
|
+
describe "#execute_query" do
|
17
|
+
it "executes the query for finding ancestors, return response" do
|
18
|
+
expect(ancestors.execute_query).to include("responseHeader")
|
18
19
|
end
|
19
20
|
end
|
20
21
|
|
21
|
-
describe
|
22
|
-
it
|
23
|
-
expect(ancestors.results).to include(
|
24
|
-
expect(ancestors.results).to include(
|
22
|
+
describe "#results" do
|
23
|
+
it "produces a hash of results from the query" do
|
24
|
+
expect(ancestors.results).to include("numFound")
|
25
|
+
expect(ancestors.results).to include("docs")
|
25
26
|
end
|
26
|
-
it
|
27
|
-
expect(ancestors.results[
|
27
|
+
it "has non-zero numfound for a document with ancestors" do
|
28
|
+
expect(ancestors.results["numFound"]).to be > 0
|
28
29
|
end
|
29
|
-
it
|
30
|
-
expect(empty_ancestors.results[
|
30
|
+
it "has zero numfound for a document without ancestors" do
|
31
|
+
expect(empty_ancestors.results["numFound"]).to eq(0)
|
31
32
|
end
|
32
33
|
end
|
33
34
|
end
|
@@ -1,33 +1,34 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
2
|
+
|
3
|
+
require "spec_helper"
|
3
4
|
|
4
5
|
describe Geoblacklight::Relation::Descendants do
|
5
6
|
let(:repository) { Blacklight::Solr::Repository.new(CatalogController.blacklight_config) }
|
6
|
-
let(:descendants) { described_class.new(
|
7
|
-
let(:empty_descendants) { described_class.new(
|
7
|
+
let(:descendants) { described_class.new("nyu_2451_34636", Settings.FIELDS.SOURCE, repository) }
|
8
|
+
let(:empty_descendants) { described_class.new("harvard-g7064-s2-1834-k3", Settings.FIELDS.SOURCE, repository) }
|
8
9
|
|
9
|
-
describe
|
10
|
-
it
|
10
|
+
describe "#create_search_params" do
|
11
|
+
it "assembles the correct search params for finding descendant documents" do
|
11
12
|
expect(descendants.create_search_params).to eq(fq: "#{Settings.FIELDS.SOURCE}:nyu_2451_34636", fl: [Settings.FIELDS.TITLE.to_s, Settings.FIELDS.ID, Settings.FIELDS.RESOURCE_TYPE])
|
12
13
|
end
|
13
14
|
end
|
14
15
|
|
15
|
-
describe
|
16
|
-
it
|
17
|
-
expect(descendants.execute_query).to include(
|
16
|
+
describe "#execute_query" do
|
17
|
+
it "executes the query for finding descendants, return response" do
|
18
|
+
expect(descendants.execute_query).to include("responseHeader")
|
18
19
|
end
|
19
20
|
end
|
20
21
|
|
21
|
-
describe
|
22
|
-
it
|
23
|
-
expect(descendants.results).to include(
|
24
|
-
expect(descendants.results).to include(
|
22
|
+
describe "#results" do
|
23
|
+
it "produces a hash of results from the query" do
|
24
|
+
expect(descendants.results).to include("numFound")
|
25
|
+
expect(descendants.results).to include("docs")
|
25
26
|
end
|
26
|
-
it
|
27
|
-
expect(descendants.results[
|
27
|
+
it "has non-zero numfound for a document with descendants" do
|
28
|
+
expect(descendants.results["numFound"]).to be > 0
|
28
29
|
end
|
29
|
-
it
|
30
|
-
expect(empty_descendants.results[
|
30
|
+
it "has zero numfound for a document without descendants" do
|
31
|
+
expect(empty_descendants.results["numFound"]).to eq(0)
|
31
32
|
end
|
32
33
|
end
|
33
34
|
end
|
@@ -1,58 +1,59 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
2
|
+
|
3
|
+
require "spec_helper"
|
3
4
|
|
4
5
|
describe Geoblacklight::Relation::RelationResponse do
|
5
6
|
let(:repository) { Blacklight::Solr::Repository.new(CatalogController.blacklight_config) }
|
6
|
-
let(:relation_resp) { described_class.new(
|
7
|
-
let(:empty_relation_resp) { described_class.new(
|
8
|
-
describe
|
9
|
-
it
|
7
|
+
let(:relation_resp) { described_class.new("nyu_2451_34502", repository) }
|
8
|
+
let(:empty_relation_resp) { described_class.new("harvard-g7064-s2-1834-k3", repository) }
|
9
|
+
describe "#initialize" do
|
10
|
+
it "creates a RelationResponse" do
|
10
11
|
expect(relation_resp).to be_an described_class
|
11
12
|
end
|
12
13
|
end
|
13
14
|
|
14
|
-
describe
|
15
|
-
it
|
16
|
-
expect(relation_resp.SOURCE_ANCESTORS).to include(
|
17
|
-
expect(relation_resp.SOURCE_ANCESTORS).to include(
|
15
|
+
describe "#method_missing" do
|
16
|
+
it "returns a hash of ancestor documents" do
|
17
|
+
expect(relation_resp.SOURCE_ANCESTORS).to include("numFound")
|
18
|
+
expect(relation_resp.SOURCE_ANCESTORS).to include("docs")
|
18
19
|
end
|
19
20
|
|
20
|
-
it
|
21
|
-
expect(relation_resp.SOURCE_DESCENDANTS).to include(
|
22
|
-
expect(relation_resp.SOURCE_DESCENDANTS).to include(
|
21
|
+
it "returns a hash of descendant documents" do
|
22
|
+
expect(relation_resp.SOURCE_DESCENDANTS).to include("numFound")
|
23
|
+
expect(relation_resp.SOURCE_DESCENDANTS).to include("docs")
|
23
24
|
end
|
24
25
|
|
25
|
-
it
|
26
|
+
it "raises no method error" do
|
26
27
|
expect { relation_resp.FAIL }.to raise_error NoMethodError
|
27
28
|
end
|
28
29
|
end
|
29
30
|
|
30
|
-
describe
|
31
|
-
it
|
31
|
+
describe "#respond_to_missing?" do
|
32
|
+
it "returns true for configured relationships" do
|
32
33
|
Settings.RELATIONSHIPS_SHOWN.each_key do |key|
|
33
34
|
expect(relation_resp).to respond_to(key)
|
34
35
|
end
|
35
36
|
end
|
36
37
|
|
37
|
-
it
|
38
|
-
expect(relation_resp).not_to respond_to(
|
38
|
+
it "returns false for non-configured options" do
|
39
|
+
expect(relation_resp).not_to respond_to("fail")
|
39
40
|
end
|
40
41
|
end
|
41
42
|
|
42
|
-
describe
|
43
|
-
it
|
43
|
+
describe "#query_type" do
|
44
|
+
it "fails for a bad query type request" do
|
44
45
|
# Cache the existing relationship values and add a test value
|
45
46
|
relationships = Settings.RELATIONSHIPS_SHOWN
|
46
47
|
Settings.add_source!({
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
48
|
+
RELATIONSHIPS_SHOWN: {
|
49
|
+
BAD: {
|
50
|
+
field: "dct_source_sm",
|
51
|
+
query_type: "bad_query_type",
|
52
|
+
icon: "pagelines-brands",
|
53
|
+
label: "geoblacklight.relations.source_ancestor"
|
54
|
+
}
|
55
|
+
}
|
56
|
+
})
|
56
57
|
Settings.reload!
|
57
58
|
|
58
59
|
expect { relation_resp.BAD }.to raise_error(ArgumentError)
|
@@ -1,25 +1,26 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
require 'spec_helper'
|
3
2
|
|
4
|
-
|
5
|
-
class GeoblacklightControllerTestClass
|
6
|
-
include AbstractController::Translation
|
7
|
-
attr_accessor :params
|
8
|
-
end
|
3
|
+
require "spec_helper"
|
9
4
|
|
5
|
+
class GeoblacklightControllerTestClass
|
6
|
+
include AbstractController::Translation
|
7
|
+
attr_accessor :params
|
8
|
+
end
|
9
|
+
|
10
|
+
describe Geoblacklight::ViewHelperOverride do
|
10
11
|
let(:fake_controller) do
|
11
12
|
GeoblacklightControllerTestClass.new
|
12
|
-
|
13
|
+
.extend(described_class)
|
13
14
|
end
|
14
15
|
|
15
|
-
describe
|
16
|
-
it
|
16
|
+
describe "render_search_to_s_bbox" do
|
17
|
+
it "returns an empty string for no bbox" do
|
17
18
|
fake_controller.params = {}
|
18
|
-
expect(fake_controller.render_search_to_s_bbox(fake_controller.params)).to eq
|
19
|
+
expect(fake_controller.render_search_to_s_bbox(fake_controller.params)).to eq ""
|
19
20
|
end
|
20
|
-
it
|
21
|
-
fake_controller.params = {
|
22
|
-
params = {
|
21
|
+
it "returns render_search_to_s_element when bbox is present" do
|
22
|
+
fake_controller.params = {bbox: "123"}
|
23
|
+
params = {"bbox" => "123"}
|
23
24
|
expect(fake_controller).to receive(:render_search_to_s_element)
|
24
25
|
expect(fake_controller).to receive(:render_filter_value)
|
25
26
|
fake_controller.render_search_to_s_bbox(params)
|
@@ -1,38 +1,39 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
2
|
+
|
3
|
+
require "spec_helper"
|
3
4
|
|
4
5
|
describe Geoblacklight::FeatureInfoResponse do
|
5
|
-
let(:response) { described_class.new(OpenStruct.new(body:
|
6
|
-
let(:response_multiple_features) { described_class.new(OpenStruct.new(body:
|
7
|
-
let(:error_response) { described_class.new(error:
|
8
|
-
let(:content_response) { described_class.new(OpenStruct.new(headers: {
|
6
|
+
let(:response) { described_class.new(OpenStruct.new(body: "<html><body><table><th>Header1</th><th>Header2</th><td>value1</td><td>value2</td></body></html>", headers: {"content-type" => "all good"})) }
|
7
|
+
let(:response_multiple_features) { described_class.new(OpenStruct.new(body: "<html><body><table><th>Header1</th><th>Header2</th><tr><td>value1</td><td>value2</td></tr><tr><td>value3</td><td>value4</td></tr></body></html>", headers: {"content-type" => "all good"})) }
|
8
|
+
let(:error_response) { described_class.new(error: "bad stuff") }
|
9
|
+
let(:content_response) { described_class.new(OpenStruct.new(headers: {"content-type" => "text/xml"})) }
|
9
10
|
|
10
|
-
describe
|
11
|
-
it
|
11
|
+
describe "#initialize" do
|
12
|
+
it "initializes as a FeatureInfoResponse type" do
|
12
13
|
expect(response).to be_an described_class
|
13
14
|
end
|
14
15
|
end
|
15
16
|
|
16
|
-
describe
|
17
|
-
it
|
17
|
+
describe "#error?" do
|
18
|
+
it "if no error" do
|
18
19
|
expect(response.error?).to be_falsey
|
19
20
|
end
|
20
|
-
it
|
21
|
+
it "if error key is present" do
|
21
22
|
expect(error_response.error?).to be_truthy
|
22
23
|
end
|
23
|
-
it
|
24
|
+
it "if content-type header is text/xml" do
|
24
25
|
expect(content_response.error?).to be_truthy
|
25
26
|
end
|
26
27
|
end
|
27
28
|
|
28
|
-
describe
|
29
|
-
it
|
29
|
+
describe "#format" do
|
30
|
+
it "returns a formated response" do
|
30
31
|
expect(response.format).not_to be_nil
|
31
32
|
expect(response.format[:values].length).to eq 2
|
32
33
|
expect(response.format[:values][0]).to eq %w[Header1 value1]
|
33
34
|
expect(response.format[:values][1]).to eq %w[Header2 value2]
|
34
35
|
end
|
35
|
-
it
|
36
|
+
it "returns a formated response when multiple features are retrieved" do
|
36
37
|
expect(response_multiple_features.format).not_to be_nil
|
37
38
|
expect(response_multiple_features.format[:values].length).to eq 2
|
38
39
|
expect(response_multiple_features.format[:values][0]).to eq %w[Header1 value1]
|
@@ -40,12 +41,12 @@ describe Geoblacklight::FeatureInfoResponse do
|
|
40
41
|
end
|
41
42
|
end
|
42
43
|
|
43
|
-
describe
|
44
|
-
it
|
44
|
+
describe "#check" do
|
45
|
+
it "returns a formated response if no errors" do
|
45
46
|
expect(response.check).to eq response.format
|
46
47
|
end
|
47
|
-
it
|
48
|
-
expect(error_response.check).to eq error_response.instance_variable_get(
|
48
|
+
it "returns the unformated response if there are errors" do
|
49
|
+
expect(error_response.check).to eq error_response.instance_variable_get(:@response)
|
49
50
|
end
|
50
51
|
end
|
51
52
|
end
|