geoblacklight 4.0.0.pre.rc3 → 4.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (229) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +22 -16
  3. data/.standard.yml +1 -0
  4. data/CODE_OF_CONDUCT.md +1 -1
  5. data/Gemfile +13 -11
  6. data/README.md +22 -14
  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/geoblacklight-icons.json +98 -66
  13. data/app/assets/images/blacklight/george-mason.svg +4 -0
  14. data/app/assets/images/blacklight/lightbulb-solid.svg +1 -0
  15. data/app/assets/images/blacklight/nebraska.svg +4 -0
  16. data/app/assets/images/blacklight/rutgers.svg +5 -0
  17. data/app/assets/images/blacklight/triangle-exclamation-solid.svg +1 -0
  18. data/app/assets/stylesheets/geoblacklight/modules/sidebar.scss +8 -0
  19. data/app/components/geoblacklight/display_note_component.html.erb +1 -0
  20. data/app/components/geoblacklight/display_note_component.rb +47 -0
  21. data/app/components/geoblacklight/icon_facet_item_component.rb +2 -2
  22. data/app/controllers/download_controller.rb +36 -37
  23. data/app/controllers/relation_controller.rb +1 -0
  24. data/app/controllers/wms_controller.rb +1 -0
  25. data/app/helpers/arcgis_helper.rb +2 -1
  26. data/app/helpers/blacklight_helper.rb +2 -1
  27. data/app/helpers/carto_helper.rb +3 -2
  28. data/app/helpers/geoblacklight/geoblacklight_helper_behavior.rb +2 -1
  29. data/app/helpers/geoblacklight_helper.rb +44 -36
  30. data/app/models/concerns/geoblacklight/bbox_filter_query.rb +1 -1
  31. data/app/models/concerns/geoblacklight/solr_document/arcgis.rb +1 -0
  32. data/app/models/concerns/geoblacklight/solr_document/carto.rb +1 -0
  33. data/app/models/concerns/geoblacklight/solr_document/citation.rb +3 -2
  34. data/app/models/concerns/geoblacklight/solr_document/finder.rb +1 -0
  35. data/app/models/concerns/geoblacklight/solr_document/inspection.rb +1 -0
  36. data/app/models/concerns/geoblacklight/solr_document.rb +17 -9
  37. data/app/models/concerns/geoblacklight/suppressed_records_search_behavior.rb +2 -1
  38. data/app/presenters/geoblacklight/document_presenter.rb +3 -2
  39. data/app/views/catalog/_show_default_display_note.html.erb +7 -0
  40. data/app/views/catalog/_show_sidebar.html.erb +1 -0
  41. data/app/views/catalog/_show_sidebar_static_map.html.erb +10 -0
  42. data/app/views/relation/index.json.jbuilder +1 -1
  43. data/config/initializers/new_gbl_settings_defaults_4.1.yml +104 -0
  44. data/config/initializers/rails_config.rb +5 -1
  45. data/config/locales/geoblacklight.en.yml +19 -10
  46. data/geoblacklight.gemspec +36 -40
  47. data/lib/generators/geoblacklight/assets_generator.rb +15 -15
  48. data/lib/generators/geoblacklight/install_generator.rb +24 -23
  49. data/lib/generators/geoblacklight/templates/catalog_controller.rb +66 -71
  50. data/lib/generators/geoblacklight/templates/settings.yml +74 -22
  51. data/lib/geoblacklight/bounding_box.rb +1 -0
  52. data/lib/geoblacklight/constants.rb +26 -25
  53. data/lib/geoblacklight/download/geojson_download.rb +10 -9
  54. data/lib/geoblacklight/download/geotiff_download.rb +6 -5
  55. data/lib/geoblacklight/download/hgl_download.rb +4 -3
  56. data/lib/geoblacklight/download/kmz_download.rb +11 -10
  57. data/lib/geoblacklight/download/shapefile_download.rb +10 -9
  58. data/lib/geoblacklight/download.rb +12 -11
  59. data/lib/geoblacklight/engine.rb +10 -9
  60. data/lib/geoblacklight/exceptions.rb +3 -0
  61. data/lib/geoblacklight/faraday_middleware/follow_redirects.rb +12 -11
  62. data/lib/geoblacklight/geometry.rb +6 -5
  63. data/lib/geoblacklight/item_viewer.rb +4 -3
  64. data/lib/geoblacklight/metadata/base.rb +4 -3
  65. data/lib/geoblacklight/metadata/fgdc.rb +1 -0
  66. data/lib/geoblacklight/metadata/html.rb +5 -4
  67. data/lib/geoblacklight/metadata/iso19139.rb +1 -0
  68. data/lib/geoblacklight/metadata.rb +1 -0
  69. data/lib/geoblacklight/metadata_transformer/base.rb +5 -4
  70. data/lib/geoblacklight/metadata_transformer/fgdc.rb +1 -0
  71. data/lib/geoblacklight/metadata_transformer/iso19139.rb +1 -0
  72. data/lib/geoblacklight/metadata_transformer.rb +6 -2
  73. data/lib/geoblacklight/reference.rb +3 -2
  74. data/lib/geoblacklight/references.rb +11 -6
  75. data/lib/geoblacklight/relation/ancestors.rb +4 -3
  76. data/lib/geoblacklight/relation/descendants.rb +4 -3
  77. data/lib/geoblacklight/relation/relation_response.rb +3 -2
  78. data/lib/geoblacklight/routes/downloadable.rb +3 -2
  79. data/lib/geoblacklight/routes/exportable.rb +4 -3
  80. data/lib/geoblacklight/routes/wms.rb +2 -1
  81. data/lib/geoblacklight/routes.rb +4 -3
  82. data/lib/geoblacklight/version.rb +2 -1
  83. data/lib/geoblacklight/view_helper_override.rb +3 -2
  84. data/lib/geoblacklight/wms_layer/feature_info_response.rb +5 -4
  85. data/lib/geoblacklight/wms_layer.rb +4 -3
  86. data/lib/geoblacklight.rb +32 -31
  87. data/lib/tasks/geoblacklight.rake +57 -39
  88. data/schema/geoblacklight-schema-1.0.json +3 -3
  89. data/schema/geoblacklight-schema-aardvark.json +6 -0
  90. data/schema/readme.md +8 -0
  91. data/spec/components/geoblacklight/display_note_component_spec.rb +27 -0
  92. data/spec/components/geoblacklight/homepage_feature_facet_component_spec.rb +11 -10
  93. data/spec/components/geoblacklight/icon_facet_item_component_spec.rb +8 -7
  94. data/spec/config/initializers/rails_config_spec.rb +10 -9
  95. data/spec/controllers/catalog_controller_spec.rb +27 -26
  96. data/spec/controllers/download_controller_spec.rb +50 -49
  97. data/spec/controllers/relation_controller_spec.rb +5 -4
  98. data/spec/controllers/wms_controller_spec.rb +10 -9
  99. data/spec/factories/user.rb +3 -2
  100. data/spec/features/bookmarks_spec.rb +7 -6
  101. data/spec/features/configurable_basemap_spec.rb +12 -11
  102. data/spec/features/data_dictionary_download_spec.rb +11 -10
  103. data/spec/features/download_layer_spec.rb +64 -63
  104. data/spec/features/empty_search_spec.rb +6 -5
  105. data/spec/features/esri_viewer_spec.rb +33 -32
  106. data/spec/features/exports_spec.rb +18 -17
  107. data/spec/features/full_screen_controll_spec.rb +8 -8
  108. data/spec/features/help_text_spec.rb +6 -5
  109. data/spec/features/home_page_spec.rb +30 -29
  110. data/spec/features/iiif_viewer_spec.rb +6 -5
  111. data/spec/features/index_map_spec.rb +17 -16
  112. data/spec/features/layer_inspection_spec.rb +8 -7
  113. data/spec/features/layer_opacity_spec.rb +15 -14
  114. data/spec/features/layer_preview_spec.rb +11 -10
  115. data/spec/features/layer_with_no_references_spec.rb +5 -4
  116. data/spec/features/linkified_attribute_table_spec.rb +8 -7
  117. data/spec/features/metadata_panel_spec.rb +32 -31
  118. data/spec/features/missing_metadata_spec.rb +18 -17
  119. data/spec/features/multiple_downloads_spec.rb +11 -10
  120. data/spec/features/oembed_spec.rb +6 -5
  121. data/spec/features/relations_spec.rb +51 -26
  122. data/spec/features/saved_searches_spec.rb +7 -6
  123. data/spec/features/search_bar_spec.rb +9 -8
  124. data/spec/features/search_results_complex_geometry_spec.rb +12 -11
  125. data/spec/features/search_results_icons_spec.rb +10 -9
  126. data/spec/features/search_results_map_spec.rb +21 -20
  127. data/spec/features/search_results_overlap_ratio_spec.rb +17 -16
  128. data/spec/features/search_spec.rb +19 -18
  129. data/spec/features/show_page_download_spec.rb +15 -14
  130. data/spec/features/show_page_metadata_spec.rb +9 -8
  131. data/spec/features/show_page_sidebar_static_map_spec.rb +21 -0
  132. data/spec/features/sms_spec.rb +12 -11
  133. data/spec/features/split_view.html.erb_spec.rb +56 -55
  134. data/spec/features/suppressed_records_spec.rb +10 -9
  135. data/spec/features/tilejson_spec.rb +9 -8
  136. data/spec/features/tms_spec.rb +6 -5
  137. data/spec/features/web_services_modal_spec.rb +37 -36
  138. data/spec/features/wmts_spec.rb +16 -15
  139. data/spec/features/xyz_spec.rb +6 -5
  140. data/spec/fixtures/solr_documents/actual-papermap1.json +1 -1
  141. data/spec/fixtures/solr_documents/actual-point1.json +1 -1
  142. data/spec/fixtures/solr_documents/actual-polygon1.json +1 -1
  143. data/spec/fixtures/solr_documents/actual-raster1.json +1 -1
  144. data/spec/fixtures/solr_documents/baruch_ancestor1.json +1 -1
  145. data/spec/fixtures/solr_documents/baruch_ancestor2.json +1 -1
  146. data/spec/fixtures/solr_documents/baruch_documentation_download.json +2 -2
  147. data/spec/fixtures/solr_documents/cornell_html_metadata.json +1 -1
  148. data/spec/fixtures/solr_documents/display-note.json +52 -0
  149. data/spec/fixtures/solr_documents/esri-dynamic-layer-all-layers.json +1 -1
  150. data/spec/fixtures/solr_documents/esri-dynamic-layer-single-layer.json +1 -1
  151. data/spec/fixtures/solr_documents/esri-feature-layer.json +1 -1
  152. data/spec/fixtures/solr_documents/esri-image-map-layer.json +1 -1
  153. data/spec/fixtures/solr_documents/esri-tiled_map_layer.json +1 -1
  154. data/spec/fixtures/solr_documents/esri-wms-layer.json +1 -1
  155. data/spec/fixtures/solr_documents/harvard_raster.json +1 -1
  156. data/spec/fixtures/solr_documents/iiif-eastern-hemisphere.json +1 -1
  157. data/spec/fixtures/solr_documents/index-map-polygon-no-downloadurl.json +1 -1
  158. data/spec/fixtures/solr_documents/index-map-polygon.json +1 -1
  159. data/spec/fixtures/solr_documents/index-map-stanford.json +1 -1
  160. data/spec/fixtures/solr_documents/index_map_point.json +1 -1
  161. data/spec/fixtures/solr_documents/princeton-parent.json +1 -1
  162. data/spec/fixtures/solr_documents/public_direct_download.json +1 -1
  163. data/spec/fixtures/solr_documents/public_iiif_princeton.json +1 -1
  164. data/spec/fixtures/solr_documents/restricted-line.json +1 -1
  165. data/spec/fixtures/solr_documents/tilejson.json +2 -2
  166. data/spec/fixtures/solr_documents/umn_metro_result1.json +2 -2
  167. data/spec/fixtures/solr_documents/umn_state_result1.json +1 -1
  168. data/spec/fixtures/solr_documents/umn_state_result2.json +1 -1
  169. data/spec/fixtures/solr_documents/uva_slug_colon.json +1 -1
  170. data/spec/fixtures/solr_documents/wmts-multiple.json +1 -1
  171. data/spec/fixtures/solr_documents/wmts-single-layer.json +6 -6
  172. data/spec/fixtures/solr_documents/xyz.json +3 -3
  173. data/spec/helpers/arcgis_helper_spec.rb +8 -7
  174. data/spec/helpers/carto_helper_spec.rb +6 -5
  175. data/spec/helpers/geoblacklight/geoblacklight_helper_behavior_spec.rb +10 -15
  176. data/spec/helpers/geoblacklight_helper_spec.rb +139 -138
  177. data/spec/lib/geoblacklight/bounding_box_spec.rb +14 -13
  178. data/spec/lib/geoblacklight/document_presenter_spec.rb +26 -25
  179. data/spec/lib/geoblacklight/download/geojson_download_spec.rb +8 -7
  180. data/spec/lib/geoblacklight/download/geotiff_download_spec.rb +8 -7
  181. data/spec/lib/geoblacklight/download/hgl_download_spec.rb +16 -15
  182. data/spec/lib/geoblacklight/download/kmz_download_spec.rb +9 -8
  183. data/spec/lib/geoblacklight/download/shapefile_download_spec.rb +8 -7
  184. data/spec/lib/geoblacklight/download_spec.rb +61 -60
  185. data/spec/lib/geoblacklight/geometry_spec.rb +29 -28
  186. data/spec/lib/geoblacklight/item_viewer_spec.rb +25 -24
  187. data/spec/lib/geoblacklight/metadata/base_spec.rb +44 -43
  188. data/spec/lib/geoblacklight/metadata/html_spec.rb +7 -6
  189. data/spec/lib/geoblacklight/metadata_spec.rb +15 -14
  190. data/spec/lib/geoblacklight/metadata_transformer/base_spec.rb +13 -12
  191. data/spec/lib/geoblacklight/metadata_transformer/fgdc_spec.rb +8 -7
  192. data/spec/lib/geoblacklight/metadata_transformer/iso19139_spec.rb +8 -7
  193. data/spec/lib/geoblacklight/metadata_transformer_spec.rb +15 -14
  194. data/spec/lib/geoblacklight/reference_spec.rb +28 -27
  195. data/spec/lib/geoblacklight/references_spec.rb +89 -76
  196. data/spec/lib/geoblacklight/relation/ancestors_spec.rb +17 -16
  197. data/spec/lib/geoblacklight/relation/descendants_spec.rb +17 -16
  198. data/spec/lib/geoblacklight/relation/relation_response_spec.rb +29 -28
  199. data/spec/lib/geoblacklight/view_helper_override_spec.rb +14 -13
  200. data/spec/lib/geoblacklight/wms_layer/feature_info_response_spec.rb +19 -18
  201. data/spec/lib/geoblacklight/wms_layer_spec.rb +31 -30
  202. data/spec/models/concerns/geoblacklight/bbox_filter_field_spec.rb +31 -31
  203. data/spec/models/concerns/geoblacklight/bbox_filter_query_spec.rb +32 -32
  204. data/spec/models/concerns/geoblacklight/solr_document/carto_spec.rb +16 -15
  205. data/spec/models/concerns/geoblacklight/solr_document/citation_spec.rb +7 -6
  206. data/spec/models/concerns/geoblacklight/solr_document/finder_spec.rb +16 -17
  207. data/spec/models/concerns/geoblacklight/solr_document/inspection_spec.rb +7 -6
  208. data/spec/models/concerns/geoblacklight/solr_document_spec.rb +121 -107
  209. data/spec/models/concerns/geoblacklight/suppressed_records_search_behavior_spec.rb +8 -7
  210. data/spec/presenters/geoblacklight/bbox_item_presenter_spec.rb +10 -10
  211. data/spec/routing/catalog_routing_spec.rb +4 -3
  212. data/spec/spec_helper.rb +34 -33
  213. data/spec/support/backport_test_helpers.rb +6 -5
  214. data/spec/support/features/session_helpers.rb +8 -7
  215. data/spec/support/features.rb +2 -1
  216. data/spec/support/fixtures.rb +2 -1
  217. data/spec/tasks/geoblacklight_spec.rb +10 -9
  218. data/spec/test_app_templates/lib/generators/test_app_generator.rb +16 -15
  219. data/spec/views/catalog/_document_split.html.erb_spec.rb +3 -2
  220. data/spec/views/catalog/_index_split.html.erb_spec.rb +3 -2
  221. data/spec/views/catalog/_results_pagination.html.erb_spec.rb +5 -4
  222. data/spec/views/catalog/_show_downloads.html.erb_spec.rb +11 -10
  223. data/spec/views/catalog/_show_tools.html.erb_spec.rb +13 -12
  224. data/template.rb +9 -8
  225. metadata +31 -212
  226. data/.gitmodules +0 -0
  227. data/.rubocop.yml +0 -111
  228. data/.rubocop_todo.yml +0 -418
  229. data/config/initializers/new_gbl_settings_defaults_3_4.yml +0 -6
