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
@@ -1,62 +1,63 @@
1
1
  # frozen_string_literal: true
2
- require 'spec_helper'
2
+
3
+ require "spec_helper"
3
4
 
4
5
  describe Geoblacklight::WmsLayer do
5
6
  let(:wms_layer) { described_class.new(params) }
6
- let(:rails_4_params) { { 'URL' => 'http://www.example.com/', 'X' => '277' } }
7
+ let(:rails_4_params) { {"URL" => "http://www.example.com/", "X" => "277"} }
7
8
  let(:rails_5_params) { instance_double(ActionController::Parameters) }
8
9
 
9
10
  before do
10
- allow(rails_5_params).to receive(:to_h).and_return('URL' => 'http://www.example.com/', 'X' => '277')
11
+ allow(rails_5_params).to receive(:to_h).and_return("URL" => "http://www.example.com/", "X" => "277")
11
12
  end
12
13
 
13
- describe '#initialize' do
14
+ describe "#initialize" do
14
15
  let(:params) { rails_4_params }
15
16
 
16
- it 'initializes as a WmsLayer object' do
17
+ it "initializes as a WmsLayer object" do
17
18
  expect(wms_layer).to be_an described_class
18
19
  end
19
20
  end
20
21
 
21
- describe '#url' do
22
- context 'when running on rails 4' do
22
+ describe "#url" do
23
+ context "when running on rails 4" do
23
24
  let(:params) { rails_4_params }
24
25
 
25
- it 'returns the correct URL parameter' do
26
- expect(wms_layer.url).to eq('http://www.example.com/')
26
+ it "returns the correct URL parameter" do
27
+ expect(wms_layer.url).to eq("http://www.example.com/")
27
28
  end
28
29
  end
29
30
 
30
- context 'when running on rails 5' do
31
+ context "when running on rails 5" do
31
32
  let(:params) { rails_5_params }
32
33
 
33
- it 'returns the correct URL parameter' do
34
- expect(wms_layer.url).to eq('http://www.example.com/')
34
+ it "returns the correct URL parameter" do
35
+ expect(wms_layer.url).to eq("http://www.example.com/")
35
36
  end
36
37
  end
37
38
  end
38
39
 
39
- describe '#search_params' do
40
- context 'when running on rails 4' do
40
+ describe "#search_params" do
41
+ context "when running on rails 4" do
41
42
  let(:params) { rails_4_params }
42
43
 
43
- it 'returns all params except URL plus default params' do
44
+ it "returns all params except URL plus default params" do
44
45
  expect(wms_layer.search_params.length).to eq 8
45
- expect(wms_layer.search_params).not_to include 'URL' => 'http://www.example.com/'
46
+ expect(wms_layer.search_params).not_to include "URL" => "http://www.example.com/"
46
47
  end
47
48
  end
48
49
 
49
- context 'when running on rails 5' do
50
+ context "when running on rails 5" do
50
51
  let(:params) { rails_5_params }
51
52
 
52
- it 'returns all params except URL plus default params' do
53
+ it "returns all params except URL plus default params" do
53
54
  expect(wms_layer.search_params.length).to eq 8
54
- expect(wms_layer.search_params).not_to include 'URL' => 'http://www.example.com/'
55
+ expect(wms_layer.search_params).not_to include "URL" => "http://www.example.com/"
55
56
  end
56
57
  end
57
58
  end
58
59
 
59
- describe '#request_response' do
60
+ describe "#request_response" do
60
61
  subject(:wms_layer) { described_class.new(params) }
61
62
  let(:params) { rails_4_params }
62
63
  let(:connection) { instance_double(Faraday::Connection) }
@@ -66,34 +67,34 @@ describe Geoblacklight::WmsLayer do
66
67
  allow(Faraday).to receive(:new).and_return(connection)
67
68
  end
68
69
 
69
- it 'returns a Faraday object' do
70
+ it "returns a Faraday object" do
70
71
  allow(connection).to receive(:get).and_return(response)
71
72
  expect(wms_layer.request_response).to eq(response)
72
73
  end
73
74
 
74
- context 'when the HTTP connection fails' do
75
+ context "when the HTTP connection fails" do
75
76
  before do
