geoblacklight 4.0.0 → 4.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (225) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +21 -6
  3. data/.solr_wrapper +1 -0
  4. data/.standard.yml +1 -0
  5. data/Gemfile +13 -11
  6. data/README.md +1 -1
  7. data/Rakefile +42 -50
  8. data/app/assets/images/blacklight/american-geographical-society-library-uwm-libraries.svg +26 -0
  9. data/app/assets/images/blacklight/arizona.svg +4 -0
  10. data/app/assets/images/blacklight/circle-info-solid.svg +1 -0
  11. data/app/assets/images/blacklight/fire-solid.svg +1 -0
  12. data/app/assets/images/blacklight/lightbulb-solid.svg +1 -0
  13. data/app/assets/images/blacklight/nebraska.svg +4 -0
  14. data/app/assets/images/blacklight/rutgers.svg +5 -0
  15. data/app/assets/images/blacklight/triangle-exclamation-solid.svg +1 -0
  16. data/app/assets/stylesheets/geoblacklight/modules/sidebar.scss +8 -0
  17. data/app/components/geoblacklight/display_note_component.html.erb +1 -0
  18. data/app/components/geoblacklight/display_note_component.rb +47 -0
  19. data/app/components/geoblacklight/icon_facet_item_component.rb +2 -2
  20. data/app/controllers/download_controller.rb +36 -37
  21. data/app/controllers/relation_controller.rb +1 -0
  22. data/app/controllers/wms_controller.rb +1 -0
  23. data/app/helpers/arcgis_helper.rb +2 -1
  24. data/app/helpers/blacklight_helper.rb +2 -1
  25. data/app/helpers/carto_helper.rb +3 -2
  26. data/app/helpers/geoblacklight/geoblacklight_helper_behavior.rb +2 -1
  27. data/app/helpers/geoblacklight_helper.rb +44 -36
  28. data/app/models/concerns/geoblacklight/bbox_filter_query.rb +1 -1
  29. data/app/models/concerns/geoblacklight/solr_document/arcgis.rb +1 -0
  30. data/app/models/concerns/geoblacklight/solr_document/carto.rb +1 -0
  31. data/app/models/concerns/geoblacklight/solr_document/citation.rb +3 -2
  32. data/app/models/concerns/geoblacklight/solr_document/finder.rb +1 -0
  33. data/app/models/concerns/geoblacklight/solr_document/inspection.rb +1 -0
  34. data/app/models/concerns/geoblacklight/solr_document.rb +17 -9
  35. data/app/models/concerns/geoblacklight/suppressed_records_search_behavior.rb +2 -1
  36. data/app/presenters/geoblacklight/document_presenter.rb +3 -2
  37. data/app/views/catalog/_show_default_display_note.html.erb +7 -0
  38. data/app/views/catalog/_show_sidebar.html.erb +1 -0
  39. data/app/views/catalog/_show_sidebar_static_map.html.erb +10 -0
  40. data/app/views/relation/index.json.jbuilder +1 -1
  41. data/config/initializers/new_gbl_settings_defaults_4.1.yml +104 -0
  42. data/config/initializers/rails_config.rb +5 -1
  43. data/config/locales/geoblacklight.en.yml +18 -10
  44. data/geoblacklight.gemspec +36 -40
  45. data/lib/generators/geoblacklight/assets_generator.rb +15 -15
  46. data/lib/generators/geoblacklight/install_generator.rb +24 -23
  47. data/lib/generators/geoblacklight/templates/catalog_controller.rb +66 -71
  48. data/lib/generators/geoblacklight/templates/settings.yml +74 -22
  49. data/lib/geoblacklight/bounding_box.rb +1 -0
  50. data/lib/geoblacklight/constants.rb +26 -25
  51. data/lib/geoblacklight/download/geojson_download.rb +10 -9
  52. data/lib/geoblacklight/download/geotiff_download.rb +6 -5
  53. data/lib/geoblacklight/download/hgl_download.rb +4 -3
  54. data/lib/geoblacklight/download/kmz_download.rb +11 -10
  55. data/lib/geoblacklight/download/shapefile_download.rb +10 -9
  56. data/lib/geoblacklight/download.rb +12 -11
  57. data/lib/geoblacklight/engine.rb +10 -9
  58. data/lib/geoblacklight/exceptions.rb +3 -0
  59. data/lib/geoblacklight/faraday_middleware/follow_redirects.rb +12 -11
  60. data/lib/geoblacklight/geometry.rb +6 -5
  61. data/lib/geoblacklight/item_viewer.rb +4 -3
  62. data/lib/geoblacklight/metadata/base.rb +4 -3
  63. data/lib/geoblacklight/metadata/fgdc.rb +1 -0
  64. data/lib/geoblacklight/metadata/html.rb +5 -4
  65. data/lib/geoblacklight/metadata/iso19139.rb +1 -0
  66. data/lib/geoblacklight/metadata.rb +1 -0
  67. data/lib/geoblacklight/metadata_transformer/base.rb +5 -4
  68. data/lib/geoblacklight/metadata_transformer/fgdc.rb +1 -0
  69. data/lib/geoblacklight/metadata_transformer/iso19139.rb +1 -0
  70. data/lib/geoblacklight/metadata_transformer.rb +6 -2
  71. data/lib/geoblacklight/reference.rb +3 -2
  72. data/lib/geoblacklight/references.rb +11 -6
  73. data/lib/geoblacklight/relation/ancestors.rb +4 -3
  74. data/lib/geoblacklight/relation/descendants.rb +4 -3
  75. data/lib/geoblacklight/relation/relation_response.rb +3 -2
  76. data/lib/geoblacklight/routes/downloadable.rb +3 -2
  77. data/lib/geoblacklight/routes/exportable.rb +4 -3
  78. data/lib/geoblacklight/routes/wms.rb +2 -1
  79. data/lib/geoblacklight/routes.rb +4 -3
  80. data/lib/geoblacklight/version.rb +2 -1
  81. data/lib/geoblacklight/view_helper_override.rb +3 -2
  82. data/lib/geoblacklight/wms_layer/feature_info_response.rb +5 -4
  83. data/lib/geoblacklight/wms_layer.rb +4 -3
  84. data/lib/geoblacklight.rb +32 -31
  85. data/lib/tasks/geoblacklight.rake +45 -44
  86. data/schema/geoblacklight-schema-aardvark.json +6 -0
  87. data/spec/components/geoblacklight/display_note_component_spec.rb +27 -0
  88. data/spec/components/geoblacklight/homepage_feature_facet_component_spec.rb +11 -10
  89. data/spec/components/geoblacklight/icon_facet_item_component_spec.rb +8 -7
  90. data/spec/config/initializers/rails_config_spec.rb +10 -9
  91. data/spec/controllers/catalog_controller_spec.rb +27 -26
  92. data/spec/controllers/download_controller_spec.rb +50 -49
  93. data/spec/controllers/relation_controller_spec.rb +5 -4
  94. data/spec/controllers/wms_controller_spec.rb +10 -9
  95. data/spec/factories/user.rb +3 -2
  96. data/spec/features/bookmarks_spec.rb +7 -6
  97. data/spec/features/configurable_basemap_spec.rb +12 -11
  98. data/spec/features/data_dictionary_download_spec.rb +11 -10
  99. data/spec/features/download_layer_spec.rb +64 -63
  100. data/spec/features/empty_search_spec.rb +6 -5
  101. data/spec/features/esri_viewer_spec.rb +33 -32
  102. data/spec/features/exports_spec.rb +18 -17
  103. data/spec/features/full_screen_controll_spec.rb +8 -8
  104. data/spec/features/help_text_spec.rb +6 -5
  105. data/spec/features/home_page_spec.rb +30 -29
  106. data/spec/features/iiif_viewer_spec.rb +6 -5
  107. data/spec/features/index_map_spec.rb +17 -16
  108. data/spec/features/layer_inspection_spec.rb +8 -7
  109. data/spec/features/layer_opacity_spec.rb +15 -14
  110. data/spec/features/layer_preview_spec.rb +11 -10
  111. data/spec/features/layer_with_no_references_spec.rb +5 -4
  112. data/spec/features/linkified_attribute_table_spec.rb +8 -7
  113. data/spec/features/metadata_panel_spec.rb +32 -31
  114. data/spec/features/missing_metadata_spec.rb +18 -17
  115. data/spec/features/multiple_downloads_spec.rb +11 -10
  116. data/spec/features/oembed_spec.rb +6 -5
  117. data/spec/features/relations_spec.rb +51 -26
  118. data/spec/features/saved_searches_spec.rb +7 -6
  119. data/spec/features/search_bar_spec.rb +9 -8
  120. data/spec/features/search_results_complex_geometry_spec.rb +12 -11
  121. data/spec/features/search_results_icons_spec.rb +10 -9
  122. data/spec/features/search_results_map_spec.rb +21 -20
  123. data/spec/features/search_results_overlap_ratio_spec.rb +17 -16
  124. data/spec/features/search_spec.rb +19 -18
  125. data/spec/features/show_page_download_spec.rb +15 -14
  126. data/spec/features/show_page_metadata_spec.rb +9 -8
  127. data/spec/features/show_page_sidebar_static_map_spec.rb +21 -0
  128. data/spec/features/sms_spec.rb +12 -11
  129. data/spec/features/split_view.html.erb_spec.rb +56 -55
  130. data/spec/features/suppressed_records_spec.rb +10 -9
  131. data/spec/features/tilejson_spec.rb +9 -8
  132. data/spec/features/tms_spec.rb +6 -5
  133. data/spec/features/web_services_modal_spec.rb +37 -36
  134. data/spec/features/wmts_spec.rb +16 -15
  135. data/spec/features/xyz_spec.rb +6 -5
  136. data/spec/fixtures/solr_documents/actual-papermap1.json +1 -1
  137. data/spec/fixtures/solr_documents/actual-point1.json +1 -1
  138. data/spec/fixtures/solr_documents/actual-polygon1.json +1 -1
  139. data/spec/fixtures/solr_documents/actual-raster1.json +1 -1
  140. data/spec/fixtures/solr_documents/baruch_ancestor1.json +1 -1
  141. data/spec/fixtures/solr_documents/baruch_ancestor2.json +1 -1
  142. data/spec/fixtures/solr_documents/baruch_documentation_download.json +2 -2
  143. data/spec/fixtures/solr_documents/cornell_html_metadata.json +1 -1
  144. data/spec/fixtures/solr_documents/display-note.json +52 -0
  145. data/spec/fixtures/solr_documents/esri-dynamic-layer-all-layers.json +1 -1
  146. data/spec/fixtures/solr_documents/esri-dynamic-layer-single-layer.json +1 -1
  147. data/spec/fixtures/solr_documents/esri-feature-layer.json +1 -1
  148. data/spec/fixtures/solr_documents/esri-image-map-layer.json +1 -1
  149. data/spec/fixtures/solr_documents/esri-tiled_map_layer.json +1 -1
  150. data/spec/fixtures/solr_documents/esri-wms-layer.json +1 -1
  151. data/spec/fixtures/solr_documents/harvard_raster.json +1 -1
  152. data/spec/fixtures/solr_documents/iiif-eastern-hemisphere.json +1 -1
  153. data/spec/fixtures/solr_documents/index-map-polygon-no-downloadurl.json +1 -1
  154. data/spec/fixtures/solr_documents/index-map-polygon.json +1 -1
  155. data/spec/fixtures/solr_documents/index-map-stanford.json +1 -1
  156. data/spec/fixtures/solr_documents/index_map_point.json +1 -1
  157. data/spec/fixtures/solr_documents/princeton-parent.json +1 -1
  158. data/spec/fixtures/solr_documents/public_direct_download.json +1 -1
  159. data/spec/fixtures/solr_documents/public_iiif_princeton.json +1 -1
  160. data/spec/fixtures/solr_documents/restricted-line.json +1 -1
  161. data/spec/fixtures/solr_documents/tilejson.json +2 -2
  162. data/spec/fixtures/solr_documents/umn_metro_result1.json +2 -2
  163. data/spec/fixtures/solr_documents/umn_state_result1.json +1 -1
  164. data/spec/fixtures/solr_documents/umn_state_result2.json +1 -1
  165. data/spec/fixtures/solr_documents/uva_slug_colon.json +1 -1
  166. data/spec/fixtures/solr_documents/wmts-multiple.json +1 -1
  167. data/spec/fixtures/solr_documents/wmts-single-layer.json +6 -6
  168. data/spec/fixtures/solr_documents/xyz.json +3 -3
  169. data/spec/helpers/arcgis_helper_spec.rb +8 -7
  170. data/spec/helpers/carto_helper_spec.rb +6 -5
  171. data/spec/helpers/geoblacklight/geoblacklight_helper_behavior_spec.rb +10 -15
  172. data/spec/helpers/geoblacklight_helper_spec.rb +139 -138
  173. data/spec/lib/geoblacklight/bounding_box_spec.rb +14 -13
  174. data/spec/lib/geoblacklight/document_presenter_spec.rb +26 -25
  175. data/spec/lib/geoblacklight/download/geojson_download_spec.rb +8 -7
  176. data/spec/lib/geoblacklight/download/geotiff_download_spec.rb +8 -7
  177. data/spec/lib/geoblacklight/download/hgl_download_spec.rb +16 -15
  178. data/spec/lib/geoblacklight/download/kmz_download_spec.rb +9 -8
  179. data/spec/lib/geoblacklight/download/shapefile_download_spec.rb +8 -7
  180. data/spec/lib/geoblacklight/download_spec.rb +61 -60
  181. data/spec/lib/geoblacklight/geometry_spec.rb +29 -28
  182. data/spec/lib/geoblacklight/item_viewer_spec.rb +25 -24
  183. data/spec/lib/geoblacklight/metadata/base_spec.rb +44 -43
  184. data/spec/lib/geoblacklight/metadata/html_spec.rb +7 -6
  185. data/spec/lib/geoblacklight/metadata_spec.rb +15 -14
  186. data/spec/lib/geoblacklight/metadata_transformer/base_spec.rb +13 -12
  187. data/spec/lib/geoblacklight/metadata_transformer/fgdc_spec.rb +8 -7
  188. data/spec/lib/geoblacklight/metadata_transformer/iso19139_spec.rb +8 -7
  189. data/spec/lib/geoblacklight/metadata_transformer_spec.rb +15 -14
  190. data/spec/lib/geoblacklight/reference_spec.rb +28 -27
  191. data/spec/lib/geoblacklight/references_spec.rb +89 -76
  192. data/spec/lib/geoblacklight/relation/ancestors_spec.rb +17 -16
  193. data/spec/lib/geoblacklight/relation/descendants_spec.rb +17 -16
  194. data/spec/lib/geoblacklight/relation/relation_response_spec.rb +29 -28
  195. data/spec/lib/geoblacklight/view_helper_override_spec.rb +14 -13
  196. data/spec/lib/geoblacklight/wms_layer/feature_info_response_spec.rb +19 -18
  197. data/spec/lib/geoblacklight/wms_layer_spec.rb +31 -30
  198. data/spec/models/concerns/geoblacklight/bbox_filter_field_spec.rb +31 -31
  199. data/spec/models/concerns/geoblacklight/bbox_filter_query_spec.rb +32 -32
  200. data/spec/models/concerns/geoblacklight/solr_document/carto_spec.rb +16 -15
  201. data/spec/models/concerns/geoblacklight/solr_document/citation_spec.rb +7 -6
  202. data/spec/models/concerns/geoblacklight/solr_document/finder_spec.rb +16 -17
  203. data/spec/models/concerns/geoblacklight/solr_document/inspection_spec.rb +7 -6
  204. data/spec/models/concerns/geoblacklight/solr_document_spec.rb +121 -107
  205. data/spec/models/concerns/geoblacklight/suppressed_records_search_behavior_spec.rb +8 -7
  206. data/spec/presenters/geoblacklight/bbox_item_presenter_spec.rb +10 -10
  207. data/spec/routing/catalog_routing_spec.rb +4 -3
  208. data/spec/spec_helper.rb +34 -33
  209. data/spec/support/backport_test_helpers.rb +6 -5
  210. data/spec/support/features/session_helpers.rb +8 -7
  211. data/spec/support/features.rb +2 -1
  212. data/spec/support/fixtures.rb +2 -1
  213. data/spec/tasks/geoblacklight_spec.rb +10 -9
  214. data/spec/test_app_templates/lib/generators/test_app_generator.rb +16 -15
  215. data/spec/views/catalog/_document_split.html.erb_spec.rb +3 -2
  216. data/spec/views/catalog/_index_split.html.erb_spec.rb +3 -2
  217. data/spec/views/catalog/_results_pagination.html.erb_spec.rb +5 -4
  218. data/spec/views/catalog/_show_downloads.html.erb_spec.rb +11 -10
  219. data/spec/views/catalog/_show_tools.html.erb_spec.rb +13 -12
  220. data/template.rb +9 -8
  221. metadata +29 -212
  222. data/.gitmodules +0 -0
  223. data/.rubocop.yml +0 -111
  224. data/.rubocop_todo.yml +0 -437
  225. 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