@@ -1,278 +1,292 @@
1
1
  # frozen_string_literal: true
2
- require 'spec_helper'
2
+
3
+ require "spec_helper"
3
4
 
4
5
  describe Geoblacklight::SolrDocument do
5
6
  let(:document) { SolrDocument.new(document_attributes) }
6
7
  let(:rights_field) { Settings.FIELDS.ACCESS_RIGHTS }
7
8
  let(:provider_field) { Settings.FIELDS.PROVIDER }
8
9
  let(:references_field) { Settings.FIELDS.REFERENCES }
9
- describe '#available?' do
10
+ describe "#available?" do
10
11
  let(:document_attributes) { {} }
11
- describe 'a public document' do
12
- it 'alwayses be available' do
13
- allow(document).to receive('same_institution?').and_return(false)
14
- allow(document).to receive('public?').and_return(true)
12
+ describe "a public document" do
13
+ it "alwayses be available" do
14
+ allow(document).to receive("same_institution?").and_return(false)
15
+ allow(document).to receive("public?").and_return(true)
15
16
  expect(document.available?).to be_truthy
16
17
  end
17
18
  end
18
- describe 'a restricted document' do
19
- it 'onlies be available if from same institution' do
20
- allow(document).to receive('same_institution?').and_return(true)
21
- allow(document).to receive('public?').and_return(false)
19
+ describe "a restricted document" do
20
+ it "onlies be available if from same institution" do
21
+ allow(document).to receive("same_institution?").and_return(true)
22
+ allow(document).to receive("public?").and_return(false)
22
23
  expect(document.available?).to be_truthy