76
- allow(Geoblacklight.logger).to receive(:error).with('#<Faraday::ConnectionFailed wrapped=#<StandardError: test connection error>>')
77
- allow(connection).to receive(:get).and_raise(Faraday::ConnectionFailed.new(StandardError.new('test connection error')))
77
+ allow(Geoblacklight.logger).to receive(:error).with("#<Faraday::ConnectionFailed wrapped=#<StandardError: test connection error>>")
78
+ allow(connection).to receive(:get).and_raise(Faraday::ConnectionFailed.new(StandardError.new("test connection error")))
78
79
  end
79
80
 
80
- it 'logs the Faraday error' do
81
+ it "logs the Faraday error" do
81
82
  expect(Geoblacklight.logger).to receive(:error).exactly(3).times
82
83
  expect(wms_layer.request_response).to be_a Hash
83
- expect(wms_layer.request_response).to include(error: '#<Faraday::ConnectionFailed wrapped=#<StandardError: test connection error>>')
84
+ expect(wms_layer.request_response).to include(error: "#<Faraday::ConnectionFailed wrapped=#<StandardError: test connection error>>")
84
85
  end
85
86
  end
86
87
 
87
- context 'when the HTTP connection times out' do
88
+ context "when the HTTP connection times out" do
88
89
  before do
89
- allow(Geoblacklight.logger).to receive(:error).with('#<Faraday::TimeoutError #<Faraday::TimeoutError: timeout>>')
90
+ allow(Geoblacklight.logger).to receive(:error).with("#<Faraday::TimeoutError #<Faraday::TimeoutError: timeout>>")
90
91
  allow(connection).to receive(:get).and_raise(Faraday::TimeoutError)
91
92
  end
92
93
 
93
- it 'logs the Faraday error' do
94
+ it "logs the Faraday error" do
94
95
  expect(Geoblacklight.logger).to receive(:error).exactly(3).times
95
96
  expect(wms_layer.request_response).to be_a Hash
96
- expect(wms_layer.request_response).to include(error: '#<Faraday::TimeoutError #<Faraday::TimeoutError: timeout>>')
97
+ expect(wms_layer.request_response).to include(error: "#<Faraday::TimeoutError #<Faraday::TimeoutError: timeout>>")
97
98
  end
98
99
  end
99
100
  end
@@ -1,32 +1,32 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'spec_helper'
3
+ require "spec_helper"
4
4
 
5
5
  RSpec.describe Geoblacklight::BboxFilterField do
6
- subject(:filter) { search_state.filter('bbox') }
6
+ subject(:filter) { search_state.filter("bbox") }
7
7
 
8
- let(:bbox_value) { '140.143709 -65.487905 160.793791 86.107541' }
8
+ let(:bbox_value) { "140.143709 -65.487905 160.793791 86.107541" }
9
9
  let(:search_state) { Blacklight::SearchState.new(params.with_indifferent_access, blacklight_config, controller) }
10
10
  let(:params) { {} }
11
11
  let(:blacklight_config) do
12
12
  Blacklight::Configuration.new.configure do |config|
13
- config.add_facet_field 'bbox', filter_class: described_class
13
+ config.add_facet_field "bbox", filter_class: described_class
14
14
  end
15
15
  end
16
- let(:facet_config) { blacklight_config.facet_fields['bbox'] }
16
+ let(:facet_config) { blacklight_config.facet_fields["bbox"] }
17
17
  let(:controller) { double }
18
18
 
19
- describe '#add' do
20
- context 'with a ordinary parameter' do
21
- it 'adds the parameter to the facets' do
19
+ describe "#add" do
20
+ context "with a ordinary parameter" do
21
+ it "adds the parameter to the facets" do
22
22
  new_state = filter.add(bbox_value)
23
23
 
24
24
  expect(new_state.params).to include bbox: bbox_value
25
25
  end
26
26
  end
27
27
 
28
- context 'with a bounding box' do
29
- it 'adds the parameter to the bbox parameter' do
28
+ context "with a bounding box" do
29
+ it "adds the parameter to the bbox parameter" do
30
30
  new_state = filter.add(Geoblacklight::BoundingBox.from_rectangle(bbox_value))
31
31
 
32
32
  expect(new_state.params).to include bbox: bbox_value
@@ -34,61 +34,61 @@ RSpec.describe Geoblacklight::BboxFilterField do
34
34
  end