- require 'spec_helper'
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) { { whatever: :value } }
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 'homepage' do
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: 'home',
26
- label: 'geoblacklight.home.institution',
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 'includes facet links' do
33
- expect(rendered).to have_selector('div.category-block')
34
- expect(rendered).to have_selector('div.category-icon')
35
- expect(rendered).to have_selector('a.home-facet-link')
36
- expect(rendered).to have_selector('a.more_facets_link')
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
- require 'spec_helper'
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) { { facet_item: facet_item } }
10
- let(:facet_item) { instance_double(Blacklight::FacetItemPresenter, label: 'Stanford', value: 'stanford', hits: 5, href: nil, selected?: false, facet_config: facet_config) }
11
- let(:facet_config) { Blacklight::Configuration::FacetField.new(field: 'provider_facet', label: 'Provider') }
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 'prepends the icon to the facet item label' do
14
- expect(rendered).to have_selector('span.facet-label', text: 'Stanford')
15
- expect(rendered).to have_selector('span.facet-label svg title', text: 'Stanford University')
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
- describe 'Config' do
5
- it 'Loads new Aardvark relationships' do
6
- expect(Settings).to respond_to('RELATIONSHIPS_SHOWN')
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.MEMBER_OF).to respond_to(method)
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
- require 'spec_helper'
2
+
3
+ require "spec_helper"
3
4
 