23
24
  end
24
25
  end
25
26
  end
26
- describe '#public?' do
27
- describe 'a public document' do
28
- let(:document_attributes) { { rights_field => 'PUBLIC' } }
29
- it 'is public' do
27
+ describe "#public?" do
28
+ describe "a public document" do
29
+ let(:document_attributes) { {rights_field => "PUBLIC"} }
30
+ it "is public" do
30
31
  expect(document.public?).to be_truthy
31
32
  end
32
33
  end
33
- describe 'a restricted resource' do
34
- let(:document_attributes) { { rights_field => 'RESTRICTED' } }
35
- it 'does not be public' do
34
+ describe "a restricted resource" do
35
+ let(:document_attributes) { {rights_field => "RESTRICTED"} }
36
+ it "does not be public" do
36
37
  expect(document.public?).to be_falsey
37
38
  end
38
39
  end
39
- describe 'without rights data' do
40
+ describe "without rights data" do
40
41
  let(:document_attributes) { {} }
41
- it 'is not public' do
42
+ it "is not public" do
42
43
  expect(document.public?).to be_falsey
43
44
  end
44
45
  end
45
46
  end
46
- describe '#restricted?' do
47
- describe 'a restricted document' do
48
- let(:document_attributes) { { rights_field => 'RESTRICTED' } }
49
- it 'is restricted' do
47
+ describe "#restricted?" do
48
+ describe "a restricted document" do
49
+ let(:document_attributes) { {rights_field => "RESTRICTED"} }
50
+ it "is restricted" do
50
51
  expect(document.restricted?).to be_truthy