35
35
  end
36
36
 
37
- context 'with some existing data' do
38
- let(:params) { { bbox: bbox_value } }
37
+ context "with some existing data" do
38
+ let(:params) { {bbox: bbox_value} }
39
39
 
40
- describe '#add' do
41
- let(:bbox_replacement) { '100.143709 -70.487905 100.793791 96.107541' }
42
- it 'replaces the existing range' do
40
+ describe "#add" do
41
+ let(:bbox_replacement) { "100.143709 -70.487905 100.793791 96.107541" }
42
+ it "replaces the existing range" do
43
43
  new_state = filter.add(Geoblacklight::BoundingBox.from_rectangle(bbox_replacement))
44
44
 
45
45
  expect(new_state.params).to include bbox: bbox_replacement
46
46
  end
47
47
  end
48
48
 
49
- describe '#remove' do
50
- it 'removes the existing bbox' do
49
+ describe "#remove" do
50
+ it "removes the existing bbox" do
51
51
  new_state = filter.remove(Geoblacklight::BoundingBox.from_rectangle(bbox_value))
52
52
 
53
53
  expect(new_state.params[:bbox]).to be_nil
54
54
  end
55
55
  end
56
56
 
57
- describe '#values' do
58
- it 'converts the parameters to a Geoblacklight::BoundingBox' do
57
+ describe "#values" do
58
+ it "converts the parameters to a Geoblacklight::BoundingBox" do
59
59
  expect(filter.values.first).to be_a(Geoblacklight::BoundingBox).and(have_attributes(to_param: bbox_value))
60
60
  end
61
61
  end
62
62
 
63
- describe '#needs_normalization?' do
64
- it 'returns false for the expected keyed representation of the bounding box' do
63
+ describe "#needs_normalization?" do
64
+ it "returns false for the expected keyed representation of the bounding box" do
65
65
  expect(filter.needs_normalization?(search_state.params)).to be false
66
66
  end
67
67
  end
68
68
 
69
- context 'when array param represented by facebook as a Hash' do
69
+ context "when array param represented by facebook as a Hash" do
70
70
  let(:filter) { described_class.new(facet_config, search_state) }
71
- let(:params) { { bbox: { '0' => bbox_value } } }
71
+ let(:params) { {bbox: {"0" => bbox_value}} }
72
72
 
73
- describe '#normalize' do
74
- it 'converts the parameters to a list' do
73
+ describe "#normalize" do
74
+ it "converts the parameters to a list" do
75
75
  expect(filter.normalize(search_state.params[:bbox])).to eql [bbox_value]
76
76
  end
77
77
  end
78
78
 
79
- describe '#needs_normalization?' do
80
- it 'returns true for the hash-as-array keyed representation of the bounding box' do
79
+ describe "#needs_normalization?" do
80
+ it "returns true for the hash-as-array keyed representation of the bounding box" do
81
81
  expect(filter.needs_normalization?(search_state.params[:bbox])).to be true
82
82
  end
83
83
  end
84
84
  end
85
85
  end
86
86
 
87
- context 'with a malformed bbox' do
88
- let(:params) { { bbox: 'totally-not-a-bbox' } }
87
+ context "with a malformed bbox" do
88
+ let(:params) { {bbox: "totally-not-a-bbox"} }
89
89
 
90
- it 'excludes it from the values' do
91
- filter = search_state.filter('bbox')
90
+ it "excludes it from the values" do
91
+ filter = search_state.filter("bbox")
92
92
 
93
93
  expect(filter.values).to be_empty
94
94
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'spec_helper'
3
+ require "spec_helper"
4
4
 
5
5
  RSpec.describe Geoblacklight::BboxFilterQuery do
6
6
  # Subject
@@ -12,94 +12,94 @@ RSpec.describe Geoblacklight::BboxFilterQuery do
12
12
  let(:search_state) { Blacklight::SearchState.new(params.with_indifferent_access, blacklight_config) }
13
13
 
14
14
  let(:params) do
15
- { bbox: '-180 -80 120 80' }
15
+ {bbox: "-180 -80 120 80"}
16
16
  end
17
17
 
18
18
  let(:blacklight_config) do
19
19
  Blacklight::Configuration.new.configure do |config|