4
5
  describe CatalogController, type: :controller do
5
- describe '#web_services' do
6
- it 'returns a document based off an id' do
7
- get :web_services, params: { id: 'mit-f6rqs4ucovjk2' }
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 '.default_solr_params' do
14
- it 'sets the number of rows returned by Solr to 10 and does not filter the results' do
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 'sets the starting document index to 0' do
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 'stanford-cg357zz0321'
26
+ expect(assigns(:response).docs.first.id).to eq "stanford-cg357zz0321"
26
27
  end
27
28
 
28
- context 'with altered default parameters' do
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 'sets the starting document index' do
36
- blacklight_config.default_solr_params = { start: 2, 'q.alt' => '*:*' }
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 'mit-001145244'
41
+ expect(assigns(:response).docs.first.id).to eq "mit-001145244"
41
42
  end
42
43
 
43
- it 'filters using a default DisMax query when no query is provided by the client' do
44
- blacklight_config.default_solr_params = { start: 10, 'q.alt' => '{!dismax}id:nyu' }
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 'with altered per page parameters' do
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 'alters the number of documents returned from Solr' do
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 '#raw' do
69
- it 'returns a JSON representation of a Solr Document' do
70
- get :raw, params: { id: 'tufts-cambridgegrid100-04' }
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 'gbl_mdVersion_s' => 'Aardvark'
75
- expect(response_values).to include Settings.FIELDS.TITLE => '100 Foot Grid Cambridge MA 2004'
76
- expect(response_values).to include Settings.FIELDS.IDENTIFIER => ['urn:geodata.tufts.edu:Tufts.CambridgeGrid100_04']
77
- expect(response_values).to include Settings.FIELDS.ACCESS_RIGHTS => 'Public'
78
- expect(response_values).to include Settings.FIELDS.PROVIDER => 'Tufts'
79
- expect(response_values).to include Settings.FIELDS.ID => 'tufts-cambridgegrid100-04'
80
- expect(response_values).to include Settings.FIELDS.GEOMETRY => 'ENVELOPE(-71.163984,-71.052581,42.408316,42.34757)'
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
- require 'spec_helper'
2
+
3
+ require "spec_helper"
3
4
 