51
52
  end
52
53
  end
53
- describe 'a non-restricted resource' do
54
- let(:document_attributes) { { rights_field => 'PUBLIC' } }
55
- it 'is not restricted' do
54
+ describe "a non-restricted resource" do
55
+ let(:document_attributes) { {rights_field => "PUBLIC"} }
56
+ it "is not restricted" do
56
57
  expect(document.restricted?).to be_falsey
57
58
  end
58
59
  end
59
- describe 'without rights data' do
60
+ describe "without rights data" do
60
61
  let(:document_attributes) { {} }
61
- it 'is restricted' do
62
+ it "is restricted" do
62
63
  expect(document.restricted?).to be_truthy
63
64
  end
64
65
  end
65
66
  end
66
- describe '#downloadable?' do
67
- describe 'available direct download' do
67
+ describe "#downloadable?" do
68
+ describe "available direct download" do
68
69
  let(:document_attributes) do
69
70
  {
70
- rights_field => 'Public',
71
+ rights_field => "Public",
71
72
  references_field => {
72
- 'http://schema.org/downloadUrl' => 'http://example.com/direct/data.zip'
73
+ "http://schema.org/downloadUrl" => "http://example.com/direct/data.zip"
73
74
  }.to_json
74
75
  }
75
76
  end
76
- it 'will be downloadable' do
77
+ it "will be downloadable" do
77
78
  expect(document.downloadable?).to be_truthy