20
- config.add_facet_field 'bbox', filter_class: Geoblacklight::BboxFilterField
20
+ config.add_facet_field "bbox", filter_class: Geoblacklight::BboxFilterField
21
21
  end
22
22
  end
23
- let(:facet_config) { blacklight_config.facet_fields['bbox'] }
23
+ let(:facet_config) { blacklight_config.facet_fields["bbox"] }
24
24
 
25
25
  # Filter
26
26
  let(:filter) { Geoblacklight::BboxFilterField.new(facet_config, search_state) }
27
27
 
28
- describe '#initialize' do
29
- it 'initializes as a BboxFilterQuery object' do
28
+ describe "#initialize" do
29
+ it "initializes as a BboxFilterQuery object" do
30
30
  expect(bbox_filter_query).to be_a described_class
31
31
  end
32
32
  end
33
33
 
34
- describe '#envelope_bounds' do
35
- it 'returns an BoundingBox envelope' do
36
- expect(bbox_filter_query.envelope_bounds).to eq('ENVELOPE(-180, 120, 80, -80)')
34
+ describe "#envelope_bounds" do
35
+ it "returns an BoundingBox envelope" do
36
+ expect(bbox_filter_query.envelope_bounds).to eq("ENVELOPE(-180, 120, 80, -80)")
37
37
  end
38
38
  end
39
39
 
40
- describe '#boost' do
41
- context 'without an explicit boost' do
40
+ describe "#boost" do
41
+ context "without an explicit boost" do
42
42
  before do
43
43
  facet_config.within_boost = nil
44
44
  end
45
45
 
46
- it 'returns an default boost value' do
47
- expect(bbox_filter_query.boost).to eq('^10')
46
+ it "returns an default boost value" do
47
+ expect(bbox_filter_query.boost).to eq("^10")
48
48
  end
49
49
  end
50
50
 
51
- context 'with an explicit boost' do
51
+ context "with an explicit boost" do
52
52
  before do
53
53
  facet_config.within_boost = 99
54
54
  end
55
55
 
56
- it 'applies boost based on configured Settings.BBOX_WITHIN_BOOST' do
57
- expect(bbox_filter_query.boost).to eq('^99')
56
+ it "applies boost based on configured Settings.BBOX_WITHIN_BOOST" do
57
+ expect(bbox_filter_query.boost).to eq("^99")
58
58
  end
59
59
  end
60
60
  end
61
61
 
62
- describe '#relevancy_boost' do
63
- it 'returns a relevancy_boost' do
64
- expect(bbox_filter_query.relevancy_boost[:bq].to_s).to include('IsWithin')
62
+ describe "#relevancy_boost" do
63
+ it "returns a relevancy_boost" do
64
+ expect(bbox_filter_query.relevancy_boost[:bq].to_s).to include("IsWithin")
65
65
  end
66
66
 
67
- context 'with overlap boost' do
67
+ context "with overlap boost" do
68
68
  before do
69
69
  facet_config.overlap_boost = 2
70
70
  end
71
71
 
72
- it 'applies overlapRatio when Settings.OVERLAP_RATIO_BOOST is configured' do
73
- expect(bbox_filter_query.relevancy_boost[:bf].to_s).to include('$overlap^2')
72
+ it "applies overlapRatio when Settings.OVERLAP_RATIO_BOOST is configured" do
73
+ expect(bbox_filter_query.relevancy_boost[:bf].to_s).to include("$overlap^2")
74
74
  end
75
75
  end
76
76
 
77
- context 'without an overlap boost' do
77
+ context "without an overlap boost" do
78
78
  before do
79
79
  facet_config.overlap_boost = nil
80
80
  end
81
81
 
82
- it 'does not apply overlapRatio when Settings.OVERLAP_RATIO_BOOST not configured' do
82
+ it "does not apply overlapRatio when Settings.OVERLAP_RATIO_BOOST not configured" do
83
83
  expect(bbox_filter_query.relevancy_boost).not_to have_key(:overlap)
84
84
  end
85
85
  end
86
86
 
87
- context 'when local boost parameter is present' do
87
+ context "when local boost parameter is present" do
88
88
  before do
89
- solr_params[:bf] = ['local_boost^5']
89
+ solr_params[:bf] = ["local_boost^5"]
90
90
  facet_config.overlap_boost = 2
