geoblacklight 2.1.2 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +214 -108
- data/.gitignore +3 -1
- data/.rubocop.yml +19 -15
- data/.rubocop_todo.yml +28 -159
- data/Gemfile +3 -8
- data/README.md +6 -7
- data/Rakefile +1 -0
- data/app/assets/images/blacklight/arrow-circle-down.svg +3 -0
- data/app/assets/images/blacklight/baruch-cuny.svg +3 -0
- data/app/assets/images/blacklight/berkeley.svg +4 -0
- data/app/assets/images/blacklight/book.svg +3 -0
- data/app/assets/images/blacklight/bookmark.svg +3 -0
- data/app/assets/images/blacklight/cd-rom.svg +3 -0
- data/app/assets/images/blacklight/chicago.svg +4 -0
- data/app/assets/images/blacklight/citation.svg +3 -0
- data/app/assets/images/blacklight/collection.svg +3 -0
- data/app/assets/images/blacklight/columbia.svg +3 -0
- data/app/assets/images/blacklight/cornell.svg +5 -0
- data/app/assets/images/blacklight/dvd-rom.svg +3 -0
- data/app/assets/images/blacklight/email.svg +3 -0
- data/app/assets/images/blacklight/esri-globe.svg +31 -37
- data/app/assets/images/blacklight/geoblacklight-icons.json +2079 -0
- data/app/assets/images/blacklight/globe.svg +3 -0
- data/app/assets/images/blacklight/harvard.svg +3 -0
- data/app/assets/images/blacklight/home.svg +3 -0
- data/app/assets/images/blacklight/illinois.svg +4 -0
- data/app/assets/images/blacklight/image.svg +3 -0
- data/app/assets/images/blacklight/indiana.svg +3 -0
- data/app/assets/images/blacklight/iowa.svg +3 -0
- data/app/assets/images/blacklight/leaf.svg +3 -0
- data/app/assets/images/blacklight/lewis-clark.svg +5 -0
- data/app/assets/images/blacklight/line.svg +4 -0
- data/app/assets/images/blacklight/logo.svg +1 -0
- data/app/assets/images/blacklight/map-marker.svg +3 -0
- data/app/assets/images/blacklight/map.svg +3 -0
- data/app/assets/images/blacklight/maryland.svg +3 -0
- data/app/assets/images/blacklight/massgis.svg +3 -0
- data/app/assets/images/blacklight/metadata.svg +3 -0
- data/app/assets/images/blacklight/michigan-state.svg +4 -0
- data/app/assets/images/blacklight/michigan.svg +3 -0
- data/app/assets/images/blacklight/minnesota.svg +3 -0
- data/app/assets/images/blacklight/mit.svg +3 -0
- data/app/assets/images/blacklight/mixed.svg +5 -0
- data/app/assets/images/blacklight/multilinestring.svg +6 -0
- data/app/assets/images/blacklight/multipoint.svg +3 -0
- data/app/assets/images/blacklight/multipolygon.svg +6 -0
- data/app/assets/images/blacklight/nyu.svg +6 -0
- data/app/assets/images/blacklight/ohio-state.svg +5 -0
- data/app/assets/images/blacklight/pagelines-brands.svg +3 -0
- data/app/assets/images/blacklight/paper-map.svg +3 -0
- data/app/assets/images/blacklight/penn-state.svg +4 -0
- data/app/assets/images/blacklight/point.svg +3 -0
- data/app/assets/images/blacklight/polygon.svg +4 -0
- data/app/assets/images/blacklight/polyline.svg +6 -0
- data/app/assets/images/blacklight/princeton.svg +3 -0
- data/app/assets/images/blacklight/public.svg +3 -0
- data/app/assets/images/blacklight/purdue.svg +4 -0
- data/app/assets/images/blacklight/raster.svg +3 -0
- data/app/assets/images/blacklight/restricted.svg +3 -0
- data/app/assets/images/blacklight/sms.svg +3 -0
- data/app/assets/images/blacklight/stanford.svg +3 -0
- data/app/assets/images/blacklight/table.svg +3 -0
- data/app/assets/images/blacklight/tags.svg +3 -0
- data/app/assets/images/blacklight/texas.svg +3 -0
- data/app/assets/images/blacklight/tufts.svg +3 -0
- data/app/assets/images/blacklight/ucla.svg +3 -0
- data/app/assets/images/blacklight/uva.svg +3 -0
- data/app/assets/images/blacklight/web_services.svg +3 -0
- data/app/assets/images/blacklight/wisconsin.svg +3 -0
- data/app/assets/javascripts/geoblacklight/basemaps.js +18 -0
- data/app/assets/javascripts/geoblacklight/downloaders/downloader.js +1 -1
- data/app/assets/javascripts/geoblacklight/modules/geosearch.js +1 -1
- data/app/assets/javascripts/geoblacklight/modules/help_text.js +7 -0
- data/app/assets/javascripts/geoblacklight/modules/home.js +1 -1
- data/app/assets/javascripts/geoblacklight/modules/item.js +19 -2
- data/app/assets/javascripts/geoblacklight/modules/results.js +4 -2
- data/app/assets/javascripts/geoblacklight/modules/svg_tooltips.js +31 -0
- data/app/assets/javascripts/geoblacklight/viewers/esri.js +2 -2
- data/app/assets/javascripts/geoblacklight/viewers/esri/tiled_map_layer.js +1 -1
- data/app/assets/javascripts/geoblacklight/viewers/oembed.js +13 -0
- data/app/assets/javascripts/geoblacklight/viewers/wms.js +2 -2
- data/app/assets/stylesheets/geoblacklight/geoblacklight.scss +2 -0
- data/app/assets/stylesheets/geoblacklight/modules/_base.scss +33 -0
- data/app/assets/stylesheets/geoblacklight/{_blacklight_overrides.scss → modules/_blacklight_overrides.scss} +8 -9
- data/app/assets/stylesheets/geoblacklight/{_styles.scss → modules/_styles.scss} +1 -0
- data/app/assets/stylesheets/geoblacklight/modules/downloads.scss +37 -54
- data/app/assets/stylesheets/geoblacklight/modules/icon-customization.scss +49 -59
- data/app/assets/stylesheets/geoblacklight/modules/item.scss +17 -0
- data/app/assets/stylesheets/geoblacklight/modules/results.scss +47 -28
- data/app/assets/stylesheets/geoblacklight/modules/sidebar.scss +12 -42
- data/app/assets/stylesheets/geoblacklight/modules/toolbar.scss +17 -55
- data/app/controllers/download_controller.rb +12 -12
- data/app/controllers/relation_controller.rb +1 -0
- data/app/controllers/wms_controller.rb +1 -0
- data/app/helpers/arcgis_helper.rb +1 -0
- data/app/helpers/blacklight_helper.rb +1 -0
- data/app/helpers/carto_helper.rb +1 -0
- data/app/helpers/geoblacklight_helper.rb +62 -19
- data/app/models/concerns/geoblacklight/solr_document.rb +18 -8
- data/app/models/concerns/geoblacklight/solr_document/arcgis.rb +2 -1
- data/app/models/concerns/geoblacklight/solr_document/carto.rb +1 -13
- data/app/models/concerns/geoblacklight/solr_document/citation.rb +29 -0
- data/app/models/concerns/geoblacklight/solr_document/finder.rb +1 -0
- data/app/models/concerns/geoblacklight/solr_document/inspection.rb +2 -1
- data/app/models/concerns/geoblacklight/spatial_search_behavior.rb +8 -1
- data/app/presenters/geoblacklight/document_presenter.rb +2 -1
- data/app/views/catalog/_arcgis.html.erb +4 -0
- data/app/views/catalog/_carto.html.erb +4 -0
- data/app/views/catalog/_citation.html.erb +11 -0
- data/app/views/catalog/_data_dictionary.html.erb +3 -2
- data/app/views/catalog/_document_action.html.erb +1 -1
- data/app/views/catalog/_document_split.html.erb +1 -1
- data/app/views/catalog/_downloads_primary.html.erb +8 -1
- data/app/views/catalog/_header_icons.html.erb +3 -3
- data/app/views/catalog/_home_text.html.erb +8 -5
- data/app/views/catalog/_index_split_default.html.erb +22 -14
- data/app/views/catalog/_show_default_viewer_container.html.erb +6 -1
- data/app/views/catalog/_show_header_default.html.erb +2 -4
- data/app/views/catalog/_web_services_wfs.html.erb +3 -3
- data/app/views/catalog/_web_services_wms.html.erb +3 -3
- data/app/views/catalog/metadata.html.erb +3 -1
- data/app/views/catalog/web_services.html.erb +9 -7
- data/app/views/relation/_ancestors.html.erb +3 -5
- data/app/views/relation/_descendants.html.erb +4 -6
- data/app/views/relation/index.html.erb +20 -8
- data/app/views/relation/index.json.jbuilder +2 -1
- data/app/views/shared/_header_navbar.html.erb +1 -1
- data/bin/coverage.rb +36 -0
- data/config/initializers/rails_config.rb +1 -0
- data/config/locales/geoblacklight.en.yml +75 -2
- data/geoblacklight.gemspec +6 -8
- data/lib/generators/geoblacklight/assets_generator.rb +46 -0
- data/lib/generators/geoblacklight/install_generator.rb +8 -9
- data/lib/generators/geoblacklight/templates/assets/_blacklight.scss +1 -0
- data/lib/generators/geoblacklight/templates/assets/_customizations.scss +28 -0
- data/{app/assets/stylesheets/geoblacklight/application.scss → lib/generators/geoblacklight/templates/assets/_geoblacklight.scss} +0 -1
- data/lib/generators/geoblacklight/templates/assets/application.scss +7 -0
- data/lib/generators/geoblacklight/templates/{geoblacklight.js → assets/geoblacklight.js} +0 -1
- data/lib/generators/geoblacklight/templates/catalog_controller.rb +6 -2
- data/lib/generators/geoblacklight/templates/settings.yml +17 -0
- data/lib/generators/geoblacklight/webpacker_generator.rb +2 -1
- data/lib/geoblacklight.rb +1 -0
- data/lib/geoblacklight/bounding_box.rb +1 -0
- data/lib/geoblacklight/catalog_helper_override.rb +2 -1
- data/lib/geoblacklight/constants.rb +4 -2
- data/lib/geoblacklight/download.rb +6 -5
- data/lib/geoblacklight/download/geojson_download.rb +1 -0
- data/lib/geoblacklight/download/geotiff_download.rb +1 -0
- data/lib/geoblacklight/download/hgl_download.rb +1 -0
- data/lib/geoblacklight/download/kmz_download.rb +2 -1
- data/lib/geoblacklight/download/shapefile_download.rb +1 -0
- data/lib/geoblacklight/engine.rb +1 -2
- data/lib/geoblacklight/exceptions.rb +1 -0
- data/lib/geoblacklight/geoblacklight_helper_behavior.rb +1 -0
- data/lib/geoblacklight/item_viewer.rb +6 -1
- data/lib/geoblacklight/metadata.rb +1 -0
- data/lib/geoblacklight/metadata/base.rb +16 -10
- data/lib/geoblacklight/metadata/fgdc.rb +1 -0
- data/lib/geoblacklight/metadata/html.rb +2 -2
- data/lib/geoblacklight/metadata/iso19139.rb +1 -0
- data/lib/geoblacklight/metadata_transformer.rb +1 -0
- data/lib/geoblacklight/metadata_transformer/base.rb +1 -0
- data/lib/geoblacklight/metadata_transformer/fgdc.rb +1 -0
- data/lib/geoblacklight/metadata_transformer/iso19139.rb +1 -0
- data/lib/geoblacklight/reference.rb +3 -1
- data/lib/geoblacklight/references.rb +7 -3
- data/lib/geoblacklight/relation/ancestors.rb +2 -1
- data/lib/geoblacklight/relation/descendants.rb +2 -1
- data/lib/geoblacklight/relation/relation_response.rb +2 -1
- data/lib/geoblacklight/routes.rb +1 -0
- data/lib/geoblacklight/routes/downloadable.rb +1 -0
- data/lib/geoblacklight/routes/exportable.rb +1 -0
- data/lib/geoblacklight/routes/wms.rb +1 -0
- data/lib/geoblacklight/version.rb +2 -1
- data/lib/geoblacklight/view_helper_override.rb +2 -1
- data/lib/geoblacklight/wms_layer.rb +3 -2
- data/lib/geoblacklight/wms_layer/feature_info_response.rb +1 -0
- data/lib/tasks/geoblacklight.rake +33 -32
- data/package.json +4 -0
- data/schema/references.md +2 -1
- data/solr/conf/schema.xml +5 -5
- data/spec/controllers/catalog_controller_spec.rb +1 -0
- data/spec/controllers/download_controller_spec.rb +2 -1
- data/spec/controllers/relation_controller_spec.rb +1 -0
- data/spec/controllers/wms_controller_spec.rb +2 -1
- data/spec/factories/user.rb +1 -0
- data/spec/features/bookmarks_spec.rb +1 -0
- data/spec/features/configurable_basemap_spec.rb +10 -0
- data/spec/features/data_dictionary_download_spec.rb +1 -0
- data/spec/features/download_layer_spec.rb +1 -0
- data/spec/features/empty_search_spec.rb +1 -0
- data/spec/features/esri_viewer_spec.rb +1 -6
- data/spec/features/exports_spec.rb +4 -3
- data/spec/features/help_text_spec.rb +9 -0
- data/spec/features/home_page_spec.rb +6 -0
- data/spec/features/iiif_viewer_spec.rb +1 -0
- data/spec/features/index_map_spec.rb +1 -0
- data/spec/features/layer_inspection_spec.rb +1 -0
- data/spec/features/layer_opacity_spec.rb +1 -0
- data/spec/features/layer_preview_spec.rb +1 -0
- data/spec/features/layer_with_no_references_spec.rb +1 -0
- data/spec/features/linkified_attribute_table_spec.rb +1 -0
- data/spec/features/metadata_panel_spec.rb +52 -8
- data/spec/features/missing_metadata_spec.rb +13 -0
- data/spec/features/multiple_downloads_spec.rb +15 -0
- data/spec/features/oembed_spec.rb +10 -0
- data/spec/features/relations_spec.rb +10 -28
- data/spec/features/saved_searches_spec.rb +1 -0
- data/spec/features/search_bar_spec.rb +1 -0
- data/spec/features/search_results_map_spec.rb +2 -7
- data/spec/features/search_results_overlap_ratio_spec.rb +4 -3
- data/spec/features/search_spec.rb +1 -0
- data/spec/features/show_page_metadata_spec.rb +1 -0
- data/spec/features/sms_spec.rb +1 -0
- data/spec/features/split_view.html.erb_spec.rb +5 -4
- data/spec/features/suppressed_records_spec.rb +15 -0
- data/spec/features/web_services_modal_spec.rb +1 -0
- data/spec/fixtures/fgdc/harvard-g7064-s2-1834-k3.xml +1 -0
- data/spec/fixtures/iso19139/stanford-cg357zz0321.xml +581 -0
- data/spec/fixtures/mods/fb897vt9938.mods +111 -0
- data/spec/fixtures/mods/stanford-cg357zz0321.mods +113 -0
- data/spec/fixtures/solr_documents/iiif-eastern-hemisphere.json +1 -1
- data/spec/fixtures/solr_documents/metadata_no_dct_provenance_s.json +30 -0
- data/spec/fixtures/solr_documents/metadata_no_layer_geom_type_s.json +17 -0
- data/spec/fixtures/solr_documents/metadata_no_solr_geom.json +23 -0
- data/spec/fixtures/solr_documents/multiple-downloads.json +30 -0
- data/spec/fixtures/solr_documents/oembed.json +24 -0
- data/spec/helpers/arcgis_helper_spec.rb +1 -0
- data/spec/helpers/carto_helper_spec.rb +1 -0
- data/spec/helpers/geoblacklight_helper_spec.rb +81 -12
- data/spec/javascripts/geoblacklight/viewers/esri/tiled_map_layer_spec.js +12 -0
- data/spec/javascripts/metadata_download_button_spec.js +1 -1
- data/spec/lib/geoblacklight/bounding_box_spec.rb +1 -0
- data/spec/lib/geoblacklight/controller_override_spec.rb +1 -0
- data/spec/lib/geoblacklight/document_presenter_spec.rb +3 -2
- data/spec/lib/geoblacklight/download/geojson_download_spec.rb +1 -0
- data/spec/lib/geoblacklight/download/geotiff_download_spec.rb +1 -0
- data/spec/lib/geoblacklight/download/hgl_download_spec.rb +1 -0
- data/spec/lib/geoblacklight/download/kmz_download_spec.rb +1 -0
- data/spec/lib/geoblacklight/download/shapefile_download_spec.rb +1 -0
- data/spec/lib/geoblacklight/download_spec.rb +4 -3
- data/spec/lib/geoblacklight/geoblacklight_helper_behavior_spec.rb +1 -0
- data/spec/lib/geoblacklight/item_viewer_spec.rb +1 -0
- data/spec/lib/geoblacklight/metadata/base_spec.rb +22 -7
- data/spec/lib/geoblacklight/metadata/html_spec.rb +1 -0
- data/spec/lib/geoblacklight/metadata_spec.rb +1 -0
- data/spec/lib/geoblacklight/metadata_transformer/base_spec.rb +3 -2
- data/spec/lib/geoblacklight/metadata_transformer/fgdc_spec.rb +3 -2
- data/spec/lib/geoblacklight/metadata_transformer/iso19139_spec.rb +3 -2
- data/spec/lib/geoblacklight/metadata_transformer_spec.rb +4 -3
- data/spec/lib/geoblacklight/reference_spec.rb +31 -0
- data/spec/lib/geoblacklight/references_spec.rb +2 -3
- data/spec/lib/geoblacklight/relation/ancestors_spec.rb +2 -1
- data/spec/lib/geoblacklight/relation/descendants_spec.rb +2 -1
- data/spec/lib/geoblacklight/relation/relation_response_spec.rb +1 -0
- data/spec/lib/geoblacklight/view_helper_override_spec.rb +1 -0
- data/spec/lib/geoblacklight/wms_layer/feature_info_response_spec.rb +5 -4
- data/spec/lib/geoblacklight/wms_layer_spec.rb +3 -2
- data/spec/models/concerns/geoblacklight/solr_document/carto_spec.rb +1 -20
- data/spec/models/concerns/geoblacklight/solr_document/citation_spec.rb +14 -0
- data/spec/models/concerns/geoblacklight/solr_document/finder_spec.rb +1 -0
- data/spec/models/concerns/geoblacklight/solr_document/inspection_spec.rb +1 -0
- data/spec/models/concerns/geoblacklight/solr_document_spec.rb +47 -0
- data/spec/models/concerns/geoblacklight/spatial_search_behavior_spec.rb +15 -2
- data/spec/routing/catalog_routing_spec.rb +1 -0
- data/spec/spec_helper.rb +20 -14
- data/spec/support/backport_test_helpers.rb +1 -0
- data/spec/support/features.rb +1 -0
- data/spec/support/features/session_helpers.rb +1 -0
- data/spec/support/fixtures.rb +8 -0
- data/spec/tasks/geoblacklight_spec.rb +19 -0
- data/spec/teaspoon_env.rb +1 -0
- data/spec/test_app_templates/Gemfile.extra +1 -0
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +1 -0
- data/spec/views/catalog/_document_split.html.erb_spec.rb +1 -0
- data/spec/views/catalog/_index_split.html.erb_spec.rb +1 -0
- data/spec/views/catalog/_results_pagination.html.erb_spec.rb +1 -0
- data/spec/views/catalog/_show_downloads.html.erb_spec.rb +1 -0
- data/spec/views/catalog/_show_tools.html.erb_spec.rb +2 -4
- data/template.rb +1 -0
- data/vendor/assets/stylesheets/leaflet.css +0 -1
- metadata +158 -75
- data/app/assets/images/blacklight/logo.png +0 -0
- data/app/assets/javascripts/geoblacklight/modules/collapse.js +0 -7
- data/app/assets/stylesheets/geoblacklight/_geoblacklight.scss +0 -36
- data/app/assets/stylesheets/geoblacklight/modules/relations.scss +0 -15
- data/app/views/catalog/_exports.html.erb +0 -11
- data/app/views/catalog/_show_tools.html.erb +0 -25
- data/lib/generators/geoblacklight/templates/geoblacklight.scss +0 -4
- data/vendor/assets/javascripts/readmore.min.js +0 -11
@@ -0,0 +1,12 @@
|
|
1
|
+
//= require geoblacklight
|
2
|
+
|
3
|
+
describe('setupInspection', function() {
|
4
|
+
describe('Inspect attribute on the map', function() {
|
5
|
+
it('identifyFeatures is defined', function() {
|
6
|
+
expect(L.esri.identifyFeatures).toBeDefined();
|
7
|
+
});
|
8
|
+
it('Tasks is not defined', function() {
|
9
|
+
expect(L.esri.Tasks).toBeUndefined();
|
10
|
+
});
|
11
|
+
});
|
12
|
+
});
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
describe('MetadataDownloadButton', function() {
|
4
4
|
describe('initialize', function() {
|
5
|
-
fixture.set('<button id="foo" data-ref-endpoint="http://testdomain" data-ref-download="#bar">test element</button><a href="http://
|
5
|
+
fixture.set('<button id="foo" data-ref-endpoint="http://testdomain" data-ref-download="#bar">test element</button><a href="http://testdomain" id="bar">another test element</a>');
|
6
6
|
|
7
7
|
it('creates a new instance and sets the download button @href value', function() {
|
8
8
|
var button = new GeoBlacklight.MetadataDownloadButton('#foo');
|
@@ -1,7 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require 'spec_helper'
|
2
3
|
|
3
4
|
describe Geoblacklight::DocumentPresenter do
|
4
5
|
# Please see https://github.com/projectblacklight/blacklight/blob/v6.15.0/spec/presenters/index_presenter_spec.rb#L4
|
6
|
+
subject { presenter }
|
5
7
|
let(:request_context) { double(document_index_view_type: 'list') }
|
6
8
|
let(:blacklight_config) do
|
7
9
|
Blacklight::Configuration.new.configure do |config|
|
@@ -12,7 +14,6 @@ describe Geoblacklight::DocumentPresenter do
|
|
12
14
|
end
|
13
15
|
end
|
14
16
|
let(:solr_fields) { Settings.FIELDS }
|
15
|
-
subject { presenter }
|
16
17
|
let(:presenter) do
|
17
18
|
described_class.new(document, request_context, blacklight_config)
|
18
19
|
end
|
@@ -23,7 +24,7 @@ describe Geoblacklight::DocumentPresenter do
|
|
23
24
|
layer_id_s: 'druid:abc123',
|
24
25
|
non_index_field: 'do not render',
|
25
26
|
period: 'Ends with period.',
|
26
|
-
multi_display: %w
|
27
|
+
multi_display: %w[blue blah]
|
27
28
|
)
|
28
29
|
end
|
29
30
|
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require 'spec_helper'
|
2
3
|
|
3
4
|
describe Geoblacklight::Download do
|
@@ -31,7 +32,7 @@ describe Geoblacklight::Download do
|
|
31
32
|
end
|
32
33
|
describe '#file_path' do
|
33
34
|
it 'returns the path with name and extension' do
|
34
|
-
expect(download.class.file_path).to eq
|
35
|
+
expect(download.class.file_path).to eq Rails.root.join('tmp', 'cache', 'downloads')
|
35
36
|
end
|
36
37
|
it 'is configurable' do
|
37
38
|
expect(Settings).to receive(:DOWNLOAD_PATH).and_return('configured/path')
|
@@ -141,14 +142,14 @@ describe Geoblacklight::Download do
|
|
141
142
|
|
142
143
|
it 'raises Geoblacklight::Exceptions::ExternalDownloadFailed with a connection failure' do
|
143
144
|
expect(faraday_connection).to receive(:url_prefix).and_return 'http://www.example.com/wms'
|
144
|
-
expect(faraday_connection).to receive(:get).and_raise(Faraday::
|
145
|
+
expect(faraday_connection).to receive(:get).and_raise(Faraday::ConnectionFailed.new('Failed'))
|
145
146
|
expect(Faraday).to receive(:new).with(url: 'http://www.example.com/wms').and_return(faraday_connection)
|
146
147
|
expect { download.initiate_download }.to raise_error(Geoblacklight::Exceptions::ExternalDownloadFailed)
|
147
148
|
end
|
148
149
|
|
149
150
|
it 'raises Geoblacklight::Exceptions::ExternalDownloadFailed with a connection timout' do
|
150
151
|
expect(faraday_connection).to receive(:url_prefix).and_return 'http://www.example.com/wms'
|
151
|
-
expect(faraday_connection).to receive(:get).and_raise(Faraday::
|
152
|
+
expect(faraday_connection).to receive(:get).and_raise(Faraday::TimeoutError)
|
152
153
|
expect(Faraday).to receive(:new).with(url: 'http://www.example.com/wms').and_return(faraday_connection)
|
153
154
|
expect { download.initiate_download }.to raise_error(Geoblacklight::Exceptions::ExternalDownloadFailed)
|
154
155
|
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require 'spec_helper'
|
2
3
|
|
3
4
|
describe Geoblacklight::Metadata::Base do
|
@@ -9,11 +10,11 @@ describe Geoblacklight::Metadata::Base do
|
|
9
10
|
Geoblacklight::Reference.new(['http://www.loc.gov/mods/v3', 'http://purl.stanford.edu/cg357zz0321.mods'])
|
10
11
|
end
|
11
12
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
end
|
13
|
+
before do
|
14
|
+
allow(Faraday).to receive(:new).with(url: 'http://purl.stanford.edu/cg357zz0321.mods').and_return(connection)
|
15
|
+
end
|
16
16
|
|
17
|
+
describe '#document' do
|
17
18
|
context 'with valid XML data at an endpoint URL' do
|
18
19
|
before do
|
19
20
|
allow(response).to receive(:status).and_return(200)
|
@@ -30,7 +31,7 @@ describe Geoblacklight::Metadata::Base do
|
|
30
31
|
subject { metadata.document }
|
31
32
|
|
32
33
|
before do
|
33
|
-
allow(connection).to receive(:get).and_raise(Faraday::
|
34
|
+
allow(connection).to receive(:get).and_raise(Faraday::ConnectionFailed, 'test connection failures')
|
34
35
|
end
|
35
36
|
|
36
37
|
it 'returns nil when a connection error' do
|
@@ -40,6 +41,20 @@ describe Geoblacklight::Metadata::Base do
|
|
40
41
|
end
|
41
42
|
end
|
42
43
|
|
44
|
+
context 'when attempts to connect to an endpoint URL raise an OpenSSL error' do
|
45
|
+
subject { metadata.document }
|
46
|
+
|
47
|
+
before do
|
48
|
+
expect(Geoblacklight.logger).to receive(:error).with(/dh key too small/)
|
49
|
+
allow(connection).to receive(:get).and_raise(OpenSSL::SSL::SSLError, 'dh key too small')
|
50
|
+
end
|
51
|
+
|
52
|
+
it 'returns nil when a connection error' do
|
53
|
+
expect(subject).to be_a Nokogiri::XML::Document
|
54
|
+
expect(subject.children.empty?).to be true
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
43
58
|
describe '#blank?' do
|
44
59
|
before do
|
45
60
|
allow(Faraday).to receive(:new).with(url: 'http://purl.stanford.edu/cg357zz0321.mods').and_return(connection)
|
@@ -59,7 +74,7 @@ describe Geoblacklight::Metadata::Base do
|
|
59
74
|
|
60
75
|
context 'when attempts to connect to an endpoint URL fail' do
|
61
76
|
before do
|
62
|
-
allow(connection).to receive(:get).and_raise(Faraday::
|
77
|
+
allow(connection).to receive(:get).and_raise(Faraday::ConnectionFailed, 'test connection failures')
|
63
78
|
end
|
64
79
|
|
65
80
|
it 'returns true' do
|
@@ -130,7 +145,7 @@ describe Geoblacklight::Metadata::Base do
|
|
130
145
|
context 'when requesting the metadata resource times out' do
|
131
146
|
before do
|
132
147
|
allow(geocombine_metadata).to receive(:to_html).and_return('')
|
133
|
-
allow(connection).to receive(:get).and_raise(Faraday::
|
148
|
+
allow(connection).to receive(:get).and_raise(Faraday::TimeoutError)
|
134
149
|
allow(Geoblacklight.logger).to receive(:error).with('#<Faraday::TimeoutError #<Faraday::TimeoutError: timeout>>')
|
135
150
|
end
|
136
151
|
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require 'spec_helper'
|
2
3
|
|
3
4
|
describe Geoblacklight::MetadataTransformer::Base do
|
@@ -8,8 +9,8 @@ describe Geoblacklight::MetadataTransformer::Base do
|
|
8
9
|
end
|
9
10
|
|
10
11
|
context 'with metadata types without XSL Stylesheets' do
|
11
|
-
let(:metadata) { instance_double(GeoCombine::Metadata) }
|
12
12
|
subject { described_class.new(metadata) }
|
13
|
+
let(:metadata) { instance_double(GeoCombine::Metadata) }
|
13
14
|
describe '#transform' do
|
14
15
|
before do
|
15
16
|
allow(metadata).to receive(:to_html).and_raise(NoMethodError, 'undefined method `to_html\'')
|
@@ -21,8 +22,8 @@ describe Geoblacklight::MetadataTransformer::Base do
|
|
21
22
|
end
|
22
23
|
|
23
24
|
context 'with metadata types with XSL Stylesheets but invalid HTML' do
|
24
|
-
let(:metadata) { instance_double(GeoCombine::Metadata) }
|
25
25
|
subject { described_class.new(metadata) }
|
26
|
+
let(:metadata) { instance_double(GeoCombine::Metadata) }
|
26
27
|
describe '#transform' do
|
27
28
|
before do
|
28
29
|
allow(metadata).to receive(:to_html).and_return('<invalid-html></invalid-html>')
|
@@ -1,11 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require 'spec_helper'
|
2
3
|
|
3
4
|
describe Geoblacklight::MetadataTransformer::Fgdc do
|
4
|
-
let(:fgdc_html) { File.read(File.join(Rails.root, 'spec', 'fixtures', 'metadata', 'fgdc.html')) }
|
5
|
-
let(:metadata) { instance_double('Geoblacklight::Metadata::Fgdc') }
|
6
5
|
subject do
|
7
6
|
described_class.new(metadata)
|
8
7
|
end
|
8
|
+
let(:fgdc_html) { File.read(Rails.root.join('spec', 'fixtures', 'metadata', 'fgdc.html')) }
|
9
|
+
let(:metadata) { instance_double('Geoblacklight::Metadata::Fgdc') }
|
9
10
|
|
10
11
|
describe '#transform' do
|
11
12
|
before do
|
@@ -1,11 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require 'spec_helper'
|
2
3
|
|
3
4
|
describe Geoblacklight::MetadataTransformer::Iso19139 do
|
4
|
-
let(:iso_html) { File.read(File.join(Rails.root, 'spec', 'fixtures', 'metadata', 'iso.html')) }
|
5
|
-
let(:metadata) { instance_double('Geoblacklight::Metadata::Iso19139') }
|
6
5
|
subject do
|
7
6
|
described_class.new(metadata)
|
8
7
|
end
|
8
|
+
let(:iso_html) { File.read(Rails.root.join('spec', 'fixtures', 'metadata', 'iso.html')) }
|
9
|
+
let(:metadata) { instance_double('Geoblacklight::Metadata::Iso19139') }
|
9
10
|
|
10
11
|
describe '#transform' do
|
11
12
|
before do
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require 'spec_helper'
|
2
3
|
|
3
4
|
describe Geoblacklight::MetadataTransformer do
|
@@ -9,10 +10,10 @@ describe Geoblacklight::MetadataTransformer do
|
|
9
10
|
|
10
11
|
describe '.instance' do
|
11
12
|
context 'with FGDC metadata' do
|
12
|
-
let(:metadata) { instance_double(Geoblacklight::Metadata::Fgdc) }
|
13
13
|
subject do
|
14
14
|
described_class.instance(metadata)
|
15
15
|
end
|
16
|
+
let(:metadata) { instance_double(Geoblacklight::Metadata::Fgdc) }
|
16
17
|
|
17
18
|
before do
|
18
19
|
allow(klass).to receive(:name).and_return('Geoblacklight::Metadata::Fgdc')
|
@@ -24,10 +25,10 @@ describe Geoblacklight::MetadataTransformer do
|
|
24
25
|
end
|
25
26
|
|
26
27
|
context 'with ISO19139 metadata' do
|
27
|
-
let(:metadata) { instance_double(Geoblacklight::Metadata::Iso19139) }
|
28
28
|
subject do
|
29
29
|
described_class.instance(metadata)
|
30
30
|
end
|
31
|
+
let(:metadata) { instance_double(Geoblacklight::Metadata::Iso19139) }
|
31
32
|
|
32
33
|
before do
|
33
34
|
allow(klass).to receive(:name).and_return('Geoblacklight::Metadata::Iso19139')
|
@@ -39,10 +40,10 @@ describe Geoblacklight::MetadataTransformer do
|
|
39
40
|
end
|
40
41
|
|
41
42
|
context 'without a metadata type' do
|
42
|
-
let(:metadata) { instance_double(Geoblacklight::Metadata::Base) }
|
43
43
|
subject do
|
44
44
|
described_class.instance(metadata)
|
45
45
|
end
|
46
|
+
let(:metadata) { instance_double(Geoblacklight::Metadata::Base) }
|
46
47
|
|
47
48
|
before do
|
48
49
|
allow(klass).to receive(:name).and_return('Geoblacklight::Metadata::Base')
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require 'spec_helper'
|
2
3
|
|
3
4
|
describe Geoblacklight::Reference do
|
@@ -31,4 +32,34 @@ describe Geoblacklight::Reference do
|
|
31
32
|
expect(typical_reference.to_hash).to eq wms: 'http://hgl.harvard.edu:8080/geoserver/wms'
|
32
33
|
end
|
33
34
|
end
|
35
|
+
|
36
|
+
describe 'reference' do
|
37
|
+
context 'key has one trailing slash' do
|
38
|
+
let(:iso19139_reference) do
|
39
|
+
described_class.new(['http://www.isotc211.org/schemas/2005/gmd/', 'https://raw.githubusercontent.com/OpenGeoMetadata/edu.stanford.purl/master/cg/357/zz/0321/iso19139.xml'])
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'removes the trailing slash' do
|
43
|
+
expect(iso19139_reference.send(:uri)).to eq 'http://www.isotc211.org/schemas/2005/gmd'
|
44
|
+
end
|
45
|
+
end
|
46
|
+
context 'key does not have trailing slashes' do
|
47
|
+
let(:iso19139_reference) do
|
48
|
+
described_class.new(['http://www.isotc211.org/schemas/2005/gmd', 'https://raw.githubusercontent.com/OpenGeoMetadata/edu.stanford.purl/master/cg/357/zz/0321/iso19139.xml'])
|
49
|
+
end
|
50
|
+
|
51
|
+
it 'will return the key' do
|
52
|
+
expect(iso19139_reference.send(:uri)).to eq 'http://www.isotc211.org/schemas/2005/gmd'
|
53
|
+
end
|
54
|
+
end
|
55
|
+
context 'key has trailing slashes' do
|
56
|
+
let(:fgdc_reference) do
|
57
|
+
described_class.new(['http://www.opengis.net/cat/csw/csdgm////', 'https://raw.githubusercontent.com/OpenGeoMetadata/edu.harvard/master/217/121/227/77/fgdc.xml'])
|
58
|
+
end
|
59
|
+
|
60
|
+
it 'removes the trailing slashes' do
|
61
|
+
expect(fgdc_reference.send(:uri)).to eq 'http://www.opengis.net/cat/csw/csdgm'
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
34
65
|
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require 'spec_helper'
|
2
3
|
|
3
4
|
describe Geoblacklight::References do
|
@@ -133,7 +134,7 @@ describe Geoblacklight::References do
|
|
133
134
|
context 'with an overridden order for the formats' do
|
134
135
|
let(:settings_klass) { class_double('Settings').as_stubbed_const }
|
135
136
|
before do
|
136
|
-
allow(settings_klass).to receive(:METADATA_SHOWN).and_return %w
|
137
|
+
allow(settings_klass).to receive(:METADATA_SHOWN).and_return %w[iso19139 mods]
|
137
138
|
allow(settings_klass).to receive(:FIELDS).and_return OpenStruct.new(FILE_FORMAT: 'dc_format_s')
|
138
139
|
end
|
139
140
|
it 'is ordered by the configuration' do
|
@@ -166,8 +167,6 @@ describe Geoblacklight::References do
|
|
166
167
|
end
|
167
168
|
it 'returns nil if there is no direct download' do
|
168
169
|
expect(typical_ogp_shapefile.preferred_download).to be_nil
|
169
|
-
end
|
170
|
-
it 'returns nil if there is no direct download' do
|
171
170
|
expect(typical_ogp_geotiff.preferred_download).to be_nil
|
172
171
|
end
|
173
172
|
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require 'spec_helper'
|
2
3
|
|
3
4
|
describe Geoblacklight::Relation::Ancestors do
|
@@ -7,7 +8,7 @@ describe Geoblacklight::Relation::Ancestors do
|
|
7
8
|
|
8
9
|
describe '#create_search_params' do
|
9
10
|
it 'assembles the correct search params for finding ancestor documents' do
|
10
|
-
expect(ancestors.create_search_params).to eq(fq: ["{!join from=#{Settings.FIELDS.SOURCE} to=layer_slug_s}layer_slug_s:nyu_2451_34502"], fl: [Settings.FIELDS.TITLE.to_s, 'layer_slug_s'])
|
11
|
+
expect(ancestors.create_search_params).to eq(fq: ["{!join from=#{Settings.FIELDS.SOURCE} to=layer_slug_s}layer_slug_s:nyu_2451_34502"], fl: [Settings.FIELDS.TITLE.to_s, 'layer_slug_s', 'layer_geom_type_s'])
|
11
12
|
end
|
12
13
|
end
|
13
14
|
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require 'spec_helper'
|
2
3
|
|
3
4
|
describe Geoblacklight::Relation::Descendants do
|
@@ -7,7 +8,7 @@ describe Geoblacklight::Relation::Descendants do
|
|
7
8
|
|
8
9
|
describe '#create_search_params' do
|
9
10
|
it 'assembles the correct search params for finding descendant documents' do
|
10
|
-
expect(descendants.create_search_params).to eq(fq: "#{Settings.FIELDS.SOURCE}:nyu_2451_34636", fl: [Settings.FIELDS.TITLE.to_s, 'layer_slug_s'])
|
11
|
+
expect(descendants.create_search_params).to eq(fq: "#{Settings.FIELDS.SOURCE}:nyu_2451_34636", fl: [Settings.FIELDS.TITLE.to_s, 'layer_slug_s', 'layer_geom_type_s'])
|
11
12
|
end
|
12
13
|
end
|
13
14
|
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require 'spec_helper'
|
2
3
|
|
3
4
|
describe Geoblacklight::FeatureInfoResponse do
|
@@ -28,14 +29,14 @@ describe Geoblacklight::FeatureInfoResponse do
|
|
28
29
|
it 'returns a formated response' do
|
29
30
|
expect(response.format).not_to be_nil
|
30
31
|
expect(response.format[:values].length).to eq 2
|
31
|
-
expect(response.format[:values][0]).to eq %w
|
32
|
-
expect(response.format[:values][1]).to eq %w
|
32
|
+
expect(response.format[:values][0]).to eq %w[Header1 value1]
|
33
|
+
expect(response.format[:values][1]).to eq %w[Header2 value2]
|
33
34
|
end
|
34
35
|
it 'returns a formated response when multiple features are retrieved' do
|
35
36
|
expect(response_multiple_features.format).not_to be_nil
|
36
37
|
expect(response_multiple_features.format[:values].length).to eq 2
|
37
|
-
expect(response_multiple_features.format[:values][0]).to eq %w
|
38
|
-
expect(response_multiple_features.format[:values][1]).to eq %w
|
38
|
+
expect(response_multiple_features.format[:values][0]).to eq %w[Header1 value1]
|
39
|
+
expect(response_multiple_features.format[:values][1]).to eq %w[Header2 value2]
|
39
40
|
end
|
40
41
|
end
|
41
42
|
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require 'spec_helper'
|
2
3
|
|
3
4
|
describe Geoblacklight::WmsLayer do
|
@@ -73,7 +74,7 @@ describe Geoblacklight::WmsLayer do
|
|
73
74
|
context 'when the HTTP connection fails' do
|
74
75
|
before do
|
75
76
|
allow(Geoblacklight.logger).to receive(:error).with('#<Faraday::ConnectionFailed wrapped=#<StandardError: test connection error>>')
|
76
|
-
allow(connection).to receive(:get).and_raise(Faraday::
|
77
|
+
allow(connection).to receive(:get).and_raise(Faraday::ConnectionFailed.new(StandardError.new('test connection error')))
|
77
78
|
end
|
78
79
|
|
79
80
|
it 'logs the Faraday error' do
|
@@ -86,7 +87,7 @@ describe Geoblacklight::WmsLayer do
|
|
86
87
|
context 'when the HTTP connection times out' do
|
87
88
|
before do
|
88
89
|
allow(Geoblacklight.logger).to receive(:error).with('#<Faraday::TimeoutError #<Faraday::TimeoutError: timeout>>')
|
89
|
-
allow(connection).to receive(:get).and_raise(Faraday::
|
90
|
+
allow(connection).to receive(:get).and_raise(Faraday::TimeoutError)
|
90
91
|
end
|
91
92
|
|
92
93
|
it 'logs the Faraday error' do
|