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
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "spec_helper"
|
4
|
+
|
5
|
+
RSpec.describe Geoblacklight::DisplayNoteComponent, type: :component do
|
6
|
+
subject(:rendered) do
|
7
|
+
render_inline_to_capybara_node(described_class.new(**kwargs))
|
8
|
+
end
|
9
|
+
|
10
|
+
describe "prefixed" do
|
11
|
+
let(:kwargs) { {display_note: "Warning: Full force applied."} }
|
12
|
+
it "prefixed, includes display note and icon" do
|
13
|
+
expect(rendered).to have_selector("div.gbl-display-note.alert.alert-warning")
|
14
|
+
expect(rendered).to have_selector("span.blacklight-icons > svg")
|
15
|
+
expect(rendered).to have_text("Warning: Full force applied.")
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
describe "non-prefixed" do
|
20
|
+
let(:kwargs) { {display_note: "Simple note."} }
|
21
|
+
it "non-prefixed, includes only default display note" do
|
22
|
+
expect(rendered).to have_selector("div.gbl-display-note.alert.alert-secondary")
|
23
|
+
expect(rendered).to_not have_selector("span.blacklight-icons > svg")
|
24
|
+
expect(rendered).to have_text("Simple note.")
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
2
|
+
|
3
|
+
require "spec_helper"
|
3
4
|
|
4
5
|
RSpec.describe Geoblacklight::HomepageFeatureFacetComponent, type: :component do
|
5
6
|
subject(:rendered) do
|
@@ -7,7 +8,7 @@ RSpec.describe Geoblacklight::HomepageFeatureFacetComponent, type: :component do
|
|
7
8
|
end
|
8
9
|
|
9
10
|
# Build a search
|
10
|
-
let(:context) { {
|
11
|
+
let(:context) { {whatever: :value} }
|
11
12
|
let(:service) { Blacklight::SearchService.new(config: blacklight_config, user_params: user_params, **context) }
|
12
13
|
let(:repository) { Blacklight::Solr::Repository.new(blacklight_config) }
|
13
14
|
let(:user_params) { {} }
|
@@ -15,25 +16,25 @@ RSpec.describe Geoblacklight::HomepageFeatureFacetComponent, type: :component do
|
|
15
16
|
let(:copy_of_catalog_config) { ::CatalogController.blacklight_config.deep_copy }
|
16
17
|
let(:blacklight_solr) { RSolr.connect(Blacklight.connection_config.except(:adapter)) }
|
17
18
|
|
18
|
-
describe
|
19
|
+
describe "homepage" do
|
19
20
|
before do
|
20
21
|
(@response, @document_list) = service.search_results
|
21
22
|
end
|
22
23
|
|
23
24
|
let(:kargs) do
|
24
25
|
{
|
25
|
-
icon:
|
26
|
-
label:
|
26
|
+
icon: "home",
|
27
|
+
label: "geoblacklight.home.institution",
|
27
28
|
facet_field: Settings.FIELDS.PROVIDER,
|
28
29
|
response: @response
|
29
30
|
}
|
30
31
|
end
|
31
32
|
|
32
|
-
it
|
33
|
-
expect(rendered).to have_selector(
|
34
|
-
expect(rendered).to have_selector(
|
35
|
-
expect(rendered).to have_selector(
|
36
|
-
expect(rendered).to have_selector(
|
33
|
+
it "includes facet links" do
|
34
|
+
expect(rendered).to have_selector("div.category-block")
|
35
|
+
expect(rendered).to have_selector("div.category-icon")
|
36
|
+
expect(rendered).to have_selector("a.home-facet-link")
|
37
|
+
expect(rendered).to have_selector("a.more_facets_link")
|
37
38
|
end
|
38
39
|
end
|
39
40
|
end
|
@@ -1,17 +1,18 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
2
|
+
|
3
|
+
require "spec_helper"
|
3
4
|
|
4
5
|
RSpec.describe Geoblacklight::IconFacetItemComponent, type: :component do
|
5
6
|
subject(:rendered) do
|
6
7
|
render_inline_to_capybara_node(described_class.new(suppress_link: true, **kwargs))
|
7
8
|
end
|
8
9
|
|
9
|
-
let(:kwargs) { {
|
10
|
-
let(:facet_item) { instance_double(Blacklight::FacetItemPresenter, label:
|
11
|
-
let(:facet_config) { Blacklight::Configuration::FacetField.new(field:
|
10
|
+
let(:kwargs) { {facet_item: facet_item} }
|
11
|
+
let(:facet_item) { instance_double(Blacklight::FacetItemPresenter, label: "Stanford", value: "stanford", hits: 5, href: nil, selected?: false, facet_config: facet_config) }
|
12
|
+
let(:facet_config) { Blacklight::Configuration::FacetField.new(field: "provider_facet", label: "Provider") }
|
12
13
|
|
13
|
-
it
|
14
|
-
expect(rendered).to have_selector(
|
15
|
-
expect(rendered).to have_selector(
|
14
|
+
it "prepends the icon to the facet item label" do
|
15
|
+
expect(rendered).to have_selector("span.facet-label", text: "Stanford")
|
16
|
+
expect(rendered).to have_selector("span.facet-label svg title", text: "Stanford University")
|
16
17
|
end
|
17
18
|
end
|
@@ -1,15 +1,16 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
require 'spec_helper'
|
3
2
|
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
require "spec_helper"
|
4
|
+
|
5
|
+
describe "Config" do
|
6
|
+
it "Loads new v4.1 Settings defaults" do
|
7
|
+
expect(Settings).to respond_to("RELATIONSHIPS_SHOWN")
|
8
|
+
expect(Settings.FIELDS.DISPLAY_NOTE).to be_present
|
9
|
+
expect(Settings.DISPLAY_NOTES_SHOWN).to respond_to(:danger)
|
10
|
+
expect(Settings.SIDEBAR_STATIC_MAP).to include("iiif")
|
11
|
+
|
7
12
|
[:field, :query_type, :icon, :label].each do |method|
|
8
|
-
expect(Settings.RELATIONSHIPS_SHOWN.
|
13
|
+
expect(Settings.RELATIONSHIPS_SHOWN.MEMBER_OF_ANCESTORS).to respond_to(method)
|
9
14
|
end
|
10
15
|
end
|
11
|
-
|
12
|
-
it 'Loads new v3.4 Settings.FIELDS defaults' do
|
13
|
-
expect(Settings.HOMEPAGE_MAP_GEOM).to be_nil
|
14
|
-
end
|
15
16
|
end
|
@@ -1,61 +1,62 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
2
|
+
|
3
|
+
require "spec_helper"
|
3
4
|
|
4
5
|
describe CatalogController, type: :controller do
|
5
|
-
describe
|
6
|
-
it
|
7
|
-
get :web_services, params: {
|
6
|
+
describe "#web_services" do
|
7
|
+
it "returns a document based off an id" do
|
8
|
+
get :web_services, params: {id: "mit-f6rqs4ucovjk2"}
|
8
9
|
expect(response).to have_http_status :ok
|
9
10
|
expect(assigns(:documents)).not_to be_nil
|
10
11
|
end
|
11
12
|
end
|
12
13
|
|
13
|
-
describe
|
14
|
-
it
|
14
|
+
describe ".default_solr_params" do
|
15
|
+
it "sets the number of rows returned by Solr to 10 and does not filter the results" do
|
15
16
|
get :index
|
16
17
|
expect(response).to have_http_status :ok
|
17
18
|
expect(assigns(:response).docs).not_to be_empty
|
18
19
|
expect(assigns(:response).docs.length).to eq 10
|
19
20
|
end
|
20
21
|
|
21
|
-
it
|
22
|
+
it "sets the starting document index to 0" do
|
22
23
|
get :index
|
23
24
|
expect(response).to have_http_status :ok
|
24
25
|
expect(assigns(:response).docs).not_to be_empty
|
25
|
-
expect(assigns(:response).docs.first.id).to eq
|
26
|
+
expect(assigns(:response).docs.first.id).to eq "stanford-cg357zz0321"
|
26
27
|
end
|
27
28
|
|
28
|
-
context
|
29
|
+
context "with altered default parameters" do
|
29
30
|
let(:blacklight_config) { Blacklight::Configuration.new }
|
30
31
|
|
31
32
|
before do
|
32
33
|
allow(controller).to receive_messages blacklight_config: blacklight_config
|
33
34
|
end
|
34
35
|
|
35
|
-
it
|
36
|
-
blacklight_config.default_solr_params = {
|
36
|
+
it "sets the starting document index" do
|
37
|
+
blacklight_config.default_solr_params = {:start => 2, "q.alt" => "*:*"}
|
37
38
|
get :index
|
38
39
|
expect(response).to have_http_status :ok
|
39
40
|
expect(assigns(:response).docs).not_to be_empty
|
40
|
-
expect(assigns(:response).docs.first.id).to eq
|
41
|
+
expect(assigns(:response).docs.first.id).to eq "mit-001145244"
|
41
42
|
end
|
42
43
|
|
43
|
-
it
|
44
|
-
blacklight_config.default_solr_params = {
|
44
|
+
it "filters using a default DisMax query when no query is provided by the client" do
|
45
|
+
blacklight_config.default_solr_params = {:start => 10, "q.alt" => "{!dismax}id:nyu"}
|
45
46
|
get :index
|
46
47
|
expect(response).to have_http_status :ok
|
47
48
|
expect(assigns(:response).docs).to be_empty
|
48
49
|
end
|
49
50
|
end
|
50
51
|
|
51
|
-
context
|
52
|
+
context "with altered per page parameters" do
|
52
53
|
let(:blacklight_config) { Blacklight::Configuration.new }
|
53
54
|
|
54
55
|
before do
|
55
56
|
allow(controller).to receive_messages blacklight_config: blacklight_config
|
56
57
|
end
|
57
58
|
|
58
|
-
it
|
59
|
+
it "alters the number of documents returned from Solr" do
|
59
60
|
blacklight_config.default_per_page = 20
|
60
61
|
get :index
|
61
62
|
expect(response).to have_http_status :ok
|
@@ -65,19 +66,19 @@ describe CatalogController, type: :controller do
|
|
65
66
|
end
|
66
67
|
end
|
67
68
|
|
68
|
-
describe
|
69
|
-
it
|
70
|
-
get :raw, params: {
|
69
|
+
describe "#raw" do
|
70
|
+
it "returns a JSON representation of a Solr Document" do
|
71
|
+
get :raw, params: {id: "tufts-cambridgegrid100-04"}
|
71
72
|
expect(response).to have_http_status :ok
|
72
73
|
expect(response.body).not_to be_empty
|
73
74
|
response_values = JSON.parse(response.body)
|
74
|
-
expect(response_values).to include
|
75
|
-
expect(response_values).to include Settings.FIELDS.TITLE =>
|
76
|
-
expect(response_values).to include Settings.FIELDS.IDENTIFIER => [
|
77
|
-
expect(response_values).to include Settings.FIELDS.ACCESS_RIGHTS =>
|
78
|
-
expect(response_values).to include Settings.FIELDS.PROVIDER =>
|
79
|
-
expect(response_values).to include Settings.FIELDS.ID =>
|
80
|
-
expect(response_values).to include Settings.FIELDS.GEOMETRY =>
|
75
|
+
expect(response_values).to include "gbl_mdVersion_s" => "Aardvark"
|
76
|
+
expect(response_values).to include Settings.FIELDS.TITLE => "100 Foot Grid Cambridge MA 2004"
|
77
|
+
expect(response_values).to include Settings.FIELDS.IDENTIFIER => ["urn:geodata.tufts.edu:Tufts.CambridgeGrid100_04"]
|
78
|
+
expect(response_values).to include Settings.FIELDS.ACCESS_RIGHTS => "Public"
|
79
|
+
expect(response_values).to include Settings.FIELDS.PROVIDER => "Tufts"
|
80
|
+
expect(response_values).to include Settings.FIELDS.ID => "tufts-cambridgegrid100-04"
|
81
|
+
expect(response_values).to include Settings.FIELDS.GEOMETRY => "ENVELOPE(-71.163984,-71.052581,42.408316,42.34757)"
|
81
82
|
end
|
82
83
|
end
|
83
84
|
end
|
@@ -1,120 +1,121 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
2
|
+
|
3
|
+
require "spec_helper"
|
3
4
|
|
4
5
|
describe DownloadController, type: :controller do
|
5
|
-
describe
|
6
|
-
describe
|
7
|
-
it
|
8
|
-
get :file, params: {
|
6
|
+
describe "#file" do
|
7
|
+
describe "restricted file" do
|
8
|
+
it "redirects to login for authentication" do
|
9
|
+
get :file, params: {id: "stanford-cg357zz0321-shapefile", format: "zip"}
|
9
10
|
expect(response).to have_http_status :unauthorized
|
10
11
|
end
|
11
12
|
end
|
12
|
-
describe
|
13
|
-
it
|
13
|
+
describe "public file" do
|
14
|
+
it "initiates download" do
|
14
15
|
allow(controller).to receive(:render) # Needed for testing with Rails 4
|
15
16
|
expect(controller).to receive(:send_file)
|
16
|
-
get :file, params: {
|
17
|
+
get :file, params: {id: "mit-f6rqs4ucovjk2-shapefile", format: "zip"}
|
17
18
|
end
|
18
19
|
end
|
19
20
|
end
|
20
|
-
describe
|
21
|
-
describe
|
22
|
-
it
|
23
|
-
get :show, params: {
|
21
|
+
describe "#show" do
|
22
|
+
describe "restricted file" do
|
23
|
+
it "redirects to login for authentication" do
|
24
|
+
get :show, params: {id: "stanford-cg357zz0321", format: "json"}
|
24
25
|
expect(response).to have_http_status :unauthorized
|
25
26
|
end
|
26
27
|
end
|
27
|
-
describe
|
28
|
+
describe "public file" do
|
28
29
|
let(:shapefile_download) { instance_double(Geoblacklight::ShapefileDownload) }
|
29
30
|
|
30
31
|
before do
|
31
32
|
allow(Geoblacklight::ShapefileDownload).to receive(:new).and_return(shapefile_download)
|
32
33
|
end
|
33
34
|
|
34
|
-
it
|
35
|
-
allow(shapefile_download).to receive(:get).and_return(
|
36
|
-
get :show, params: {
|
35
|
+
it "initiates download creation" do
|
36
|
+
allow(shapefile_download).to receive(:get).and_return("success")
|
37
|
+
get :show, params: {id: "mit-f6rqs4ucovjk2", type: "shapefile"}
|
37
38
|
expect(response).to have_http_status :ok
|
38
39
|
end
|
39
40
|
end
|
40
41
|
|
41
|
-
context
|
42
|
-
let(:id) {
|
43
|
-
let(:type) {
|
42
|
+
context "when requesting GeoJSON files" do
|
43
|
+
let(:id) { "tufts-cambridgegrid100-04" }
|
44
|
+
let(:type) { "geojson" }
|
44
45
|
let(:geojson_download) { instance_double(Geoblacklight::GeojsonDownload) }
|
45
46
|
|
46
47
|
before do
|
47
|
-
allow(geojson_download).to receive(:get).and_return(
|
48
|
+
allow(geojson_download).to receive(:get).and_return("file.json")
|
48
49
|
allow(Geoblacklight::GeojsonDownload).to receive(:new).and_return(geojson_download)
|
49
50
|
end
|
50
51
|
|
51
|
-
it
|
52
|
+
it "downloads the files and notifies the user" do
|
52
53
|
expect(Geoblacklight::GeojsonDownload).to receive(:new)
|
53
|
-
get :show, params: {
|
54
|
+
get :show, params: {id: id, type: type}
|
54
55
|
|
55
|
-
expect(response.body).to include
|
56
|
-
expect(response.body).to include
|
56
|
+
expect(response.body).to include "success"
|
57
|
+
expect(response.body).to include "Your file file.json is ready for download"
|
57
58
|
end
|
58
59
|
end
|
59
60
|
|
60
|
-
context
|
61
|
-
let(:id) {
|
62
|
-
let(:type) {
|
61
|
+
context "when requesting GeoTIFF files" do
|
62
|
+
let(:id) { "tufts-cambridgegrid100-04" }
|
63
|
+
let(:type) { "geotiff" }
|
63
64
|
let(:geotiff_download) { instance_double(Geoblacklight::GeotiffDownload) }
|
64
65
|
|
65
66
|
before do
|
66
|
-
allow(geotiff_download).to receive(:get).and_return(
|
67
|
+
allow(geotiff_download).to receive(:get).and_return("file.tiff")
|
67
68
|
allow(Geoblacklight::GeotiffDownload).to receive(:new).and_return(geotiff_download)
|
68
69
|
end
|
69
70
|
|
70
|
-
it
|
71
|
+
it "downloads the files and notifies the user" do
|
71
72
|
expect(Geoblacklight::GeotiffDownload).to receive(:new)
|
72
|
-
get :show, params: {
|
73
|
+
get :show, params: {id: id, type: type}
|
73
74
|
|
74
|
-
expect(response.body).to include
|
75
|
-
expect(response.body).to include
|
75
|
+
expect(response.body).to include "success"
|
76
|
+
expect(response.body).to include "Your file file.tiff is ready for download"
|
76
77
|
end
|
77
78
|
end
|
78
79
|
end
|
79
80
|
|
80
|
-
describe
|
81
|
+
describe "#hgl" do
|
81
82
|
let(:hgl_download) { instance_double(Geoblacklight::HglDownload) }
|
82
83
|
|
83
|
-
it
|
84
|
-
allow(hgl_download).to receive(:get).and_return(
|
84
|
+
it "requests file" do
|
85
|
+
allow(hgl_download).to receive(:get).and_return("success")
|
85
86
|
allow(Geoblacklight::HglDownload).to receive(:new).and_return(hgl_download)
|
86
87
|
|
87
|
-
get :hgl, params: {
|
88
|
+
get :hgl, params: {id: "harvard-g7064-s2-1834-k3", email: "foo@example.com"}
|
88
89
|
expect(response).to have_http_status :ok
|
89
90
|
end
|
90
91
|
|
91
|
-
it
|
92
|
+
it "renders form" do
|
92
93
|
allow(Geoblacklight::HglDownload).to receive(:new).and_return(hgl_download)
|
93
94
|
|
94
|
-
get :hgl, params: {
|
95
|
-
expect(response).to render_template(
|
95
|
+
get :hgl, params: {id: "harvard-g7064-s2-1834-k3"}
|
96
|
+
expect(response).to render_template("hgl")
|
96
97
|
end
|
97
98
|
|
98
|
-
context
|
99
|
+
context "when an error occurs while downloading a file" do
|
99
100
|
let(:exception) { Geoblacklight::Exceptions::ExternalDownloadFailed.new(url: nil) }
|
100
101
|
|
101
|
-
it
|
102
|
+
it "uses the default error message when the exception does not have a URL" do
|
102
103
|
allow(Geoblacklight::HglDownload).to receive(:new).and_raise(exception)
|
103
104
|
|
104
|
-
get :hgl, params: {
|
105
|
-
expect(response.body).to include(
|
106
|
-
expect(response.body).to include(
|
105
|
+
get :hgl, params: {id: "harvard-g7064-s2-1834-k3", email: "foo@example.com"}
|
106
|
+
expect(response.body).to include("danger")
|
107
|
+
expect(response.body).to include("Sorry, the requested file could not be downloaded")
|
107
108
|
end
|
108
109
|
end
|
109
110
|
|
110
|
-
context
|
111
|
-
it
|
111
|
+
context "when downloading the requested file fails" do
|
112
|
+
it "flashes the error message" do
|
112
113
|
allow(hgl_download).to receive(:get).and_return(nil)
|
113
114
|
allow(Geoblacklight::HglDownload).to receive(:new).and_return(hgl_download)
|
114
115
|
|
115
|
-
get :hgl, params: {
|
116
|
-
expect(response.body).to include(
|
117
|
-
expect(response.body).to include(
|
116
|
+
get :hgl, params: {id: "harvard-g7064-s2-1834-k3", email: "foo@example.com"}
|
117
|
+
expect(response.body).to include("danger")
|
118
|
+
expect(response.body).to include("Sorry, the requested file could not be downloaded")
|
118
119
|
end
|
119
120
|
end
|
120
121
|
end
|
@@ -1,10 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
2
|
+
|
3
|
+
require "spec_helper"
|
3
4
|
|
4
5
|
describe RelationController, type: :controller do
|
5
|
-
describe
|
6
|
-
it
|
7
|
-
get :index, params: {
|
6
|
+
describe "#index" do
|
7
|
+
it "returns a listing of related documents for a record" do
|
8
|
+
get :index, params: {id: "nyu_2451_34502"}
|
8
9
|
expect(response).to have_http_status :ok
|
9
10
|
expect(assigns(:relations)).not_to be_nil
|
10
11
|
end
|
@@ -1,13 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
2
|
+
|
3
|
+
require "spec_helper"
|
3
4
|
|
4
5
|
describe WmsController, type: :controller do
|
5
6
|
let(:wms_layer) { instance_double(Geoblacklight::WmsLayer) }
|
6
|
-
let(:feature_info) { {
|
7
|
+
let(:feature_info) { {values: ["fid", "layer:example"]} }
|
7
8
|
let(:params) do
|
8
|
-
{
|
9
|
-
|
10
|
-
|
9
|
+
{"format" => "json", "URL" => "http://www.example.com/", "LAYERS" => "layer:example",
|
10
|
+
"BBOX" => "-74, 40, -68, 43", "WIDTH" => "500", "HEIGHT" => "400",
|
11
|
+
"QUERY_LAYERS" => "layer:example", "X" => "277", "Y" => "195"}
|
11
12
|
end
|
12
13
|
|
13
14
|
before do
|
@@ -15,17 +16,17 @@ describe WmsController, type: :controller do
|
|
15
16
|
allow(wms_layer).to receive(:feature_info).and_return(feature_info)
|
16
17
|
end
|
17
18
|
|
18
|
-
describe
|
19
|
-
it
|
19
|
+
describe "#handle" do
|
20
|
+
it "returns feature info as json" do
|
20
21
|
get :handle, params: params
|
21
22
|
expect(response.body).to eq(feature_info.to_json)
|
22
23
|
end
|
23
24
|
end
|
24
25
|
|
25
|
-
describe
|
26
|
+
describe "#wms_params" do
|
26
27
|
let(:wms_params) { controller.instance_eval { wms_params } }
|
27
28
|
|
28
|
-
it
|
29
|
+
it "returns only permitted params" do
|
29
30
|
get :handle, params: params
|
30
31
|
expect(wms_params.to_h).to eq(params)
|
31
32
|
end
|
data/spec/factories/user.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
FactoryBot.define do
|
3
4
|
factory :user do
|
4
5
|
sequence(:email) { |n| "user#{n}@example.com" }
|
5
|
-
password {
|
6
|
-
password_confirmation {
|
6
|
+
password { "password" }
|
7
|
+
password_confirmation { "password" }
|
7
8
|
end
|
8
9
|
end
|
@@ -1,11 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
require 'spec_helper'
|
3
2
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
3
|
+
require "spec_helper"
|
4
|
+
|
5
|
+
feature "Blacklight Bookmarks" do
|
6
|
+
scenario "index has created bookmarks" do
|
7
|
+
visit solr_document_path "nyu-2451-34564"
|
8
|
+
click_button "Bookmark"
|
8
9
|
visit bookmarks_path
|
9
|
-
expect(page).to have_css
|
10
|
+
expect(page).to have_css ".document", count: 1
|
10
11
|
end
|
11
12
|
end
|
@@ -1,34 +1,35 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
require 'spec_helper'
|
3
2
|
|
4
|
-
|
5
|
-
|
3
|
+
require "spec_helper"
|
4
|
+
|
5
|
+
feature "Configurable basemap", js: true do
|
6
|
+
scenario "defaults to positron" do
|
6
7
|
visit root_path
|
7
8
|
expect(page).to have_css "img[src*='carto']"
|
8
9
|
end
|
9
|
-
feature
|
10
|
+
feature "without provided basemap config" do
|
10
11
|
before do
|
11
12
|
CatalogController.blacklight_config.basemap_provider = nil
|
12
13
|
end
|
13
|
-
scenario
|
14
|
+
scenario "has Carto map" do
|
14
15
|
visit root_path
|
15
16
|
expect(page).to have_css "img[src*='carto']"
|
16
17
|
end
|
17
18
|
end
|
18
|
-
feature
|
19
|
+
feature "using darkMatter" do
|
19
20
|
before do
|
20
|
-
CatalogController.blacklight_config.basemap_provider =
|
21
|
+
CatalogController.blacklight_config.basemap_provider = "darkMatter"
|
21
22
|
end
|
22
|
-
scenario
|
23
|
+
scenario "has darkMatter map" do
|
23
24
|
visit root_path
|
24
25
|
expect(page).to have_css "img[src*='dark_all']"
|
25
26
|
end
|
26
27
|
end
|
27
|
-
feature
|
28
|
+
feature "using openstreetmapHot" do
|
28
29
|
before do
|
29
|
-
CatalogController.blacklight_config.basemap_provider =
|
30
|
+
CatalogController.blacklight_config.basemap_provider = "openstreetmapHot"
|
30
31
|
end
|
31
|
-
scenario
|
32
|
+
scenario "has openstreetmapHot map" do
|
32
33
|
visit root_path
|
33
34
|
expect(page).to have_css "img[src*='hot']"
|
34
35
|
end
|
@@ -1,17 +1,18 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
require 'spec_helper'
|
3
2
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
3
|
+
require "spec_helper"
|
4
|
+
|
5
|
+
feature "Data dictionary download tool" do
|
6
|
+
feature "when data_dictionary reference present" do
|
7
|
+
scenario "shows up in tools" do
|
8
|
+
visit solr_document_path "nyu_2451_34502"
|
9
|
+
expect(page).to have_css "li.data_dictionary a", text: "Documentation"
|
9
10
|
end
|
10
11
|
end
|
11
|
-
feature
|
12
|
-
scenario
|
13
|
-
visit solr_document_path
|
14
|
-
expect(page).not_to have_css
|
12
|
+
feature "when data_dictionary reference absent" do
|
13
|
+
scenario "download tool is not rendered" do
|
14
|
+
visit solr_document_path "stanford-cg357zz0321"
|
15
|
+
expect(page).not_to have_css "li.data_dictionary a", text: "Documentation"
|
15
16
|
end
|
16
17
|
end
|
17
18
|
end
|