91
91
  end
92
92
 
93
- it 'appends overlap and includes the local boost' do
94
- expect(bbox_filter_query.relevancy_boost[:bf].to_s).to include('$overlap^2')
95
- expect(bbox_filter_query.relevancy_boost[:bf].to_s).to include('local_boost^5')
93
+ it "appends overlap and includes the local boost" do
94
+ expect(bbox_filter_query.relevancy_boost[:bf].to_s).to include("$overlap^2")
95
+ expect(bbox_filter_query.relevancy_boost[:bf].to_s).to include("local_boost^5")
96
96
  end
97
97
  end
98
98
  end
99
99
 
100
- describe '#intersects_filter' do
101
- it 'returns an Intersects query' do
102
- expect(bbox_filter_query.intersects_filter).to include('Intersects')
100
+ describe "#intersects_filter" do
101
+ it "returns an Intersects query" do
102
+ expect(bbox_filter_query.intersects_filter).to include("Intersects")
103
103
  end
104
104
  end
105
105
  end
@@ -1,42 +1,43 @@
1
1
  # frozen_string_literal: true
2
- require 'spec_helper'
2
+
3
+ require "spec_helper"
4
+
5
+ class MyDocument
6
+ extend Blacklight::Solr::Document
7
+ include Geoblacklight::SolrDocument::Carto
8
+ end
3
9
 
4
10
  describe Geoblacklight::SolrDocument::Carto do
5
11
  let(:document) { MyDocument.new }
6
12
  let(:geojson_download) { instance_double(Geoblacklight::GeojsonDownload) }
7
13
 
8
14
  before do
9
- class MyDocument
10
- extend Blacklight::Solr::Document
11
- include Geoblacklight::SolrDocument::Carto
12
- end
13
-
14
15
  allow(Geoblacklight::GeojsonDownload).to receive(:new).and_return(geojson_download)
15
16
  end
16
17
 
17
- describe '#carto_reference' do
18
- it 'returns nil for restricted documents' do
18
+ describe "#carto_reference" do
19
+ it "returns nil for restricted documents" do
19
20
  expect(document).to receive(:public?).and_return(false)
20
21
  expect(document.carto_reference).to be_nil
21
22
  end
22
- it 'returns nil for no download_types' do
23
+ it "returns nil for no download_types" do
23
24
  expect(document).to receive(:public?).and_return(true)
24
25
  expect(document).to receive(:download_types).and_return(nil)
25
26
  expect(document.carto_reference).to be_nil
26
27
  end
27
- it 'returns nil with no :geojson download type' do
28
+ it "returns nil with no :geojson download type" do
28
29
  expect(document).to receive(:public?).and_return(true)
29
- expect(document).to receive(:download_types).and_return(geotiff: 'geotiff')
30
+ expect(document).to receive(:download_types).and_return(geotiff: "geotiff")
30
31
  expect(document.carto_reference).to be_nil
31
32
  end
32
- it 'Creates and returns a GeojsonDownload url' do
33
+ it "Creates and returns a GeojsonDownload url" do
33
34
  expect(document).to receive(:public?).and_return(true)
34
35
  expect(document).to receive(:download_types)
35
- .and_return(geojson: { 'stuff' => 'stuff' })
36
+ .and_return(geojson: {"stuff" => "stuff"})
36
37
  expect(geojson_download)
37
38
  .to receive(:url_with_params)
38
- .and_return('http://www.example.com/geojsonDownload')
39
- expect(document.carto_reference).to eq 'http://www.example.com/geojsonDownload'
39
+ .and_return("http://www.example.com/geojsonDownload")
40
+ expect(document.carto_reference).to eq "http://www.example.com/geojsonDownload"
40
41
  end
41
42
  end
42
43
  end
@@ -1,14 +1,15 @@
1
1
  # frozen_string_literal: true
2
- require 'spec_helper'
2
+
3
+ require "spec_helper"
3
4
 
4
5
  describe Geoblacklight::SolrDocument::Citation do
5
- describe '#geoblacklight_citation' do
6
- let(:fixture) { JSON.parse(read_fixture('solr_documents/restricted-line.json')) }
6
+ describe "#geoblacklight_citation" do
7
+ let(:fixture) { JSON.parse(read_fixture("solr_documents/restricted-line.json")) }
7
8
  let(:document) { SolrDocument.new(fixture) }