78
79
  end
79
80
  end
80
81
  end
81
- describe '#same_institution?' do
82
- describe 'within the same institution' do
83
- let(:document_attributes) { { provider_field => 'STANFORD' } }
84
- it 'is true' do
85
- allow(Settings).to receive('Institution').and_return('Stanford')
82
+ describe "#same_institution?" do
83
+ describe "within the same institution" do
84
+ let(:document_attributes) { {provider_field => "STANFORD"} }
85
+ it "is true" do
86
+ allow(Settings).to receive("Institution").and_return("Stanford")
86
87
  expect(document.same_institution?).to be_truthy
87
88
  end
88
- it 'matches case inconsistencies' do
89
- allow(Settings).to receive('Institution').and_return('StAnFord')
89
+ it "matches case inconsistencies" do
90
+ allow(Settings).to receive("Institution").and_return("StAnFord")
90
91
  expect(document.same_institution?).to be_truthy
91
92
  end
92
93
  end
93
- describe 'within a different institution' do
94
- let(:document_attributes) { { provider_field => 'MIT' } }
95
- it 'is false' do
96
- allow(Settings).to receive('Institution').and_return('Stanford')
94
+ describe "within a different institution" do
95
+ let(:document_attributes) { {provider_field => "MIT"} }
96
+ it "is false" do
97
+ allow(Settings).to receive("Institution").and_return("Stanford")
97
98
  expect(document.same_institution?).to be_falsey
98
99
  end
99
100
  end
100
101
  end
101
- describe 'references' do
102
+ describe "references" do
102
103
  let(:document_attributes) { {} }
103
- it 'generates a new references object' do
104
+ it "generates a new references object" do
104
105
  expect(document.references).to be_an Geoblacklight::References
105
106
  end
106
107
  end
107
- describe 'download_types' do
108
+ describe "download_types" do
108
109
  let(:document_attributes) { {} }
109
- it 'calls download_types' do
110
+ it "calls download_types" do
110
111
  expect_any_instance_of(Geoblacklight::References).to receive(:download_types)
111
112
  document.download_types
112
113
  end
113
114
  end
114
- describe 'direct_download' do
115
+ describe "direct_download" do
115
116
  let(:document_attributes) { {} }
116
- describe 'with a direct download' do
117
+ describe "with a direct download" do
117
118
  let(:document_attributes) do
118
119
  {
119
120
  references_field => {
120
- 'http://schema.org/downloadUrl' => 'http://example.com/urn:hul.harvard.edu:HARVARD.SDE2.TG10USAIANNH/data.zip'
121
+ "http://schema.org/downloadUrl" => "http://example.com/urn:hul.harvard.edu:HARVARD.SDE2.TG10USAIANNH/data.zip"
121
122
  }.to_json
122
123
  }
123
124
  end
124
- it 'returns a direct download hash' do
125
+ it "returns a direct download hash" do
125
126
  expect_any_instance_of(Geoblacklight::Reference).to receive(:to_hash)
126
127
  document.direct_download
127
128
  end
128
129
  end
129
- it 'returns nil if no direct download' do
130
+ it "returns nil if no direct download" do
130
131
  expect_any_instance_of(Geoblacklight::Reference).not_to receive(:to_hash)
131
132
  expect(document.direct_download).to be_nil
132
133
  end
133
134
  end
134
- describe 'hgl_download' do
135
- describe 'with an hgl download' do
135
+ describe "hgl_download" do
136
+ describe "with an hgl download" do
136
137
  let(:document_attributes) do
137
138
  {
138
139
  references_field => {
139
- 'http://schema.org/DownloadAction' => 'http://example.com/harvard'
140
+ "http://schema.org/DownloadAction" => "http://example.com/harvard"
140
141
  }.to_json
141
142
  }
142
143
  end
143
- it 'returns an hgl download hash' do
144
- expect(document.hgl_download[:hgl]).to eq('http://example.com/harvard')
144
+ it "returns an hgl download hash" do
145
+ expect(document.hgl_download[:hgl]).to eq("http://example.com/harvard")
145
146
  end
146
147
  end
147
- describe 'without an hgl download' do
148
+ describe "without an hgl download" do
148
149
  let(:document_attributes) { {} }
149
- it 'returns nil' do
150
+ it "returns nil" do
150
151
  expect(document.direct_download).to be_nil
151
152
  end
152
153
  end
153
154
  end
154
- describe '#oembed' do
155
- describe 'with an oembed url' do
155
+ describe "#oembed" do
156
+ describe "with an oembed url" do
156
157
  let(:document_attributes) do
157
158
  {
158
159
  references_field => {
159
- 'https://oembed.com' => 'http://example.com/oembed?url=oembec.com/id123'
160
+ "https://oembed.com" => "http://example.com/oembed?url=oembec.com/id123"
160
161
  }.to_json
161
162
  }
162
163
  end
163
- it 'returns a url string' do
164
- expect(document.oembed).to eq('http://example.com/oembed?url=oembec.com/id123')
164
+ it "returns a url string" do
165
+ expect(document.oembed).to eq("http://example.com/oembed?url=oembec.com/id123")
165
166
  end
166
167
  end
167
- describe 'without an oembed url' do
168
+ describe "without an oembed url" do
168
169
  let(:document_attributes) { {} }
169
- it 'returns nil' do
170
+ it "returns nil" do
170
171
  expect(document.oembed).to be_nil
171
172
  end
172
173
  end
173
174
  end