4
5
  describe DownloadController, type: :controller do
5
- describe '#file' do
6
- describe 'restricted file' do
7
- it 'redirects to login for authentication' do
8
- get :file, params: { id: 'stanford-cg357zz0321-shapefile', format: 'zip' }
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 'public file' do
13
- it 'initiates download' do
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: { id: 'mit-f6rqs4ucovjk2-shapefile', format: 'zip' }
17
+ get :file, params: {id: "mit-f6rqs4ucovjk2-shapefile", format: "zip"}
17
18
  end
18
19
  end
19
20
  end
20
- describe '#show' do
21
- describe 'restricted file' do
22
- it 'redirects to login for authentication' do
23
- get :show, params: { id: 'stanford-cg357zz0321', format: 'json' }
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 'public file' do
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 'initiates download creation' do
35
- allow(shapefile_download).to receive(:get).and_return('success')
36
- get :show, params: { id: 'mit-f6rqs4ucovjk2', type: 'shapefile' }
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 'when requesting GeoJSON files' do
42
- let(:id) { 'tufts-cambridgegrid100-04' }
43
- let(:type) { 'geojson' }
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('file.json')
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 'downloads the files and notifies the user' do
52
+ it "downloads the files and notifies the user" do
52
53
  expect(Geoblacklight::GeojsonDownload).to receive(:new)