8
9
 
9
- it 'creates a citation' do
10
- expect(document.geoblacklight_citation('http://example.com'))
11
- .to eq 'United States. National Oceanic and Atmospheric Administration. Circuit Rider Productions. (2002). 10 Meter Contours: Russian River Basin, California. [Shapefile]. Circuit Rider Productions. Retrieved from http://example.com'
10
+ it "creates a citation" do
11
+ expect(document.geoblacklight_citation("http://example.com"))
12
+ .to eq "United States. National Oceanic and Atmospheric Administration. Circuit Rider Productions. (2002). 10 Meter Contours: Russian River Basin, California. [Shapefile]. Circuit Rider Productions. Retrieved from http://example.com"
12
13
  end
13
14
  end
14
15
  end
@@ -1,40 +1,39 @@
1
1
  # frozen_string_literal: true
2
- require 'spec_helper'
2
+
3
+ require "spec_helper"
4
+
5
+ class MyDocument
6
+ extend Blacklight::Solr::Document
7
+ include Geoblacklight::SolrDocument::Finder
8
+ end
3
9
 
4
10
  describe Geoblacklight::SolrDocument::Finder do
5
11
  let(:document_klass) { MyDocument }
6
12
 
7
- before do
8
- class MyDocument
9
- extend Blacklight::Solr::Document
10
- include Geoblacklight::SolrDocument::Finder
11
- end
12
- end
13
-
14
- describe '#find' do
15
- let(:documents) { ['first', 'second'] }
13
+ describe "#find" do
14
+ let(:documents) { ["first", "second"] }
16
15
  let(:response) { instance_double(Blacklight::Solr::Response) }
17
16
 
18
17
  before do
19
18
  allow(response).to receive(:documents).and_return(documents)
20
- allow_any_instance_of(Blacklight::Solr::Repository).to receive(:find).with('search param').and_return(response)
19
+ allow_any_instance_of(Blacklight::Solr::Repository).to receive(:find).with("search param").and_return(response)
21
20
  end
22
21
 
23
- it 'calls index and returns first document' do
24
- expect(document_klass.find('search param')).to eq 'first'
22
+ it "calls index and returns first document" do
23
+ expect(document_klass.find("search param")).to eq "first"
25
24
  end
26
25
  end
27
26
 
28
- describe '#index' do
29
- it 'creates and returns a Blacklight::Solr::Repository' do
27
+ describe "#index" do
28
+ it "creates and returns a Blacklight::Solr::Repository" do
30
29
  expect(document_klass.index).to be_a Blacklight::Solr::Repository
31
30
  end
32
31
  end
33
32
 
34
- describe '.blacklight_solr' do
33
+ describe ".blacklight_solr" do
35
34
  let(:document) { document_klass.new }
36
35
 
37
- it 'accesses the connection to the Solr index' do
36
+ it "accesses the connection to the Solr index" do
38
37
  expect(document.blacklight_solr).to be_a RSolr::Client
39
38
  end
40
39
  end
@@ -1,17 +1,18 @@
1
1
  # frozen_string_literal: true
2
- require 'spec_helper'
2
+
3
+ require "spec_helper"
3
4
 
4
5
  describe Geoblacklight::SolrDocument::Inspection do
5
6
  subject { SolrDocument.new }
6
7
 
7
- describe '#inspectable?' do
8
- it 'returns true for wms viewer protocol' do
9
- expect(subject).to receive(:viewer_protocol).and_return('wms')
8
+ describe "#inspectable?" do
9
+ it "returns true for wms viewer protocol" do
10
+ expect(subject).to receive(:viewer_protocol).and_return("wms")
10
11
  expect(subject.inspectable?).to be_truthy
11
12
  end
12
13
 
13
- it 'returns false for iiif viewer protocol' do
14
- expect(subject).to receive(:viewer_protocol).and_return('iiif')
14
+ it "returns false for iiif viewer protocol" do
15
+ expect(subject).to receive(:viewer_protocol).and_return("iiif")
15
16
  expect(subject.inspectable?).to be_falsy
16
17
  end
17
18
  end