geoblacklight 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.circleci/config.yml +195 -0
- data/.github/ISSUE_TEMPLATE.md +17 -0
- data/.gitignore +21 -0
- data/.gitmodules +0 -0
- data/.hound.yml +8 -0
- data/.jshintignore +2 -0
- data/.jshintrc +67 -0
- data/.rubocop.yml +99 -0
- data/.rubocop_todo.yml +196 -0
- data/.solr_wrapper +5 -0
- data/CODE_OF_CONDUCT.md +76 -0
- data/CONTRIBUTING.md +49 -0
- data/Gemfile +39 -0
- data/LICENSE.txt +13 -0
- data/README.md +39 -0
- data/Rakefile +125 -0
- data/app/assets/images/blacklight/arrow-circle-down.svg +4 -0
- data/app/assets/images/blacklight/baruch-cuny.svg +6 -0
- data/app/assets/images/blacklight/berkeley.svg +7 -0
- data/app/assets/images/blacklight/book.svg +6 -0
- data/app/assets/images/blacklight/bookmark.svg +6 -0
- data/app/assets/images/blacklight/cd-rom.svg +6 -0
- data/app/assets/images/blacklight/chicago.svg +7 -0
- data/app/assets/images/blacklight/columbia.svg +6 -0
- data/app/assets/images/blacklight/cornell.svg +8 -0
- data/app/assets/images/blacklight/dvd-rom.svg +6 -0
- data/app/assets/images/blacklight/email.svg +6 -0
- data/app/assets/images/blacklight/esri-globe.svg +34 -0
- data/app/assets/images/blacklight/geoblacklight-icons.json +2079 -0
- data/app/assets/images/blacklight/globe.svg +4 -0
- data/app/assets/images/blacklight/harvard.svg +6 -0
- data/app/assets/images/blacklight/home.svg +4 -0
- data/app/assets/images/blacklight/illinois.svg +7 -0
- data/app/assets/images/blacklight/image.svg +6 -0
- data/app/assets/images/blacklight/indiana.svg +6 -0
- data/app/assets/images/blacklight/iowa.svg +6 -0
- data/app/assets/images/blacklight/leaf.svg +6 -0
- data/app/assets/images/blacklight/lewis-clark.svg +8 -0
- data/app/assets/images/blacklight/line.svg +7 -0
- data/app/assets/images/blacklight/logo.svg +1 -0
- data/app/assets/images/blacklight/map-marker.svg +6 -0
- data/app/assets/images/blacklight/map.svg +6 -0
- data/app/assets/images/blacklight/maryland.svg +6 -0
- data/app/assets/images/blacklight/massgis.svg +6 -0
- data/app/assets/images/blacklight/metadata.svg +6 -0
- data/app/assets/images/blacklight/michigan-state.svg +7 -0
- data/app/assets/images/blacklight/michigan.svg +6 -0
- data/app/assets/images/blacklight/minnesota.svg +6 -0
- data/app/assets/images/blacklight/mit.svg +6 -0
- data/app/assets/images/blacklight/mixed.svg +8 -0
- data/app/assets/images/blacklight/multilinestring.svg +9 -0
- data/app/assets/images/blacklight/multipoint.svg +6 -0
- data/app/assets/images/blacklight/multipolygon.svg +9 -0
- data/app/assets/images/blacklight/nyu.svg +9 -0
- data/app/assets/images/blacklight/ohio-state.svg +8 -0
- data/app/assets/images/blacklight/pagelines-brands.svg +6 -0
- data/app/assets/images/blacklight/paper-map.svg +6 -0
- data/app/assets/images/blacklight/penn-state.svg +7 -0
- data/app/assets/images/blacklight/point.svg +6 -0
- data/app/assets/images/blacklight/polygon.svg +7 -0
- data/app/assets/images/blacklight/polyline.svg +9 -0
- data/app/assets/images/blacklight/princeton.svg +6 -0
- data/app/assets/images/blacklight/public.svg +6 -0
- data/app/assets/images/blacklight/purdue.svg +7 -0
- data/app/assets/images/blacklight/raster.svg +6 -0
- data/app/assets/images/blacklight/restricted.svg +6 -0
- data/app/assets/images/blacklight/sms.svg +6 -0
- data/app/assets/images/blacklight/stanford.svg +6 -0
- data/app/assets/images/blacklight/table.svg +6 -0
- data/app/assets/images/blacklight/tags.svg +4 -0
- data/app/assets/images/blacklight/texas.svg +6 -0
- data/app/assets/images/blacklight/tufts.svg +6 -0
- data/app/assets/images/blacklight/ucla.svg +6 -0
- data/app/assets/images/blacklight/uva.svg +6 -0
- data/app/assets/images/blacklight/web_services.svg +6 -0
- data/app/assets/images/blacklight/wisconsin.svg +6 -0
- data/app/assets/javascripts/geoblacklight/basemaps.js +85 -0
- data/app/assets/javascripts/geoblacklight/controls.js +1 -0
- data/app/assets/javascripts/geoblacklight/controls/opacity.js +6 -0
- data/app/assets/javascripts/geoblacklight/downloaders.js +1 -0
- data/app/assets/javascripts/geoblacklight/downloaders/downloader.js +61 -0
- data/app/assets/javascripts/geoblacklight/downloaders/hgl_downloader.js +32 -0
- data/app/assets/javascripts/geoblacklight/geoblacklight.js +42 -0
- data/app/assets/javascripts/geoblacklight/modules.js +1 -0
- data/app/assets/javascripts/geoblacklight/modules/collapse.js +7 -0
- data/app/assets/javascripts/geoblacklight/modules/download.js +11 -0
- data/app/assets/javascripts/geoblacklight/modules/geosearch.js +133 -0
- data/app/assets/javascripts/geoblacklight/modules/help_text.js +7 -0
- data/app/assets/javascripts/geoblacklight/modules/home.js +16 -0
- data/app/assets/javascripts/geoblacklight/modules/item.js +13 -0
- data/app/assets/javascripts/geoblacklight/modules/layer_opacity.js +68 -0
- data/app/assets/javascripts/geoblacklight/modules/metadata.js +15 -0
- data/app/assets/javascripts/geoblacklight/modules/metadata_download_button.js +53 -0
- data/app/assets/javascripts/geoblacklight/modules/relations.js +14 -0
- data/app/assets/javascripts/geoblacklight/modules/results.js +82 -0
- data/app/assets/javascripts/geoblacklight/modules/util.js +38 -0
- data/app/assets/javascripts/geoblacklight/templates/index_map_download.hbs +19 -0
- data/app/assets/javascripts/geoblacklight/templates/index_map_info.hbs +40 -0
- data/app/assets/javascripts/geoblacklight/viewers.js +1 -0
- data/app/assets/javascripts/geoblacklight/viewers/esri.js +77 -0
- data/app/assets/javascripts/geoblacklight/viewers/esri/dynamic_map_layer.js +85 -0
- data/app/assets/javascripts/geoblacklight/viewers/esri/feature_layer.js +76 -0
- data/app/assets/javascripts/geoblacklight/viewers/esri/image_map_layer.js +14 -0
- data/app/assets/javascripts/geoblacklight/viewers/esri/tiled_map_layer.js +50 -0
- data/app/assets/javascripts/geoblacklight/viewers/iiif.js +25 -0
- data/app/assets/javascripts/geoblacklight/viewers/index_map.js +70 -0
- data/app/assets/javascripts/geoblacklight/viewers/map.js +67 -0
- data/app/assets/javascripts/geoblacklight/viewers/oembed.js +13 -0
- data/app/assets/javascripts/geoblacklight/viewers/viewer.js +65 -0
- data/app/assets/javascripts/geoblacklight/viewers/wms.js +74 -0
- data/app/assets/stylesheets/geoblacklight/_blacklight_overrides.scss +51 -0
- data/app/assets/stylesheets/geoblacklight/_geoblacklight.scss +36 -0
- data/app/assets/stylesheets/geoblacklight/_styles.scss +4 -0
- data/app/assets/stylesheets/geoblacklight/application.scss +2 -0
- data/app/assets/stylesheets/geoblacklight/modules/downloads.scss +93 -0
- data/app/assets/stylesheets/geoblacklight/modules/facets.scss +5 -0
- data/app/assets/stylesheets/geoblacklight/modules/geosearch.scss +29 -0
- data/app/assets/stylesheets/geoblacklight/modules/home.scss +28 -0
- data/app/assets/stylesheets/geoblacklight/modules/icon-customization.scss +50 -0
- data/app/assets/stylesheets/geoblacklight/modules/index_maps.scss +7 -0
- data/app/assets/stylesheets/geoblacklight/modules/item.scss +26 -0
- data/app/assets/stylesheets/geoblacklight/modules/layer_opacity.scss +87 -0
- data/app/assets/stylesheets/geoblacklight/modules/metadata.scss +31 -0
- data/app/assets/stylesheets/geoblacklight/modules/metadata_content.scss +43 -0
- data/app/assets/stylesheets/geoblacklight/modules/metadata_markup.scss +9 -0
- data/app/assets/stylesheets/geoblacklight/modules/metadata_missing.scss +7 -0
- data/app/assets/stylesheets/geoblacklight/modules/mixins.scss +5 -0
- data/app/assets/stylesheets/geoblacklight/modules/modal.scss +14 -0
- data/app/assets/stylesheets/geoblacklight/modules/relations.scss +15 -0
- data/app/assets/stylesheets/geoblacklight/modules/results.scss +68 -0
- data/app/assets/stylesheets/geoblacklight/modules/search_widgets.scss +5 -0
- data/app/assets/stylesheets/geoblacklight/modules/sidebar.scss +60 -0
- data/app/assets/stylesheets/geoblacklight/modules/toolbar.scss +70 -0
- data/app/assets/stylesheets/geoblacklight/modules/web_services.scss +5 -0
- data/app/controllers/download_controller.rb +114 -0
- data/app/controllers/relation_controller.rb +20 -0
- data/app/controllers/wms_controller.rb +15 -0
- data/app/helpers/arcgis_helper.rb +12 -0
- data/app/helpers/blacklight_helper.rb +9 -0
- data/app/helpers/carto_helper.rb +29 -0
- data/app/helpers/geoblacklight_helper.rb +323 -0
- data/app/models/concerns/geoblacklight/solr_document.rb +113 -0
- data/app/models/concerns/geoblacklight/solr_document/arcgis.rb +10 -0
- data/app/models/concerns/geoblacklight/solr_document/carto.rb +28 -0
- data/app/models/concerns/geoblacklight/solr_document/finder.rb +38 -0
- data/app/models/concerns/geoblacklight/solr_document/inspection.rb +15 -0
- data/app/models/concerns/geoblacklight/spatial_search_behavior.rb +69 -0
- data/app/presenters/geoblacklight/document_presenter.rb +23 -0
- data/app/views/catalog/_data_dictionary.html.erb +6 -0
- data/app/views/catalog/_document_action.html.erb +6 -0
- data/app/views/catalog/_document_split.html.erb +6 -0
- data/app/views/catalog/_download_generated_link.html.erb +4 -0
- data/app/views/catalog/_download_link.html.erb +3 -0
- data/app/views/catalog/_downloads_generated.html.erb +6 -0
- data/app/views/catalog/_downloads_primary.html.erb +14 -0
- data/app/views/catalog/_downloads_secondary.html.erb +39 -0
- data/app/views/catalog/_exports.html.erb +3 -0
- data/app/views/catalog/_facet_tag_item.html.erb +3 -0
- data/app/views/catalog/_facet_tag_layout.html.erb +2 -0
- data/app/views/catalog/_header_icons.html.erb +3 -0
- data/app/views/catalog/_home_text.html.erb +43 -0
- data/app/views/catalog/_icon_facet.html.erb +16 -0
- data/app/views/catalog/_index_split_default.html.erb +22 -0
- data/app/views/catalog/_metadata.html.erb +27 -0
- data/app/views/catalog/_relations_container.html.erb +1 -0
- data/app/views/catalog/_results_pagination.html.erb +12 -0
- data/app/views/catalog/_show_default_attribute_table.html.erb +19 -0
- data/app/views/catalog/_show_default_viewer_container.html.erb +12 -0
- data/app/views/catalog/_show_default_viewer_information.html.erb +4 -0
- data/app/views/catalog/_show_downloads.html.erb +34 -0
- data/app/views/catalog/_show_header_default.html.erb +4 -0
- data/app/views/catalog/_show_sidebar.html.erb +12 -0
- data/app/views/catalog/_show_tools.html.erb +25 -0
- data/app/views/catalog/_web_services.html.erb +8 -0
- data/app/views/catalog/_web_services_default.html.erb +8 -0
- data/app/views/catalog/_web_services_wfs.html.erb +8 -0
- data/app/views/catalog/_web_services_wms.html.erb +8 -0
- data/app/views/catalog/index.html.erb +13 -0
- data/app/views/catalog/metadata.html.erb +11 -0
- data/app/views/catalog/metadata/_content.html.erb +3 -0
- data/app/views/catalog/metadata/_markup.html.erb +8 -0
- data/app/views/catalog/metadata/_missing.html.erb +6 -0
- data/app/views/catalog/web_services.html.erb +10 -0
- data/app/views/download/hgl.html.erb +25 -0
- data/app/views/relation/_ancestors.html.erb +11 -0
- data/app/views/relation/_descendants.html.erb +18 -0
- data/app/views/relation/index.html.erb +13 -0
- data/app/views/relation/index.json.jbuilder +3 -0
- data/app/views/shared/_header_navbar.html.erb +38 -0
- data/config/initializers/rails_config.rb +3 -0
- data/config/locales/geoblacklight.en.yml +163 -0
- data/geoblacklight.gemspec +49 -0
- data/lib/generators/geoblacklight/install_generator.rb +105 -0
- data/lib/generators/geoblacklight/templates/Procfile +3 -0
- data/lib/generators/geoblacklight/templates/catalog_controller.rb +272 -0
- data/lib/generators/geoblacklight/templates/geoblacklight.js +10 -0
- data/lib/generators/geoblacklight/templates/geoblacklight.scss +4 -0
- data/lib/generators/geoblacklight/templates/package.json +14 -0
- data/lib/generators/geoblacklight/templates/settings.yml +127 -0
- data/lib/generators/geoblacklight/templates/webpacker.yml +67 -0
- data/lib/generators/geoblacklight/webpacker_generator.rb +35 -0
- data/lib/geoblacklight.rb +50 -0
- data/lib/geoblacklight/bounding_box.rb +45 -0
- data/lib/geoblacklight/catalog_helper_override.rb +13 -0
- data/lib/geoblacklight/constants.rb +28 -0
- data/lib/geoblacklight/download.rb +108 -0
- data/lib/geoblacklight/download/geojson_download.rb +22 -0
- data/lib/geoblacklight/download/geotiff_download.rb +20 -0
- data/lib/geoblacklight/download/hgl_download.rb +18 -0
- data/lib/geoblacklight/download/kmz_download.rb +22 -0
- data/lib/geoblacklight/download/shapefile_download.rb +20 -0
- data/lib/geoblacklight/engine.rb +27 -0
- data/lib/geoblacklight/exceptions.rb +27 -0
- data/lib/geoblacklight/geoblacklight_helper_behavior.rb +14 -0
- data/lib/geoblacklight/item_viewer.rb +54 -0
- data/lib/geoblacklight/metadata.rb +18 -0
- data/lib/geoblacklight/metadata/base.rb +93 -0
- data/lib/geoblacklight/metadata/fgdc.rb +14 -0
- data/lib/geoblacklight/metadata/html.rb +13 -0
- data/lib/geoblacklight/metadata/iso19139.rb +14 -0
- data/lib/geoblacklight/metadata_transformer.rb +33 -0
- data/lib/geoblacklight/metadata_transformer/base.rb +42 -0
- data/lib/geoblacklight/metadata_transformer/fgdc.rb +8 -0
- data/lib/geoblacklight/metadata_transformer/iso19139.rb +8 -0
- data/lib/geoblacklight/reference.rb +45 -0
- data/lib/geoblacklight/references.rb +132 -0
- data/lib/geoblacklight/relation/ancestors.rb +27 -0
- data/lib/geoblacklight/relation/descendants.rb +27 -0
- data/lib/geoblacklight/relation/relation_response.rb +24 -0
- data/lib/geoblacklight/routes.rb +7 -0
- data/lib/geoblacklight/routes/downloadable.rb +14 -0
- data/lib/geoblacklight/routes/exportable.rb +17 -0
- data/lib/geoblacklight/routes/wms.rb +13 -0
- data/lib/geoblacklight/version.rb +3 -0
- data/lib/geoblacklight/view_helper_override.rb +40 -0
- data/lib/geoblacklight/wms_layer.rb +35 -0
- data/lib/geoblacklight/wms_layer/feature_info_response.rb +32 -0
- data/lib/tasks/geoblacklight.rake +108 -0
- data/package.json +4 -0
- data/schema/format-values.md +50 -0
- data/schema/geoblacklight-schema-deprecated.md +39 -0
- data/schema/geoblacklight-schema.json +214 -0
- data/schema/geoblacklight-schema.md +323 -0
- data/schema/geometry-type-values.md +11 -0
- data/schema/references.md +23 -0
- data/schema/schema-commentary.md +198 -0
- data/schema/subjects.md +41 -0
- data/schema/type-values.md +10 -0
- data/solr/conf/_rest_managed.json +3 -0
- data/solr/conf/admin-extra.html +31 -0
- data/solr/conf/core.properties +5 -0
- data/solr/conf/elevate.xml +36 -0
- data/solr/conf/mapping-ISOLatin1Accent.txt +246 -0
- data/solr/conf/protwords.txt +21 -0
- data/solr/conf/schema.xml +198 -0
- data/solr/conf/scripts.conf +24 -0
- data/solr/conf/solrconfig.xml +243 -0
- data/solr/conf/spellings.txt +2 -0
- data/solr/conf/stopwords.txt +58 -0
- data/solr/conf/stopwords_en.txt +58 -0
- data/solr/conf/synonyms.txt +31 -0
- data/solr/conf/xslt/example.xsl +132 -0
- data/solr/conf/xslt/example_atom.xsl +67 -0
- data/solr/conf/xslt/example_rss.xsl +66 -0
- data/solr/conf/xslt/luke.xsl +337 -0
- data/spec/controllers/catalog_controller_spec.rb +82 -0
- data/spec/controllers/download_controller_spec.rb +120 -0
- data/spec/controllers/relation_controller_spec.rb +11 -0
- data/spec/controllers/wms_controller_spec.rb +34 -0
- data/spec/factories/user.rb +7 -0
- data/spec/features/bookmarks_spec.rb +10 -0
- data/spec/features/configurable_basemap_spec.rb +35 -0
- data/spec/features/data_dictionary_download_spec.rb +16 -0
- data/spec/features/download_layer_spec.rb +93 -0
- data/spec/features/empty_search_spec.rb +11 -0
- data/spec/features/esri_viewer_spec.rb +42 -0
- data/spec/features/exports_spec.rb +36 -0
- data/spec/features/help_text_spec.rb +8 -0
- data/spec/features/home_page_spec.rb +40 -0
- data/spec/features/iiif_viewer_spec.rb +8 -0
- data/spec/features/index_map_spec.rb +31 -0
- data/spec/features/layer_inspection_spec.rb +10 -0
- data/spec/features/layer_opacity_spec.rb +20 -0
- data/spec/features/layer_preview_spec.rb +17 -0
- data/spec/features/layer_with_no_references_spec.rb +8 -0
- data/spec/features/linkified_attribute_table_spec.rb +11 -0
- data/spec/features/metadata_panel_spec.rb +78 -0
- data/spec/features/missing_metadata_spec.rb +24 -0
- data/spec/features/oembed_spec.rb +9 -0
- data/spec/features/relations_spec.rb +51 -0
- data/spec/features/saved_searches_spec.rb +13 -0
- data/spec/features/search_bar_spec.rb +12 -0
- data/spec/features/search_results_map_spec.rb +55 -0
- data/spec/features/search_results_overlap_ratio_spec.rb +55 -0
- data/spec/features/search_spec.rb +14 -0
- data/spec/features/show_page_metadata_spec.rb +12 -0
- data/spec/features/sms_spec.rb +15 -0
- data/spec/features/split_view.html.erb_spec.rb +75 -0
- data/spec/features/suppressed_records_spec.rb +14 -0
- data/spec/features/web_services_modal_spec.rb +25 -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/README.md +40 -0
- data/spec/fixtures/solr_documents/actual-papermap1.json +23 -0
- data/spec/fixtures/solr_documents/actual-point1.json +37 -0
- data/spec/fixtures/solr_documents/actual-polygon1.json +23 -0
- data/spec/fixtures/solr_documents/actual-raster1.json +38 -0
- data/spec/fixtures/solr_documents/baruch_ancestor1.json +46 -0
- data/spec/fixtures/solr_documents/baruch_ancestor2.json +46 -0
- data/spec/fixtures/solr_documents/baruch_documentation_download.json +49 -0
- data/spec/fixtures/solr_documents/bbox-spans-180.json +20 -0
- data/spec/fixtures/solr_documents/cornell_html_metadata.json +42 -0
- data/spec/fixtures/solr_documents/esri-dynamic-layer-all-layers.json +38 -0
- data/spec/fixtures/solr_documents/esri-dynamic-layer-single-layer.json +40 -0
- data/spec/fixtures/solr_documents/esri-feature-layer.json +46 -0
- data/spec/fixtures/solr_documents/esri-image-map-layer.json +42 -0
- data/spec/fixtures/solr_documents/esri-tiled_map_layer.json +22 -0
- data/spec/fixtures/solr_documents/esri-wms-layer.json +33 -0
- data/spec/fixtures/solr_documents/harvard_raster.json +44 -0
- data/spec/fixtures/solr_documents/iiif-eastern-hemisphere.json +30 -0
- data/spec/fixtures/solr_documents/index-map-polygon-no-downloadurl.json +37 -0
- data/spec/fixtures/solr_documents/index-map-polygon.json +37 -0
- data/spec/fixtures/solr_documents/index-map-stanford.json +37 -0
- data/spec/fixtures/solr_documents/index_map_point.json +27 -0
- 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/no_spatial.json +21 -0
- data/spec/fixtures/solr_documents/oembed.json +24 -0
- data/spec/fixtures/solr_documents/princeton-child1.json +30 -0
- data/spec/fixtures/solr_documents/princeton-child2.json +30 -0
- data/spec/fixtures/solr_documents/princeton-child3.json +30 -0
- data/spec/fixtures/solr_documents/princeton-child4.json +30 -0
- data/spec/fixtures/solr_documents/princeton-parent.json +25 -0
- data/spec/fixtures/solr_documents/public_direct_download.json +34 -0
- data/spec/fixtures/solr_documents/public_iiif_princeton.json +36 -0
- data/spec/fixtures/solr_documents/public_polygon_mit.json +27 -0
- data/spec/fixtures/solr_documents/restricted-line.json +37 -0
- data/spec/fixtures/solr_documents/umn_metro_result1.json +41 -0
- data/spec/fixtures/solr_documents/umn_state_result1.json +38 -0
- data/spec/fixtures/solr_documents/umn_state_result2.json +38 -0
- data/spec/fixtures/solr_documents/uva_slug_colon.json +25 -0
- data/spec/helpers/arcgis_helper_spec.rb +14 -0
- data/spec/helpers/carto_helper_spec.rb +11 -0
- data/spec/helpers/geoblacklight_helper_spec.rb +329 -0
- data/spec/javascripts/geoblacklight_spec.js +21 -0
- data/spec/javascripts/metadata_download_button_spec.js +14 -0
- data/spec/javascripts/spec_helper.js +32 -0
- data/spec/javascripts/util_spec.js +12 -0
- data/spec/lib/geoblacklight/bounding_box_spec.rb +27 -0
- data/spec/lib/geoblacklight/controller_override_spec.rb +1 -0
- data/spec/lib/geoblacklight/document_presenter_spec.rb +61 -0
- data/spec/lib/geoblacklight/download/geojson_download_spec.rb +19 -0
- data/spec/lib/geoblacklight/download/geotiff_download_spec.rb +20 -0
- data/spec/lib/geoblacklight/download/hgl_download_spec.rb +60 -0
- data/spec/lib/geoblacklight/download/kmz_download_spec.rb +20 -0
- data/spec/lib/geoblacklight/download/shapefile_download_spec.rb +19 -0
- data/spec/lib/geoblacklight/download_spec.rb +177 -0
- data/spec/lib/geoblacklight/geoblacklight_helper_behavior_spec.rb +30 -0
- data/spec/lib/geoblacklight/item_viewer_spec.rb +63 -0
- data/spec/lib/geoblacklight/metadata/base_spec.rb +157 -0
- data/spec/lib/geoblacklight/metadata/html_spec.rb +18 -0
- data/spec/lib/geoblacklight/metadata_spec.rb +42 -0
- data/spec/lib/geoblacklight/metadata_transformer/base_spec.rb +35 -0
- data/spec/lib/geoblacklight/metadata_transformer/fgdc_spec.rb +23 -0
- data/spec/lib/geoblacklight/metadata_transformer/iso19139_spec.rb +23 -0
- data/spec/lib/geoblacklight/metadata_transformer_spec.rb +69 -0
- data/spec/lib/geoblacklight/reference_spec.rb +64 -0
- data/spec/lib/geoblacklight/references_spec.rb +216 -0
- data/spec/lib/geoblacklight/relation/ancestors_spec.rb +32 -0
- data/spec/lib/geoblacklight/relation/descendants_spec.rb +32 -0
- data/spec/lib/geoblacklight/relation/relation_response_spec.rb +43 -0
- data/spec/lib/geoblacklight/view_helper_override_spec.rb +37 -0
- data/spec/lib/geoblacklight/wms_layer/feature_info_response_spec.rb +50 -0
- data/spec/lib/geoblacklight/wms_layer_spec.rb +99 -0
- data/spec/models/concerns/geoblacklight/solr_document/carto_spec.rb +61 -0
- data/spec/models/concerns/geoblacklight/solr_document/finder_spec.rb +40 -0
- data/spec/models/concerns/geoblacklight/solr_document/inspection_spec.rb +16 -0
- data/spec/models/concerns/geoblacklight/solr_document_spec.rb +251 -0
- data/spec/models/concerns/geoblacklight/spatial_search_behavior_spec.rb +84 -0
- data/spec/routing/catalog_routing_spec.rb +8 -0
- data/spec/spec_helper.rb +79 -0
- data/spec/support/backport_test_helpers.rb +45 -0
- data/spec/support/features.rb +5 -0
- data/spec/support/features/session_helpers.rb +20 -0
- data/spec/teaspoon_env.rb +213 -0
- data/spec/test_app_templates/Gemfile.extra +1 -0
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +49 -0
- data/spec/test_app_templates/metadata/fgdc.html +129 -0
- data/spec/test_app_templates/metadata/fgdc.xml +145 -0
- data/spec/test_app_templates/metadata/iso.html +275 -0
- data/spec/test_app_templates/metadata/iso.xml +511 -0
- data/spec/test_app_templates/solr_documents +1 -0
- data/spec/views/catalog/_document_split.html.erb_spec.rb +5 -0
- data/spec/views/catalog/_index_split.html.erb_spec.rb +5 -0
- data/spec/views/catalog/_results_pagination.html.erb_spec.rb +9 -0
- data/spec/views/catalog/_show_downloads.html.erb_spec.rb +41 -0
- data/spec/views/catalog/_show_tools.html.erb_spec.rb +39 -0
- data/template.rb +19 -0
- data/vendor/assets/images/layers-2x.png +0 -0
- data/vendor/assets/images/layers.png +0 -0
- data/vendor/assets/images/marker-icon-2x.png +0 -0
- data/vendor/assets/images/marker-icon.png +0 -0
- data/vendor/assets/images/marker-shadow.png +0 -0
- data/vendor/assets/javascripts/esri-leaflet.js +5 -0
- data/vendor/assets/javascripts/esri-leaflet.js.map +1 -0
- data/vendor/assets/javascripts/leaflet-iiif.js +302 -0
- data/vendor/assets/javascripts/leaflet-src.js.map +1 -0
- data/vendor/assets/javascripts/leaflet.js.erb +13922 -0
- data/vendor/assets/javascripts/native.history.js +1 -0
- data/vendor/assets/javascripts/readmore.js +618 -0
- data/vendor/assets/javascripts/readmore.js.map +1 -0
- data/vendor/assets/stylesheets/leaflet-label.css +54 -0
- data/vendor/assets/stylesheets/leaflet.css +635 -0
- metadata +967 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Geoblacklight::Reference do
|
|
4
|
+
let(:typical_reference) do
|
|
5
|
+
described_class.new(['http://www.opengis.net/def/serviceType/ogc/wms', 'http://hgl.harvard.edu:8080/geoserver/wms'])
|
|
6
|
+
end
|
|
7
|
+
let(:blank_reference) do
|
|
8
|
+
described_class.new([])
|
|
9
|
+
end
|
|
10
|
+
describe '#initialize' do
|
|
11
|
+
it 'instance variable reference is set' do
|
|
12
|
+
expect(typical_reference.instance_variable_get(:@reference)).to eq ['http://www.opengis.net/def/serviceType/ogc/wms', 'http://hgl.harvard.edu:8080/geoserver/wms']
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
describe '#endpoint' do
|
|
16
|
+
it 'returns the endpoint url for a reference' do
|
|
17
|
+
expect(typical_reference.endpoint).to eq 'http://hgl.harvard.edu:8080/geoserver/wms'
|
|
18
|
+
end
|
|
19
|
+
it 'returns nil for a blank reference' do
|
|
20
|
+
expect(blank_reference.endpoint).to be_nil
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
describe '#type' do
|
|
24
|
+
it 'looks up a constant using the uri' do
|
|
25
|
+
expect(typical_reference.type).to eq :wms
|
|
26
|
+
expect(blank_reference.type).to be_nil
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
describe '#to_hash' do
|
|
30
|
+
it 'creates a hash using type and endpoint' do
|
|
31
|
+
expect(typical_reference.to_hash).to eq wms: 'http://hgl.harvard.edu:8080/geoserver/wms'
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
describe 'reference' do
|
|
36
|
+
context 'key has one trailing slash' do
|
|
37
|
+
let(:iso19139_reference) do
|
|
38
|
+
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'])
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
it 'removes the trailing slash' do
|
|
42
|
+
expect(iso19139_reference.send(:uri)).to eq 'http://www.isotc211.org/schemas/2005/gmd'
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
context 'key does not have trailing slashes' do
|
|
46
|
+
let(:iso19139_reference) do
|
|
47
|
+
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'])
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
it 'will return the key' do
|
|
51
|
+
expect(iso19139_reference.send(:uri)).to eq 'http://www.isotc211.org/schemas/2005/gmd'
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
context 'key has trailing slashes' do
|
|
55
|
+
let(:fgdc_reference) do
|
|
56
|
+
described_class.new(['http://www.opengis.net/cat/csw/csdgm////', 'https://raw.githubusercontent.com/OpenGeoMetadata/edu.harvard/master/217/121/227/77/fgdc.xml'])
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
it 'removes the trailing slashes' do
|
|
60
|
+
expect(fgdc_reference.send(:uri)).to eq 'http://www.opengis.net/cat/csw/csdgm'
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Geoblacklight::References do
|
|
4
|
+
let(:references_field) { Settings.FIELDS.REFERENCES }
|
|
5
|
+
let(:file_format_field) { Settings.FIELDS.FILE_FORMAT }
|
|
6
|
+
let(:typical_ogp_shapefile) do
|
|
7
|
+
described_class.new(
|
|
8
|
+
SolrDocument.new(
|
|
9
|
+
file_format_field => 'Shapefile',
|
|
10
|
+
references_field => {
|
|
11
|
+
'http://www.opengis.net/def/serviceType/ogc/wms' => 'http://hgl.harvard.edu:8080/geoserver/wms',
|
|
12
|
+
'http://www.opengis.net/def/serviceType/ogc/wfs' => 'http://hgl.harvard.edu:8080/geoserver/wfs'
|
|
13
|
+
}.to_json
|
|
14
|
+
)
|
|
15
|
+
)
|
|
16
|
+
end
|
|
17
|
+
let(:no_service_shapefile) do
|
|
18
|
+
described_class.new(
|
|
19
|
+
SolrDocument.new(
|
|
20
|
+
file_format_field => 'Shapefile',
|
|
21
|
+
references_field => {}.to_json
|
|
22
|
+
)
|
|
23
|
+
)
|
|
24
|
+
end
|
|
25
|
+
let(:typical_ogp_geotiff) do
|
|
26
|
+
described_class.new(
|
|
27
|
+
SolrDocument.new(
|
|
28
|
+
file_format_field => 'GeoTIFF',
|
|
29
|
+
references_field => {
|
|
30
|
+
'http://www.opengis.net/def/serviceType/ogc/wms' => 'http://hgl.harvard.edu:8080/geoserver/wms',
|
|
31
|
+
'http://www.opengis.net/def/serviceType/ogc/wfs' => 'http://hgl.harvard.edu:8080/geoserver/wfs'
|
|
32
|
+
}.to_json
|
|
33
|
+
)
|
|
34
|
+
)
|
|
35
|
+
end
|
|
36
|
+
let(:typical_arcgrid) do
|
|
37
|
+
described_class.new(
|
|
38
|
+
SolrDocument.new(
|
|
39
|
+
file_format_field => 'ArcGRID',
|
|
40
|
+
references_field => {
|
|
41
|
+
'http://www.opengis.net/def/serviceType/ogc/wms' => 'http://hgl.harvard.edu:8080/geoserver/wms',
|
|
42
|
+
'http://www.opengis.net/def/serviceType/ogc/wfs' => 'http://hgl.harvard.edu:8080/geoserver/wfs'
|
|
43
|
+
}.to_json
|
|
44
|
+
)
|
|
45
|
+
)
|
|
46
|
+
end
|
|
47
|
+
let(:complex_shapefile) do
|
|
48
|
+
described_class.new(
|
|
49
|
+
SolrDocument.new(
|
|
50
|
+
file_format_field => 'Shapefile',
|
|
51
|
+
references_field => {
|
|
52
|
+
'http://schema.org/downloadUrl' => 'http://example.com/urn:hul.harvard.edu:HARVARD.SDE2.TG10USAIANNH/data.zip',
|
|
53
|
+
'http://www.isotc211.org/schemas/2005/gmd/' => 'http://example.com/urn:hul.harvard.edu:HARVARD.SDE2.TG10USAIANNH/iso19139.xml',
|
|
54
|
+
'http://www.loc.gov/mods/v3' => 'http://example.com/urn:hul.harvard.edu:HARVARD.SDE2.TG10USAIANNH/mods.xml',
|
|
55
|
+
'http://schema.org/url' => 'http://example.com/urn:hul.harvard.edu:HARVARD.SDE2.TG10USAIANNH/homepage',
|
|
56
|
+
'http://www.opengis.net/def/serviceType/ogc/wms' => 'http://hgl.harvard.edu:8080/geoserver/wms',
|
|
57
|
+
'http://www.opengis.net/def/serviceType/ogc/wfs' => 'http://hgl.harvard.edu:8080/geoserver/wfs'
|
|
58
|
+
}.to_json
|
|
59
|
+
)
|
|
60
|
+
)
|
|
61
|
+
end
|
|
62
|
+
let(:direct_download_only) do
|
|
63
|
+
described_class.new(
|
|
64
|
+
SolrDocument.new(
|
|
65
|
+
file_format_field => 'GeoTIFF',
|
|
66
|
+
references_field => {
|
|
67
|
+
'http://schema.org/downloadUrl' => 'http://example.com/layer-id-geotiff.tiff'
|
|
68
|
+
}.to_json
|
|
69
|
+
)
|
|
70
|
+
)
|
|
71
|
+
end
|
|
72
|
+
let(:simple_iiif_image) do
|
|
73
|
+
described_class.new(
|
|
74
|
+
SolrDocument.new(
|
|
75
|
+
file_format_field => 'Raster',
|
|
76
|
+
references_field => {
|
|
77
|
+
'http://schema.org/url' => 'http://arks.princeton.edu/ark:/88435/02870w62c',
|
|
78
|
+
'http://iiif.io/api/image' => 'http://libimages.princeton.edu/loris2/pudl0076%2Fmap_pownall%2F00000001.jp2/info.json'
|
|
79
|
+
}.to_json
|
|
80
|
+
)
|
|
81
|
+
)
|
|
82
|
+
end
|
|
83
|
+
let(:some_esri_services) do
|
|
84
|
+
described_class.new(
|
|
85
|
+
SolrDocument.new(
|
|
86
|
+
references_field => {
|
|
87
|
+
'urn:x-esri:serviceType:ArcGIS#NotValid' => 'foo',
|
|
88
|
+
'urn:x-esri:serviceType:ArcGIS#TiledMapLayer' => 'foo',
|
|
89
|
+
'urn:x-esri:serviceType:ArcGIS#DynamicMapLayer' => 'foo',
|
|
90
|
+
'urn:x-esri:serviceType:ArcGIS#ImageMapLayer' => 'foo'
|
|
91
|
+
}.to_json
|
|
92
|
+
)
|
|
93
|
+
)
|
|
94
|
+
end
|
|
95
|
+
let(:custom_fields) do
|
|
96
|
+
described_class.new(
|
|
97
|
+
SolrDocument.new, :new_ref_field
|
|
98
|
+
)
|
|
99
|
+
end
|
|
100
|
+
describe '#initialize' do
|
|
101
|
+
it 'parses configured references field to @refs' do
|
|
102
|
+
expect(typical_ogp_shapefile.instance_variable_get(:@refs)).to be_an Array
|
|
103
|
+
end
|
|
104
|
+
it 'empty references return an empty array' do
|
|
105
|
+
empty_refs = no_service_shapefile.instance_variable_get(:@refs)
|
|
106
|
+
expect(empty_refs).to be_an Array
|
|
107
|
+
expect(empty_refs).to eq []
|
|
108
|
+
end
|
|
109
|
+
it 'sets @references_field' do
|
|
110
|
+
expect(typical_ogp_shapefile.reference_field).to eq references_field
|
|
111
|
+
expect(custom_fields.reference_field).to eq :new_ref_field
|
|
112
|
+
end
|
|
113
|
+
end
|
|
114
|
+
describe 'format' do
|
|
115
|
+
it 'returns format' do
|
|
116
|
+
expect(complex_shapefile.format).to eq 'Shapefile'
|
|
117
|
+
expect(direct_download_only.format).to eq 'GeoTIFF'
|
|
118
|
+
end
|
|
119
|
+
end
|
|
120
|
+
describe 'refs' do
|
|
121
|
+
it 'is a set of enumberable references' do
|
|
122
|
+
complex_shapefile.refs.each do |reference|
|
|
123
|
+
expect(reference).to be_an Geoblacklight::Reference
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
describe 'shown_metadata_refs' do
|
|
128
|
+
it 'is a set of metadata references exposed by the configuration' do
|
|
129
|
+
expect(complex_shapefile.shown_metadata_refs.count).to eq 2
|
|
130
|
+
expect(complex_shapefile.shown_metadata_refs.first.type.to_s).to eq 'mods'
|
|
131
|
+
expect(complex_shapefile.shown_metadata_refs.last.type.to_s).to eq 'iso19139'
|
|
132
|
+
end
|
|
133
|
+
context 'with an overridden order for the formats' do
|
|
134
|
+
let(:settings_klass) { class_double('Settings').as_stubbed_const }
|
|
135
|
+
before do
|
|
136
|
+
allow(settings_klass).to receive(:METADATA_SHOWN).and_return %w(iso19139 mods)
|
|
137
|
+
allow(settings_klass).to receive(:FIELDS).and_return OpenStruct.new(FILE_FORMAT: 'dc_format_s')
|
|
138
|
+
end
|
|
139
|
+
it 'is ordered by the configuration' do
|
|
140
|
+
expect(complex_shapefile.shown_metadata_refs.first.type.to_s).to eq 'iso19139'
|
|
141
|
+
expect(complex_shapefile.shown_metadata_refs.last.type.to_s).to eq 'mods'
|
|
142
|
+
end
|
|
143
|
+
end
|
|
144
|
+
end
|
|
145
|
+
describe 'shown_metadata' do
|
|
146
|
+
it 'is a set of metadata resources exposed by the configuration' do
|
|
147
|
+
expect(complex_shapefile.shown_metadata.count).to eq 2
|
|
148
|
+
expect(complex_shapefile.shown_metadata.first).to be_a Geoblacklight::Metadata::Base
|
|
149
|
+
end
|
|
150
|
+
end
|
|
151
|
+
describe 'direct_download' do
|
|
152
|
+
it 'returns the direct download link' do
|
|
153
|
+
download = complex_shapefile.download
|
|
154
|
+
expect(download).to be_an Geoblacklight::Reference
|
|
155
|
+
expect(download.endpoint).to eq('http://example.com/urn:hul.harvard.edu:HARVARD.SDE2.TG10USAIANNH/data.zip')
|
|
156
|
+
expect(direct_download_only.download.endpoint).to eq 'http://example.com/layer-id-geotiff.tiff'
|
|
157
|
+
end
|
|
158
|
+
it 'does not return if download not available' do
|
|
159
|
+
expect(typical_ogp_shapefile.download).to be_nil
|
|
160
|
+
end
|
|
161
|
+
end
|
|
162
|
+
describe 'preferred_download' do
|
|
163
|
+
it 'returns the direct download if available' do
|
|
164
|
+
expect(complex_shapefile.preferred_download[:file_download][:download]).to eq 'http://example.com/urn:hul.harvard.edu:HARVARD.SDE2.TG10USAIANNH/data.zip'
|
|
165
|
+
expect(direct_download_only.preferred_download[:file_download][:download]).to eq 'http://example.com/layer-id-geotiff.tiff'
|
|
166
|
+
end
|
|
167
|
+
it 'returns nil if there is no direct download' do
|
|
168
|
+
expect(typical_ogp_shapefile.preferred_download).to be_nil
|
|
169
|
+
end
|
|
170
|
+
it 'returns nil if there is no direct download' do
|
|
171
|
+
expect(typical_ogp_geotiff.preferred_download).to be_nil
|
|
172
|
+
end
|
|
173
|
+
end
|
|
174
|
+
describe 'download_types' do
|
|
175
|
+
it 'returns available downloads by format' do
|
|
176
|
+
types = complex_shapefile.download_types
|
|
177
|
+
expect(types.first[1]).to eq wfs: 'http://hgl.harvard.edu:8080/geoserver/wfs'
|
|
178
|
+
expect(types.count).to eq 3
|
|
179
|
+
expect(direct_download_only.download_types).to be_nil
|
|
180
|
+
end
|
|
181
|
+
it 'onlies return available downloads if no direct is present' do
|
|
182
|
+
types = typical_ogp_shapefile.download_types
|
|
183
|
+
expect(types.first[1]).to eq wfs: 'http://hgl.harvard.edu:8080/geoserver/wfs'
|
|
184
|
+
expect(types.count).to eq 3
|
|
185
|
+
end
|
|
186
|
+
end
|
|
187
|
+
describe '#esri_webservices' do
|
|
188
|
+
it 'returns webservices that are esri specific' do
|
|
189
|
+
expect(some_esri_services.esri_webservices.length).to eq 3
|
|
190
|
+
end
|
|
191
|
+
end
|
|
192
|
+
describe '#method_missing' do
|
|
193
|
+
it 'defaults to the base behavior if the method signature is not a URI key' do
|
|
194
|
+
expect { typical_ogp_shapefile.invalid }.to raise_error(NoMethodError)
|
|
195
|
+
end
|
|
196
|
+
end
|
|
197
|
+
describe 'downloads_by_format' do
|
|
198
|
+
it 'returns shapefile' do
|
|
199
|
+
expect(typical_ogp_shapefile.downloads_by_format.count).to eq 3
|
|
200
|
+
end
|
|
201
|
+
it 'returns geotiff' do
|
|
202
|
+
expect(typical_ogp_geotiff.downloads_by_format.count).to eq 1
|
|
203
|
+
expect(typical_ogp_geotiff.downloads_by_format[:geotiff][:wms]).to eq 'http://hgl.harvard.edu:8080/geoserver/wms'
|
|
204
|
+
end
|
|
205
|
+
it 'returns arcgrid as geotiff' do
|
|
206
|
+
expect(typical_arcgrid.downloads_by_format.count).to eq 1
|
|
207
|
+
expect(typical_arcgrid.downloads_by_format[:geotiff][:wms]).to eq 'http://hgl.harvard.edu:8080/geoserver/wms'
|
|
208
|
+
end
|
|
209
|
+
it 'does not return shapefile if wms and wfs are not present' do
|
|
210
|
+
expect(no_service_shapefile.downloads_by_format).to be_nil
|
|
211
|
+
end
|
|
212
|
+
it 'does not return GeoTIFF if wms is not present' do
|
|
213
|
+
expect(direct_download_only.downloads_by_format).to be_nil
|
|
214
|
+
end
|
|
215
|
+
end
|
|
216
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Geoblacklight::Relation::Ancestors do
|
|
4
|
+
let(:repository) { Blacklight::Solr::Repository.new(CatalogController.blacklight_config) }
|
|
5
|
+
let(:ancestors) { described_class.new('nyu_2451_34502', repository) }
|
|
6
|
+
let(:empty_ancestors) { described_class.new('harvard-g7064-s2-1834-k3', repository) }
|
|
7
|
+
|
|
8
|
+
describe '#create_search_params' do
|
|
9
|
+
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
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
describe '#execute_query' do
|
|
15
|
+
it 'executes the query for finding ancestors, return response' do
|
|
16
|
+
expect(ancestors.execute_query).to include('responseHeader')
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
describe '#results' do
|
|
21
|
+
it 'produces a hash of results from the query' do
|
|
22
|
+
expect(ancestors.results).to include('numFound')
|
|
23
|
+
expect(ancestors.results).to include('docs')
|
|
24
|
+
end
|
|
25
|
+
it 'has non-zero numfound for a document with ancestors' do
|
|
26
|
+
expect(ancestors.results['numFound']).to be > 0
|
|
27
|
+
end
|
|
28
|
+
it 'has zero numfound for a document without ancestors' do
|
|
29
|
+
expect(empty_ancestors.results['numFound']).to eq(0)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Geoblacklight::Relation::Descendants do
|
|
4
|
+
let(:repository) { Blacklight::Solr::Repository.new(CatalogController.blacklight_config) }
|
|
5
|
+
let(:descendants) { described_class.new('nyu_2451_34636', repository) }
|
|
6
|
+
let(:empty_descendants) { described_class.new('harvard-g7064-s2-1834-k3', repository) }
|
|
7
|
+
|
|
8
|
+
describe '#create_search_params' do
|
|
9
|
+
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
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
describe '#execute_query' do
|
|
15
|
+
it 'executes the query for finding descendants, return response' do
|
|
16
|
+
expect(descendants.execute_query).to include('responseHeader')
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
describe '#results' do
|
|
21
|
+
it 'produces a hash of results from the query' do
|
|
22
|
+
expect(descendants.results).to include('numFound')
|
|
23
|
+
expect(descendants.results).to include('docs')
|
|
24
|
+
end
|
|
25
|
+
it 'has non-zero numfound for a document with descendants' do
|
|
26
|
+
expect(descendants.results['numFound']).to be > 0
|
|
27
|
+
end
|
|
28
|
+
it 'has zero numfound for a document without descendants' do
|
|
29
|
+
expect(empty_descendants.results['numFound']).to eq(0)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Geoblacklight::Relation::RelationResponse do
|
|
4
|
+
let(:repository) { Blacklight::Solr::Repository.new(CatalogController.blacklight_config) }
|
|
5
|
+
let(:relation_resp) { described_class.new('nyu_2451_34502', repository) }
|
|
6
|
+
let(:empty_relation_resp) { described_class.new('harvard-g7064-s2-1834-k3', repository) }
|
|
7
|
+
describe '#initialize' do
|
|
8
|
+
it 'creates a RelationResponse' do
|
|
9
|
+
expect(relation_resp).to be_an described_class
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
describe '#ancestors' do
|
|
14
|
+
it 'returns a hash of ancestor documents' do
|
|
15
|
+
expect(relation_resp.ancestors).to include('numFound')
|
|
16
|
+
expect(relation_resp.ancestors).to include('docs')
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
describe '#descendants' do
|
|
21
|
+
it 'returns a hash of descendant documents' do
|
|
22
|
+
expect(relation_resp.ancestors).to include('numFound')
|
|
23
|
+
expect(relation_resp.ancestors).to include('docs')
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
describe '#empty?' do
|
|
28
|
+
it 'returns false if document has ancestors or descendants' do
|
|
29
|
+
expect(relation_resp.empty?).to be false
|
|
30
|
+
end
|
|
31
|
+
it 'returns true if document has neither ancestors nor descendants' do
|
|
32
|
+
expect(empty_relation_resp.empty?).to be true
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
context 'with a layer slug containing a colon' do
|
|
36
|
+
let(:empty_relation_resp) { described_class.new('uva-Norfolk:police_point', repository) }
|
|
37
|
+
|
|
38
|
+
it 'returns true if document has neither ancestors nor descendants' do
|
|
39
|
+
expect(empty_relation_resp.empty?).to be true
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Geoblacklight::ViewHelperOverride do
|
|
4
|
+
class GeoblacklightControllerTestClass
|
|
5
|
+
include AbstractController::Translation
|
|
6
|
+
attr_accessor :params
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
let(:fake_controller) do
|
|
10
|
+
GeoblacklightControllerTestClass.new
|
|
11
|
+
.extend(described_class)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
describe 'spatial_parameters?' do
|
|
15
|
+
it 'does not have spatial parameters' do
|
|
16
|
+
fake_controller.params = {}
|
|
17
|
+
expect(fake_controller.spatial_parameters?).to be_falsey
|
|
18
|
+
end
|
|
19
|
+
it 'has spatial parameters' do
|
|
20
|
+
fake_controller.params = { bbox: '123' }
|
|
21
|
+
expect(fake_controller.spatial_parameters?).to be_truthy
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
describe 'render_search_to_s_bbox' do
|
|
25
|
+
it 'returns an empty string for no bbox' do
|
|
26
|
+
fake_controller.params = {}
|
|
27
|
+
expect(fake_controller.render_search_to_s_bbox(fake_controller.params)).to eq ''
|
|
28
|
+
end
|
|
29
|
+
it 'returns render_search_to_s_element when bbox is present' do
|
|
30
|
+
fake_controller.params = { bbox: '123' }
|
|
31
|
+
params = { 'bbox' => '123' }
|
|
32
|
+
expect(fake_controller).to receive(:render_search_to_s_element)
|
|
33
|
+
expect(fake_controller).to receive(:render_filter_value)
|
|
34
|
+
fake_controller.render_search_to_s_bbox(params)
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Geoblacklight::FeatureInfoResponse do
|
|
4
|
+
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' })) }
|
|
5
|
+
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' })) }
|
|
6
|
+
let(:error_response) { described_class.new(error: 'bad stuff') }
|
|
7
|
+
let(:content_response) { described_class.new(OpenStruct.new(headers: { 'content-type' => 'text/xml' })) }
|
|
8
|
+
|
|
9
|
+
describe '#initialize' do
|
|
10
|
+
it 'initializes as a FeatureInfoResponse type' do
|
|
11
|
+
expect(response).to be_an described_class
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
describe '#error?' do
|
|
16
|
+
it 'if no error' do
|
|
17
|
+
expect(response.error?).to be_falsey
|
|
18
|
+
end
|
|
19
|
+
it 'if error key is present' do
|
|
20
|
+
expect(error_response.error?).to be_truthy
|
|
21
|
+
end
|
|
22
|
+
it 'if content-type header is text/xml' do
|
|
23
|
+
expect(content_response.error?).to be_truthy
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
describe '#format' do
|
|
28
|
+
it 'returns a formated response' do
|
|
29
|
+
expect(response.format).not_to be_nil
|
|
30
|
+
expect(response.format[:values].length).to eq 2
|
|
31
|
+
expect(response.format[:values][0]).to eq %w(Header1 value1)
|
|
32
|
+
expect(response.format[:values][1]).to eq %w(Header2 value2)
|
|
33
|
+
end
|
|
34
|
+
it 'returns a formated response when multiple features are retrieved' do
|
|
35
|
+
expect(response_multiple_features.format).not_to be_nil
|
|
36
|
+
expect(response_multiple_features.format[:values].length).to eq 2
|
|
37
|
+
expect(response_multiple_features.format[:values][0]).to eq %w(Header1 value1)
|
|
38
|
+
expect(response_multiple_features.format[:values][1]).to eq %w(Header2 value2)
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
describe '#check' do
|
|
43
|
+
it 'returns a formated response if no errors' do
|
|
44
|
+
expect(response.check).to eq response.format
|
|
45
|
+
end
|
|
46
|
+
it 'returns the unformated response if there are errors' do
|
|
47
|
+
expect(error_response.check).to eq error_response.instance_variable_get('@response')
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|