53
- get :show, params: { id: id, type: type }
54
+ get :show, params: {id: id, type: type}
54
55
 
55
- expect(response.body).to include 'success'
56
- expect(response.body).to include 'Your file file.json is ready for download'
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 'when requesting GeoTIFF files' do
61
- let(:id) { 'tufts-cambridgegrid100-04' }
62
- let(:type) { 'geotiff' }
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('file.tiff')
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 'downloads the files and notifies the user' do
71
+ it "downloads the files and notifies the user" do
71
72
  expect(Geoblacklight::GeotiffDownload).to receive(:new)
72
- get :show, params: { id: id, type: type }
73
+ get :show, params: {id: id, type: type}
73
74
 
74
- expect(response.body).to include 'success'
75
- expect(response.body).to include 'Your file file.tiff is ready for download'
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 '#hgl' do
81
+ describe "#hgl" do
81
82
  let(:hgl_download) { instance_double(Geoblacklight::HglDownload) }
82
83
 
83
- it 'requests file' do
84
- allow(hgl_download).to receive(:get).and_return('success')
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: { id: 'harvard-g7064-s2-1834-k3', email: 'foo@example.com' }
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 'renders form' do
92
+ it "renders form" do
92
93
  allow(Geoblacklight::HglDownload).to receive(:new).and_return(hgl_download)