174
- describe 'iiif_download' do
175
- describe 'with a IIIF download' do
175
+ describe "iiif_download" do
176
+ describe "with a IIIF download" do
176
177
  let(:document_attributes) do
177
178
  {
178
179
  references_field => {
179
- 'http://iiif.io/api/image' => 'https://example.edu/images/info.json'
180
+ "http://iiif.io/api/image" => "https://example.edu/images/info.json"
180
181
  }.to_json
181
182
  }
182
183
  end
183
- it 'returns a IIIF download hash' do
184
- expect(document.iiif_download[:iiif]).to eq('https://example.edu/images/info.json')
184
+ it "returns a IIIF download hash" do
185
+ expect(document.iiif_download[:iiif]).to eq("https://example.edu/images/info.json")
185
186
  end
186
187
  end
187
- describe 'without a IIIF download' do
188
+ describe "without a IIIF download" do
188
189
  let(:document_attributes) { {} }
189
- it 'returns nil' do
190
+ it "returns nil" do
190
191
  expect(document.iiif_download).to be_nil
191
192
  end
192
193
  end
193
194
  end
194
- describe 'data_dictionary_download' do
195
- describe 'with a data dictionary reference' do
195
+ describe "data_dictionary_download" do
196
+ describe "with a data dictionary reference" do
196
197
  let(:document_attributes) do
197
198
  {
198
199
  references_field => {
199
- 'http://lccn.loc.gov/sh85035852' => 'https://example.edu/documentation/data_dictionary.zip'
200
+ "http://lccn.loc.gov/sh85035852" => "https://example.edu/documentation/data_dictionary.zip"
200
201
  }.to_json
201
202
  }
202
203
  end
203
- it 'returns a data dictionary download hash' do
204
- expect(document.data_dictionary_download[:data_dictionary]).to eq('https://example.edu/documentation/data_dictionary.zip')
204
+ it "returns a data dictionary download hash" do
205
+ expect(document.data_dictionary_download[:data_dictionary]).to eq("https://example.edu/documentation/data_dictionary.zip")
205
206
  end
206
207
  end
207
- describe 'without a data dictionary download' do
208
+ describe "without a data dictionary download" do
208
209
  let(:document_attributes) { {} }
209
- it 'returns nil' do
210
+ it "returns nil" do
210
211
  expect(document.data_dictionary_download).to be_nil
211
212
  end
212
213
  end
213
214
  end
214
- describe 'item_viewer' do
215
+ describe "item_viewer" do
215
216
  let(:document_attributes) { {} }
216
- it 'is a ItemViewer' do
217
+ it "is a ItemViewer" do
217
218
  expect(document.item_viewer).to be_an Geoblacklight::ItemViewer
218
219
  end
219
220
  end
220
- describe 'viewer_protocol' do
221
- describe 'with a wms reference' do
221
+ describe "viewer_protocol" do
222
+ describe "with a wms reference" do
222
223
  let(:document_attributes) do
223
224
  {
224
225
  references_field => {
225
- 'http://www.opengis.net/def/serviceType/ogc/wms' => 'http://www.example.com/wms'
226
+ "http://www.opengis.net/def/serviceType/ogc/wms" => "http://www.example.com/wms"
226
227
  }.to_json
227
228
  }
228
229
  end
229
- it 'returns wms protocol' do
230
- expect(document.viewer_protocol).to eq 'wms'
230
+ it "returns wms protocol" do
231
+ expect(document.viewer_protocol).to eq "wms"
231
232
  end
232
233
  end
233
234
  let(:document_attributes) { {} }
234
- it 'returns leaflet protocol' do
235
- expect(document.viewer_protocol).to eq 'map'
235
+ it "returns leaflet protocol" do
236
+ expect(document.viewer_protocol).to eq "map"
236
237
  end
237
238
  end
238
- describe 'viewer_endpoint' do
239
- describe 'with a wms reference' do
239
+ describe "viewer_endpoint" do
240
+ describe "with a wms reference" do
240
241
  let(:document_attributes) do
241
242
  {
242
243
  references_field => {
243
- 'http://www.opengis.net/def/serviceType/ogc/wms' => 'http://www.example.com/wms'
244
+ "http://www.opengis.net/def/serviceType/ogc/wms" => "http://www.example.com/wms"
244
245
  }.to_json
245
246
  }
246
247
  end
247
- it 'returns wms endpoint' do
248
- expect(document.viewer_endpoint).to eq 'http://www.example.com/wms'
248
+ it "returns wms endpoint" do
249
+ expect(document.viewer_endpoint).to eq "http://www.example.com/wms"
249
250
  end
250
251
  end
251
252
  let(:document_attributes) { {} }
252
- it 'returns no endpoint' do
253
- expect(document.viewer_endpoint).to eq ''
253
+ it "returns no endpoint" do
254
+ expect(document.viewer_endpoint).to eq ""
254
255
  end
255
256
  end
256
- describe 'checked_endpoint' do
257
+ describe "checked_endpoint" do
257
258
  let(:document_attributes) { {} }
258
- let(:reference) { Geoblacklight::Reference.new(['http://www.opengis.net/def/serviceType/ogc/wms', 'http://www.example.com/wms']) }
259
- it 'returns endpoint if available' do
259
+ let(:reference) { Geoblacklight::Reference.new(["http://www.opengis.net/def/serviceType/ogc/wms", "http://www.example.com/wms"]) }
260
+ it "returns endpoint if available" do
260
261
  expect_any_instance_of(Geoblacklight::References).to receive(:wms).and_return(reference)