93
94
 
94
- get :hgl, params: { id: 'harvard-g7064-s2-1834-k3' }
95
- expect(response).to render_template('hgl')
95
+ get :hgl, params: {id: "harvard-g7064-s2-1834-k3"}
96
+ expect(response).to render_template("hgl")
96
97
  end
97
98
 
98
- context 'when an error occurs while downloading a file' do
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 'uses the default error message when the exception does not have a URL' do
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: { id: 'harvard-g7064-s2-1834-k3', email: 'foo@example.com' }
105
- expect(response.body).to include('danger')
106
- expect(response.body).to include('Sorry, the requested file could not be downloaded')
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 'when downloading the requested file fails' do
111
- it 'flashes the error message' do
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: { id: 'harvard-g7064-s2-1834-k3', email: 'foo@example.com' }
116
- expect(response.body).to include('danger')
117
- expect(response.body).to include('Sorry, the requested file could not be downloaded')
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
- require 'spec_helper'
2
+
3
+ require "spec_helper"
3
4
 
4
5
  describe RelationController, type: :controller do
5
- describe '#index' do
6
- it 'returns a listing of related documents for a record' do
7
- get :index, params: { id: 'nyu_2451_34502' }
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
- require 'spec_helper'
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) { { values: ['fid', 'layer:example'] } }
7
+ let(:feature_info) { {values: ["fid", "layer:example"]} }
7
8
  let(:params) do
8
- { 'format' => 'json', 'URL' => 'http://www.example.com/', 'LAYERS' => 'layer:example',
9
- 'BBOX' => '-74, 40, -68, 43', 'WIDTH' => '500', 'HEIGHT' => '400',
10
- 'QUERY_LAYERS' => 'layer:example', 'X' => '277', 'Y' => '195' }
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 '#handle' do
19
- it 'returns feature info as json' do
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 '#wms_params' do
26
+ describe "#wms_params" do
26
27
  let(:wms_params) { controller.instance_eval { wms_params } }
27
28
 
28
- it 'returns only permitted params' do
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
@@ -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 { 'password' }
6
- password_confirmation { 'password' }
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
- feature 'Blacklight Bookmarks' do
5
- scenario 'index has created bookmarks' do
6
- visit solr_document_path 'nyu-2451-34564'
7
- click_button 'Bookmark'
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 '.document', count: 1
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
- feature 'Configurable basemap', js: true do
5
- scenario 'defaults to positron' do
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 'without provided basemap config' do
10
+ feature "without provided basemap config" do
10
11
  before do
11
12
  CatalogController.blacklight_config.basemap_provider = nil
12
13
  end
13
- scenario 'has Carto map' do
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 'using darkMatter' do
19
+ feature "using darkMatter" do
19
20
  before do
20
- CatalogController.blacklight_config.basemap_provider = 'darkMatter'
21
+ CatalogController.blacklight_config.basemap_provider = "darkMatter"
21
22
  end
22
- scenario 'has darkMatter map' do
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 'using openstreetmapHot' do
28
+ feature "using openstreetmapHot" do
28
29
  before do
29
- CatalogController.blacklight_config.basemap_provider = 'openstreetmapHot'
30
+ CatalogController.blacklight_config.basemap_provider = "openstreetmapHot"
30
31
  end
31
- scenario 'has openstreetmapHot map' do
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
- feature 'Data dictionary download tool' do
5
- feature 'when data_dictionary reference present' do
6
- scenario 'shows up in tools' do
7
- visit solr_document_path 'nyu_2451_34502'
8
- expect(page).to have_css 'li.data_dictionary a', text: 'Documentation'
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 'when data_dictionary reference absent' do
12
- scenario 'download tool is not rendered' do
13
- visit solr_document_path 'stanford-cg357zz0321'
14
- expect(page).not_to have_css 'li.data_dictionary a', text: 'Documentation'
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