261
- expect(document.checked_endpoint('wms')).to eq 'http://www.example.com/wms'
262
+ expect(document.checked_endpoint("wms")).to eq "http://www.example.com/wms"
262
263
  end
263
- it 'return nil if not available' do
264
+ it "return nil if not available" do
264
265
  expect_any_instance_of(Geoblacklight::References).to receive(:wms).and_return(nil)
265
- expect(document.checked_endpoint('wms')).to be_nil
266
+ expect(document.checked_endpoint("wms")).to be_nil
266
267
  end
267
268
  end
268
- describe 'method_missing' do
269
+ describe "method_missing" do
269
270
  let(:document_attributes) { {} }
270
- it 'calls checked_endpoint with parsed method name if matches' do
271
- expect(document).to receive(:checked_endpoint).with('wms').and_return(nil)
271
+ it "calls checked_endpoint with parsed method name if matches" do
272
+ expect(document).to receive(:checked_endpoint).with("wms").and_return(nil)
272
273
  expect(document.wms_url).to be_nil
273
274
  end
274
- it 'raises no method error' do
275
+ it "raises no method error" do
275
276
  expect { document.wms_urlz }.to raise_error NoMethodError
276
277
  end
277
278
  end
279
+ describe "#respond_to_missing?" do
280
+ let(:document_attributes) { {} }
281
+ context "with a valid method" do
282
+ it "returns true" do
283
+ expect(document.respond_to?(:wms_url)).to be true
284
+ end
285
+ end
286
+ context "with a invalid method" do
287
+ it "returns true" do
288
+ expect(document.respond_to?(:wms_urlz)).to be false
289
+ end
290
+ end
291
+ end
278
292
  end
@@ -1,11 +1,12 @@
1
1
  # frozen_string_literal: true
2
- require 'spec_helper'
2
+
3
+ require "spec_helper"
3
4
 
4
5
  describe Geoblacklight::SuppressedRecordsSearchBehavior do
5
6
  subject(:searcher) { search_builder.with(user_params) }
6
7
 
7
8
  let(:user_params) { {} }
8
- let(:solr_params) { { q: 'water' } }
9
+ let(:solr_params) { {q: "water"} }
9
10
  let(:blacklight_config) { CatalogController.blacklight_config.deep_copy }
10
11
  let(:context) { CatalogController.new }
11
12
  let(:search_builder_class) do
@@ -16,14 +17,14 @@ describe Geoblacklight::SuppressedRecordsSearchBehavior do
16
17
  end
17
18
  let(:search_builder) { search_builder_class.new(context) }
18
19
 
19
- describe '#hide_suppressed_records' do
20
- it 'hides/filters suppressed records' do
21
- expect(searcher.hide_suppressed_records(solr_params)).to include('-gbl_suppressed_b: true')
20
+ describe "#hide_suppressed_records" do
21
+ it "hides/filters suppressed records" do
22
+ expect(searcher.hide_suppressed_records(solr_params)).to include("-gbl_suppressed_b: true")
22
23
  end
23
24
  end
24
25
 
25
- context 'when document action call like CatalogController#web_services' do
26
- it 'does not hide/filter suppressed records' do
26
+ context "when document action call like CatalogController#web_services" do
27
+ it "does not hide/filter suppressed records" do
27
28
  solr_params[:q] = "{!lucene}#{Settings.FIELDS.ID}:"
28
29
  expect(searcher.hide_suppressed_records(solr_params)).to be_nil
29
30
  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::BboxItemPresenter, type: :presenter do
6
6
  subject(:presenter) do
@@ -9,27 +9,27 @@ RSpec.describe Geoblacklight::BboxItemPresenter, type: :presenter do
9
9
 
10
10
  let(:facet_item) { instance_double(Blacklight::Solr::Response::Facets::FacetItem) }
11
11
  let(:filter_field) { instance_double(Blacklight::SearchState::FilterField, include?: true) }
12
- let(:facet_config) { Blacklight::Configuration::FacetField.new(key: 'key') }
12
+ let(:facet_config) { Blacklight::Configuration::FacetField.new(key: "key") }
13
13
  let(:facet_field) { instance_double(Blacklight::Solr::Response::Facets::FacetField) }
14
14
  let(:view_context) { controller.view_context }
15
15
  let(:search_state) { instance_double(Blacklight::SearchState, filter: filter_field) }
16
16
  let(:controller) { CatalogController.new }
17
17
 
18
- describe '#label' do
19
- context 'with a single value' do
20
- let(:facet_item) { 'blah' }
18
+ describe "#label" do
19
+ context "with a single value" do
20
+ let(:facet_item) { "blah" }
21
21
 
22
- it 'uses the normal logic for item values' do
23
- expect(presenter.label).to eq 'blah'
22
+ it "uses the normal logic for item values" do
23
+ expect(presenter.label).to eq "blah"
24
24
  end
25
25
  end
26
26
 
27
- context 'with a bbox' do
27
+ context "with a bbox" do
28
28
  let(:facet_item) { Geoblacklight::BoundingBox.new(-160, -80, 120, 70) }
29
29
 
30
- it 'translates the bbox into some nice, human-readable html' do
30
+ it "translates the bbox into some nice, human-readable html" do
31
31
  expect(Capybara.string(presenter.label))
32
- .to have_text('-160 -80 120 70')
32
+ .to have_text("-160 -80 120 70")
33
33
  end
34
34
  end
35
35
  end
@@ -1,9 +1,10 @@
1
1
  # frozen_string_literal: true
2
- require 'spec_helper'
3
2
 
4
- describe 'Catalog Routes', type: :routing do
3
+ require "spec_helper"
4
+
5
+ describe "Catalog Routes", type: :routing do
5
6
  # Test paths for custom routes
6
7
  it "maps { :controller => 'catalog', :action => 'opensearch', :format => 'xml' } to /catalog/opensearch.xml" do
7
- expect(get: '/catalog/opensearch.xml').to route_to(controller: 'catalog', action: 'opensearch', format: 'xml')
8
+ expect(get: "/catalog/opensearch.xml").to route_to(controller: "catalog", action: "opensearch", format: "xml")
8
9
  end
9
10
  end
data/spec/spec_helper.rb CHANGED
@@ -1,64 +1,65 @@
1
1
  # frozen_string_literal: true
2
- ENV['RAILS_ENV'] ||= 'test'
3
2
 
4
- require 'simplecov'
3
+ ENV["RAILS_ENV"] ||= "test"
4
+
5
+ require "simplecov"
5
6
  SimpleCov.formatter = SimpleCov::Formatter::HTMLFormatter
6
7
 
7
- if ENV.fetch('CIRCLE_ARTIFACTS', false)
8
- dir = File.join(ENV.fetch('CIRCLE_ARTIFACTS'), 'coverage')
8
+ if ENV.fetch("CIRCLE_ARTIFACTS", false)
9
+ dir = File.join(ENV.fetch("CIRCLE_ARTIFACTS"), "coverage")
9
10
  SimpleCov.coverage_dir(dir)
10
11
  end
11
12
 
12
- SimpleCov.start 'rails' do
13
- add_filter 'lib/generators/geoblacklight/install_generator.rb'
14
- add_filter 'lib/geoblacklight/version.rb'
15
- add_filter 'lib/generators'
16
- add_filter 'lib/tasks/geoblacklight.rake'
17
- add_filter '/spec'
18
- add_filter '.internal_test_app/'
13
+ SimpleCov.start "rails" do
14
+ add_filter "lib/generators/geoblacklight/install_generator.rb"
15
+ add_filter "lib/geoblacklight/version.rb"
16
+ add_filter "lib/generators"
17
+ add_filter "lib/tasks/geoblacklight.rake"
18
+ add_filter "/spec"
19
+ add_filter ".internal_test_app/"
19
20
  minimum_coverage 100
20
21
  end
21
22
 
22
- require 'factory_bot'
23
- require 'database_cleaner'
23
+ require "factory_bot"
24
+ require "database_cleaner"
24
25
 
25
- require 'engine_cart'
26
+ require "engine_cart"
26
27
  EngineCart.load_application!
27
28
 
28
- require 'rails-controller-testing' if Rails::VERSION::MAJOR >= 5
29
- require 'rspec/rails'
30
- require 'capybara/rspec'
31
- require 'selenium-webdriver'
32
- require 'webdrivers'
29
+ require "rails-controller-testing" if Rails::VERSION::MAJOR >= 5
30
+ require "rspec/rails"
31
+ require "capybara/rspec"
32
+ require "selenium-webdriver"
33
+ require "webdrivers"
33
34
 
34
35
  # Setup webmock for specific tests
35
- require 'webmock/rspec'
36
+ require "webmock/rspec"
36
37
  WebMock.allow_net_connect!(net_http_connect_on_start: true)
37
38
 
38
39
  Capybara.register_driver(:headless_chrome) do |app|
39
40
  Capybara::Selenium::Driver.load_selenium
40
41
  browser_options = ::Selenium::WebDriver::Chrome::Options.new.tap do |opts|
41
- opts.args << '--headless'
42
- opts.args << '--disable-gpu'
43
- opts.args << '--window-size=1280,1024'
42
+ opts.args << "--headless"
43
+ opts.args << "--disable-gpu"
44
+ opts.args << "--window-size=1280,1024"
44
45
  end
45
46
  http_client = Selenium::WebDriver::Remote::Http::Default.new
46
47
  http_client.read_timeout = 120
47
48
  http_client.open_timeout = 120
48
49
  Capybara::Selenium::Driver.new(app,
49
- browser: :chrome,
50
- http_client: http_client,
51
- capabilities: [browser_options])
50
+ browser: :chrome,
51
+ http_client: http_client,
52
+ capabilities: [browser_options])
52
53
  end
53
54
 
54
55
  Capybara.javascript_driver = :headless_chrome
55
56
  Capybara.default_max_wait_time = 120
56
57
 
57
- require 'geoblacklight'
58
+ require "geoblacklight"
58
59
 
59
- Dir['./spec/support/**/*.rb'].sort.each { |f| require f }
60
+ Dir["./spec/support/**/*.rb"].sort.each { |f| require f }
60
61
 
61
- FactoryBot.definition_file_paths = [File.expand_path('../factories', __FILE__)]
62
+ FactoryBot.definition_file_paths = [File.expand_path("../factories", __FILE__)]
62
63
  FactoryBot.find_definitions
63
64
 
64
65
  RSpec.configure do |config|
@@ -66,10 +67,10 @@ RSpec.configure do |config|
66
67
 
67
68
  config.before do
68
69
  DatabaseCleaner.strategy = if Capybara.current_driver == :rack_test
69
- :transaction
70
- else
71
- :truncation
72
- end
70
+ :transaction
71
+ else
72
+ :truncation
73
+ end
73
74
  DatabaseCleaner.start
74
75
  end
75
76