geoblacklight 2.2.0 → 3.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (277) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +212 -112
  3. data/.rubocop.yml +16 -14
  4. data/.rubocop_todo.yml +28 -151
  5. data/Gemfile +3 -8
  6. data/README.md +1 -1
  7. data/Rakefile +1 -0
  8. data/app/assets/images/blacklight/arrow-circle-down.svg +1 -2
  9. data/app/assets/images/blacklight/baruch-cuny.svg +1 -4
  10. data/app/assets/images/blacklight/berkeley.svg +1 -4
  11. data/app/assets/images/blacklight/book.svg +1 -4
  12. data/app/assets/images/blacklight/bookmark.svg +1 -4
  13. data/app/assets/images/blacklight/cd-rom.svg +1 -4
  14. data/app/assets/images/blacklight/chicago.svg +1 -4
  15. data/app/assets/images/blacklight/citation.svg +3 -0
  16. data/app/assets/images/blacklight/collection.svg +3 -0
  17. data/app/assets/images/blacklight/columbia.svg +1 -4
  18. data/app/assets/images/blacklight/cornell.svg +1 -4
  19. data/app/assets/images/blacklight/dvd-rom.svg +1 -4
  20. data/app/assets/images/blacklight/email.svg +1 -4
  21. data/app/assets/images/blacklight/esri-globe.svg +1 -4
  22. data/app/assets/images/blacklight/globe.svg +1 -2
  23. data/app/assets/images/blacklight/harvard.svg +1 -4
  24. data/app/assets/images/blacklight/home.svg +1 -2
  25. data/app/assets/images/blacklight/illinois.svg +1 -4
  26. data/app/assets/images/blacklight/image.svg +1 -4
  27. data/app/assets/images/blacklight/indiana.svg +1 -4
  28. data/app/assets/images/blacklight/iowa.svg +1 -4
  29. data/app/assets/images/blacklight/leaf.svg +1 -4
  30. data/app/assets/images/blacklight/lewis-clark.svg +1 -4
  31. data/app/assets/images/blacklight/line.svg +1 -4
  32. data/app/assets/images/blacklight/map-marker.svg +1 -4
  33. data/app/assets/images/blacklight/map.svg +1 -4
  34. data/app/assets/images/blacklight/maryland.svg +1 -4
  35. data/app/assets/images/blacklight/massgis.svg +1 -4
  36. data/app/assets/images/blacklight/metadata.svg +1 -4
  37. data/app/assets/images/blacklight/michigan-state.svg +1 -4
  38. data/app/assets/images/blacklight/michigan.svg +1 -4
  39. data/app/assets/images/blacklight/minnesota.svg +1 -4
  40. data/app/assets/images/blacklight/mit.svg +1 -4
  41. data/app/assets/images/blacklight/mixed.svg +1 -4
  42. data/app/assets/images/blacklight/multilinestring.svg +1 -4
  43. data/app/assets/images/blacklight/multipoint.svg +1 -4
  44. data/app/assets/images/blacklight/multipolygon.svg +1 -4
  45. data/app/assets/images/blacklight/nyu.svg +1 -4
  46. data/app/assets/images/blacklight/ohio-state.svg +1 -4
  47. data/app/assets/images/blacklight/pagelines-brands.svg +1 -4
  48. data/app/assets/images/blacklight/paper-map.svg +1 -4
  49. data/app/assets/images/blacklight/penn-state.svg +1 -4
  50. data/app/assets/images/blacklight/point.svg +1 -4
  51. data/app/assets/images/blacklight/polygon.svg +1 -4
  52. data/app/assets/images/blacklight/polyline.svg +1 -4
  53. data/app/assets/images/blacklight/princeton.svg +1 -4
  54. data/app/assets/images/blacklight/public.svg +1 -4
  55. data/app/assets/images/blacklight/purdue.svg +1 -4
  56. data/app/assets/images/blacklight/raster.svg +1 -4
  57. data/app/assets/images/blacklight/restricted.svg +1 -4
  58. data/app/assets/images/blacklight/sms.svg +1 -4
  59. data/app/assets/images/blacklight/stanford.svg +1 -4
  60. data/app/assets/images/blacklight/table.svg +1 -4
  61. data/app/assets/images/blacklight/tags.svg +1 -2
  62. data/app/assets/images/blacklight/texas.svg +1 -4
  63. data/app/assets/images/blacklight/tufts.svg +1 -4
  64. data/app/assets/images/blacklight/ucla.svg +1 -4
  65. data/app/assets/images/blacklight/uva.svg +1 -4
  66. data/app/assets/images/blacklight/web_services.svg +1 -4
  67. data/app/assets/images/blacklight/wisconsin.svg +1 -4
  68. data/app/assets/javascripts/geoblacklight/basemaps.js +18 -0
  69. data/app/assets/javascripts/geoblacklight/downloaders/downloader.js +1 -1
  70. data/app/assets/javascripts/geoblacklight/modules/geosearch.js +1 -1
  71. data/app/assets/javascripts/geoblacklight/modules/home.js +1 -1
  72. data/app/assets/javascripts/geoblacklight/modules/item.js +20 -1
  73. data/app/assets/javascripts/geoblacklight/modules/results.js +4 -2
  74. data/app/assets/javascripts/geoblacklight/modules/svg_tooltips.js +31 -0
  75. data/app/assets/javascripts/geoblacklight/viewers/esri.js +2 -2
  76. data/app/assets/javascripts/geoblacklight/viewers/esri/tiled_map_layer.js +1 -1
  77. data/app/assets/javascripts/geoblacklight/viewers/wms.js +2 -2
  78. data/app/assets/stylesheets/geoblacklight/geoblacklight.scss +2 -0
  79. data/app/assets/stylesheets/geoblacklight/modules/_base.scss +33 -0
  80. data/app/assets/stylesheets/geoblacklight/{_blacklight_overrides.scss → modules/_blacklight_overrides.scss} +1 -10
  81. data/app/assets/stylesheets/geoblacklight/{_styles.scss → modules/_styles.scss} +1 -0
  82. data/app/assets/stylesheets/geoblacklight/modules/downloads.scss +37 -54
  83. data/app/assets/stylesheets/geoblacklight/modules/item.scss +13 -0
  84. data/app/assets/stylesheets/geoblacklight/modules/results.scss +26 -29
  85. data/app/assets/stylesheets/geoblacklight/modules/sidebar.scss +12 -42
  86. data/app/assets/stylesheets/geoblacklight/modules/toolbar.scss +17 -59
  87. data/app/controllers/download_controller.rb +12 -12
  88. data/app/controllers/relation_controller.rb +1 -0
  89. data/app/controllers/wms_controller.rb +1 -0
  90. data/app/helpers/arcgis_helper.rb +1 -0
  91. data/app/helpers/blacklight_helper.rb +1 -0
  92. data/app/helpers/carto_helper.rb +1 -0
  93. data/app/helpers/geoblacklight_helper.rb +36 -79
  94. data/app/models/concerns/geoblacklight/solr_document.rb +15 -9
  95. data/app/models/concerns/geoblacklight/solr_document/arcgis.rb +2 -1
  96. data/app/models/concerns/geoblacklight/solr_document/carto.rb +1 -13
  97. data/app/models/concerns/geoblacklight/solr_document/citation.rb +29 -0
  98. data/app/models/concerns/geoblacklight/solr_document/finder.rb +1 -0
  99. data/app/models/concerns/geoblacklight/solr_document/inspection.rb +2 -1
  100. data/app/models/concerns/geoblacklight/spatial_search_behavior.rb +3 -1
  101. data/app/presenters/geoblacklight/document_presenter.rb +2 -1
  102. data/app/views/catalog/_arcgis.html.erb +4 -0
  103. data/app/views/catalog/_carto.html.erb +4 -0
  104. data/app/views/catalog/_citation.html.erb +11 -0
  105. data/app/views/catalog/_data_dictionary.html.erb +1 -1
  106. data/app/views/catalog/_document_action.html.erb +1 -1
  107. data/app/views/catalog/_document_split.html.erb +1 -1
  108. data/app/views/catalog/_downloads_primary.html.erb +8 -1
  109. data/app/views/catalog/_header_icons.html.erb +3 -3
  110. data/app/views/catalog/_home_text.html.erb +4 -1
  111. data/app/views/catalog/_index_split_default.html.erb +22 -14
  112. data/app/views/catalog/_show_default_viewer_container.html.erb +1 -1
  113. data/app/views/catalog/_web_services_wfs.html.erb +3 -3
  114. data/app/views/catalog/_web_services_wms.html.erb +3 -3
  115. data/app/views/catalog/metadata.html.erb +3 -1
  116. data/app/views/catalog/web_services.html.erb +9 -7
  117. data/app/views/relation/_ancestors.html.erb +2 -5
  118. data/app/views/relation/_descendants.html.erb +3 -6
  119. data/app/views/relation/index.html.erb +20 -8
  120. data/app/views/relation/index.json.jbuilder +2 -1
  121. data/app/views/shared/_header_navbar.html.erb +1 -3
  122. data/bin/coverage.rb +36 -0
  123. data/config/initializers/rails_config.rb +1 -0
  124. data/config/locales/geoblacklight.en.yml +46 -61
  125. data/geoblacklight.gemspec +5 -8
  126. data/lib/generators/geoblacklight/assets_generator.rb +46 -0
  127. data/lib/generators/geoblacklight/install_generator.rb +8 -9
  128. data/lib/generators/geoblacklight/templates/assets/_blacklight.scss +1 -0
  129. data/lib/generators/geoblacklight/templates/assets/_customizations.scss +28 -0
  130. data/{app/assets/stylesheets/geoblacklight/application.scss → lib/generators/geoblacklight/templates/assets/_geoblacklight.scss} +0 -1
  131. data/lib/generators/geoblacklight/templates/assets/application.scss +7 -0
  132. data/lib/generators/geoblacklight/templates/{geoblacklight.js → assets/geoblacklight.js} +0 -1
  133. data/lib/generators/geoblacklight/templates/catalog_controller.rb +6 -2
  134. data/lib/generators/geoblacklight/templates/settings.yml +4 -6
  135. data/lib/generators/geoblacklight/webpacker_generator.rb +2 -1
  136. data/lib/geoblacklight.rb +1 -0
  137. data/lib/geoblacklight/bounding_box.rb +1 -0
  138. data/lib/geoblacklight/catalog_helper_override.rb +2 -1
  139. data/lib/geoblacklight/constants.rb +1 -0
  140. data/lib/geoblacklight/download.rb +6 -5
  141. data/lib/geoblacklight/download/geojson_download.rb +1 -0
  142. data/lib/geoblacklight/download/geotiff_download.rb +1 -0
  143. data/lib/geoblacklight/download/hgl_download.rb +1 -0
  144. data/lib/geoblacklight/download/kmz_download.rb +2 -1
  145. data/lib/geoblacklight/download/shapefile_download.rb +1 -0
  146. data/lib/geoblacklight/engine.rb +2 -2
  147. data/lib/geoblacklight/exceptions.rb +1 -0
  148. data/lib/geoblacklight/geoblacklight_helper_behavior.rb +1 -0
  149. data/lib/geoblacklight/item_viewer.rb +1 -0
  150. data/lib/geoblacklight/metadata.rb +1 -0
  151. data/lib/geoblacklight/metadata/base.rb +3 -2
  152. data/lib/geoblacklight/metadata/fgdc.rb +1 -0
  153. data/lib/geoblacklight/metadata/html.rb +2 -2
  154. data/lib/geoblacklight/metadata/iso19139.rb +1 -0
  155. data/lib/geoblacklight/metadata_transformer.rb +1 -0
  156. data/lib/geoblacklight/metadata_transformer/base.rb +1 -0
  157. data/lib/geoblacklight/metadata_transformer/fgdc.rb +1 -0
  158. data/lib/geoblacklight/metadata_transformer/iso19139.rb +1 -0
  159. data/lib/geoblacklight/reference.rb +1 -0
  160. data/lib/geoblacklight/references.rb +7 -3
  161. data/lib/geoblacklight/relation/ancestors.rb +2 -1
  162. data/lib/geoblacklight/relation/descendants.rb +2 -1
  163. data/lib/geoblacklight/relation/relation_response.rb +2 -1
  164. data/lib/geoblacklight/routes.rb +1 -0
  165. data/lib/geoblacklight/routes/downloadable.rb +1 -0
  166. data/lib/geoblacklight/routes/exportable.rb +1 -0
  167. data/lib/geoblacklight/routes/wms.rb +1 -0
  168. data/lib/geoblacklight/version.rb +2 -1
  169. data/lib/geoblacklight/view_helper_override.rb +2 -1
  170. data/lib/geoblacklight/wms_layer.rb +3 -2
  171. data/lib/geoblacklight/wms_layer/feature_info_response.rb +1 -0
  172. data/lib/tasks/geoblacklight.rake +33 -32
  173. data/solr/conf/schema.xml +5 -5
  174. data/spec/controllers/catalog_controller_spec.rb +1 -0
  175. data/spec/controllers/download_controller_spec.rb +2 -1
  176. data/spec/controllers/relation_controller_spec.rb +1 -0
  177. data/spec/controllers/wms_controller_spec.rb +2 -1
  178. data/spec/factories/user.rb +1 -0
  179. data/spec/features/bookmarks_spec.rb +1 -0
  180. data/spec/features/configurable_basemap_spec.rb +10 -0
  181. data/spec/features/data_dictionary_download_spec.rb +1 -0
  182. data/spec/features/download_layer_spec.rb +1 -0
  183. data/spec/features/empty_search_spec.rb +1 -0
  184. data/spec/features/esri_viewer_spec.rb +1 -6
  185. data/spec/features/exports_spec.rb +4 -12
  186. data/spec/features/help_text_spec.rb +1 -0
  187. data/spec/features/home_page_spec.rb +6 -0
  188. data/spec/features/iiif_viewer_spec.rb +1 -0
  189. data/spec/features/index_map_spec.rb +1 -0
  190. data/spec/features/layer_inspection_spec.rb +1 -0
  191. data/spec/features/layer_opacity_spec.rb +1 -0
  192. data/spec/features/layer_preview_spec.rb +1 -0
  193. data/spec/features/layer_with_no_references_spec.rb +1 -0
  194. data/spec/features/linkified_attribute_table_spec.rb +1 -0
  195. data/spec/features/metadata_panel_spec.rb +1 -0
  196. data/spec/features/missing_metadata_spec.rb +13 -0
  197. data/spec/features/multiple_downloads_spec.rb +15 -0
  198. data/spec/features/oembed_spec.rb +1 -0
  199. data/spec/features/relations_spec.rb +10 -28
  200. data/spec/features/saved_searches_spec.rb +1 -0
  201. data/spec/features/search_bar_spec.rb +1 -0
  202. data/spec/features/search_results_map_spec.rb +1 -6
  203. data/spec/features/search_results_overlap_ratio_spec.rb +4 -3
  204. data/spec/features/search_spec.rb +1 -0
  205. data/spec/features/show_page_metadata_spec.rb +1 -0
  206. data/spec/features/sms_spec.rb +1 -0
  207. data/spec/features/split_view.html.erb_spec.rb +4 -3
  208. data/spec/features/suppressed_records_spec.rb +1 -0
  209. data/spec/features/web_services_modal_spec.rb +1 -0
  210. data/spec/fixtures/solr_documents/metadata_no_dct_provenance_s.json +30 -0
  211. data/spec/fixtures/solr_documents/metadata_no_layer_geom_type_s.json +17 -0
  212. data/spec/fixtures/solr_documents/metadata_no_solr_geom.json +23 -0
  213. data/spec/fixtures/solr_documents/multiple-downloads.json +30 -0
  214. data/spec/helpers/arcgis_helper_spec.rb +1 -0
  215. data/spec/helpers/carto_helper_spec.rb +1 -0
  216. data/spec/helpers/geoblacklight_helper_spec.rb +51 -5
  217. data/spec/javascripts/geoblacklight/viewers/esri/tiled_map_layer_spec.js +12 -0
  218. data/spec/javascripts/geoblacklight_spec.js +0 -4
  219. data/spec/lib/geoblacklight/bounding_box_spec.rb +1 -0
  220. data/spec/lib/geoblacklight/controller_override_spec.rb +1 -0
  221. data/spec/lib/geoblacklight/document_presenter_spec.rb +3 -2
  222. data/spec/lib/geoblacklight/download/geojson_download_spec.rb +1 -0
  223. data/spec/lib/geoblacklight/download/geotiff_download_spec.rb +1 -0
  224. data/spec/lib/geoblacklight/download/hgl_download_spec.rb +1 -0
  225. data/spec/lib/geoblacklight/download/kmz_download_spec.rb +1 -0
  226. data/spec/lib/geoblacklight/download/shapefile_download_spec.rb +1 -0
  227. data/spec/lib/geoblacklight/download_spec.rb +4 -3
  228. data/spec/lib/geoblacklight/geoblacklight_helper_behavior_spec.rb +1 -0
  229. data/spec/lib/geoblacklight/item_viewer_spec.rb +1 -0
  230. data/spec/lib/geoblacklight/metadata/base_spec.rb +4 -3
  231. data/spec/lib/geoblacklight/metadata/html_spec.rb +1 -0
  232. data/spec/lib/geoblacklight/metadata_spec.rb +1 -0
  233. data/spec/lib/geoblacklight/metadata_transformer/base_spec.rb +3 -2
  234. data/spec/lib/geoblacklight/metadata_transformer/fgdc_spec.rb +3 -2
  235. data/spec/lib/geoblacklight/metadata_transformer/iso19139_spec.rb +3 -2
  236. data/spec/lib/geoblacklight/metadata_transformer_spec.rb +4 -3
  237. data/spec/lib/geoblacklight/reference_spec.rb +1 -0
  238. data/spec/lib/geoblacklight/references_spec.rb +2 -3
  239. data/spec/lib/geoblacklight/relation/ancestors_spec.rb +2 -1
  240. data/spec/lib/geoblacklight/relation/descendants_spec.rb +2 -1
  241. data/spec/lib/geoblacklight/relation/relation_response_spec.rb +1 -0
  242. data/spec/lib/geoblacklight/view_helper_override_spec.rb +1 -0
  243. data/spec/lib/geoblacklight/wms_layer/feature_info_response_spec.rb +5 -4
  244. data/spec/lib/geoblacklight/wms_layer_spec.rb +3 -2
  245. data/spec/models/concerns/geoblacklight/solr_document/carto_spec.rb +1 -20
  246. data/spec/models/concerns/geoblacklight/solr_document/citation_spec.rb +14 -0
  247. data/spec/models/concerns/geoblacklight/solr_document/finder_spec.rb +1 -0
  248. data/spec/models/concerns/geoblacklight/solr_document/inspection_spec.rb +1 -0
  249. data/spec/models/concerns/geoblacklight/solr_document_spec.rb +27 -0
  250. data/spec/models/concerns/geoblacklight/spatial_search_behavior_spec.rb +15 -2
  251. data/spec/routing/catalog_routing_spec.rb +1 -0
  252. data/spec/spec_helper.rb +12 -9
  253. data/spec/support/backport_test_helpers.rb +1 -0
  254. data/spec/support/features.rb +1 -0
  255. data/spec/support/features/session_helpers.rb +1 -0
  256. data/spec/support/fixtures.rb +8 -0
  257. data/spec/tasks/geoblacklight_spec.rb +19 -0
  258. data/spec/teaspoon_env.rb +1 -0
  259. data/spec/test_app_templates/Gemfile.extra +1 -0
  260. data/spec/test_app_templates/lib/generators/test_app_generator.rb +1 -0
  261. data/spec/views/catalog/_document_split.html.erb_spec.rb +1 -0
  262. data/spec/views/catalog/_index_split.html.erb_spec.rb +1 -0
  263. data/spec/views/catalog/_results_pagination.html.erb_spec.rb +1 -0
  264. data/spec/views/catalog/_show_downloads.html.erb_spec.rb +1 -0
  265. data/spec/views/catalog/_show_tools.html.erb_spec.rb +2 -4
  266. data/template.rb +1 -0
  267. data/vendor/assets/stylesheets/leaflet.css +0 -1
  268. metadata +69 -79
  269. data/app/assets/images/blacklight/logo.png +0 -0
  270. data/app/assets/javascripts/geoblacklight/modules/collapse.js +0 -7
  271. data/app/assets/stylesheets/geoblacklight/_geoblacklight.scss +0 -36
  272. data/app/assets/stylesheets/geoblacklight/modules/relations.scss +0 -15
  273. data/app/views/catalog/_exports.html.erb +0 -3
  274. data/app/views/catalog/_show_tools.html.erb +0 -25
  275. data/lib/generators/geoblacklight/templates/geoblacklight.scss +0 -4
  276. data/vendor/assets/javascripts/readmore.js +0 -618
  277. data/vendor/assets/javascripts/readmore.js.map +0 -1
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
 
3
4
  describe Geoblacklight::MetadataTransformer do
@@ -9,10 +10,10 @@ describe Geoblacklight::MetadataTransformer do
9
10
 
10
11
  describe '.instance' do
11
12
  context 'with FGDC metadata' do
12
- let(:metadata) { instance_double(Geoblacklight::Metadata::Fgdc) }
13
13
  subject do
14
14
  described_class.instance(metadata)
15
15
  end
16
+ let(:metadata) { instance_double(Geoblacklight::Metadata::Fgdc) }
16
17
 
17
18
  before do
18
19
  allow(klass).to receive(:name).and_return('Geoblacklight::Metadata::Fgdc')
@@ -24,10 +25,10 @@ describe Geoblacklight::MetadataTransformer do
24
25
  end
25
26
 
26
27
  context 'with ISO19139 metadata' do
27
- let(:metadata) { instance_double(Geoblacklight::Metadata::Iso19139) }
28
28
  subject do
29
29
  described_class.instance(metadata)
30
30
  end
31
+ let(:metadata) { instance_double(Geoblacklight::Metadata::Iso19139) }
31
32
 
32
33
  before do
33
34
  allow(klass).to receive(:name).and_return('Geoblacklight::Metadata::Iso19139')
@@ -39,10 +40,10 @@ describe Geoblacklight::MetadataTransformer do
39
40
  end
40
41
 
41
42
  context 'without a metadata type' do
42
- let(:metadata) { instance_double(Geoblacklight::Metadata::Base) }
43
43
  subject do
44
44
  described_class.instance(metadata)
45
45
  end
46
+ let(:metadata) { instance_double(Geoblacklight::Metadata::Base) }
46
47
 
47
48
  before do
48
49
  allow(klass).to receive(:name).and_return('Geoblacklight::Metadata::Base')
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
 
3
4
  describe Geoblacklight::Reference do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
 
3
4
  describe Geoblacklight::References do
@@ -133,7 +134,7 @@ describe Geoblacklight::References do
133
134
  context 'with an overridden order for the formats' do
134
135
  let(:settings_klass) { class_double('Settings').as_stubbed_const }
135
136
  before do
136
- allow(settings_klass).to receive(:METADATA_SHOWN).and_return %w(iso19139 mods)
137
+ allow(settings_klass).to receive(:METADATA_SHOWN).and_return %w[iso19139 mods]
137
138
  allow(settings_klass).to receive(:FIELDS).and_return OpenStruct.new(FILE_FORMAT: 'dc_format_s')
138
139
  end
139
140
  it 'is ordered by the configuration' do
@@ -166,8 +167,6 @@ describe Geoblacklight::References do
166
167
  end
167
168
  it 'returns nil if there is no direct download' do
168
169
  expect(typical_ogp_shapefile.preferred_download).to be_nil
169
- end
170
- it 'returns nil if there is no direct download' do
171
170
  expect(typical_ogp_geotiff.preferred_download).to be_nil
172
171
  end
173
172
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
 
3
4
  describe Geoblacklight::Relation::Ancestors do
@@ -7,7 +8,7 @@ describe Geoblacklight::Relation::Ancestors do
7
8
 
8
9
  describe '#create_search_params' do
9
10
  it 'assembles the correct search params for finding ancestor documents' do
10
- expect(ancestors.create_search_params).to eq(fq: ["{!join from=#{Settings.FIELDS.SOURCE} to=layer_slug_s}layer_slug_s:nyu_2451_34502"], fl: [Settings.FIELDS.TITLE.to_s, 'layer_slug_s'])
11
+ expect(ancestors.create_search_params).to eq(fq: ["{!join from=#{Settings.FIELDS.SOURCE} to=layer_slug_s}layer_slug_s:nyu_2451_34502"], fl: [Settings.FIELDS.TITLE.to_s, 'layer_slug_s', 'layer_geom_type_s'])
11
12
  end
12
13
  end
13
14
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
 
3
4
  describe Geoblacklight::Relation::Descendants do
@@ -7,7 +8,7 @@ describe Geoblacklight::Relation::Descendants do
7
8
 
8
9
  describe '#create_search_params' do
9
10
  it 'assembles the correct search params for finding descendant documents' do
10
- expect(descendants.create_search_params).to eq(fq: "#{Settings.FIELDS.SOURCE}:nyu_2451_34636", fl: [Settings.FIELDS.TITLE.to_s, 'layer_slug_s'])
11
+ expect(descendants.create_search_params).to eq(fq: "#{Settings.FIELDS.SOURCE}:nyu_2451_34636", fl: [Settings.FIELDS.TITLE.to_s, 'layer_slug_s', 'layer_geom_type_s'])
11
12
  end
12
13
  end
13
14
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
 
3
4
  describe Geoblacklight::Relation::RelationResponse do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
 
3
4
  describe Geoblacklight::ViewHelperOverride do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
 
3
4
  describe Geoblacklight::FeatureInfoResponse do
@@ -28,14 +29,14 @@ describe Geoblacklight::FeatureInfoResponse do
28
29
  it 'returns a formated response' do
29
30
  expect(response.format).not_to be_nil
30
31
  expect(response.format[:values].length).to eq 2
31
- expect(response.format[:values][0]).to eq %w(Header1 value1)
32
- expect(response.format[:values][1]).to eq %w(Header2 value2)
32
+ expect(response.format[:values][0]).to eq %w[Header1 value1]
33
+ expect(response.format[:values][1]).to eq %w[Header2 value2]
33
34
  end
34
35
  it 'returns a formated response when multiple features are retrieved' do
35
36
  expect(response_multiple_features.format).not_to be_nil
36
37
  expect(response_multiple_features.format[:values].length).to eq 2
37
- expect(response_multiple_features.format[:values][0]).to eq %w(Header1 value1)
38
- expect(response_multiple_features.format[:values][1]).to eq %w(Header2 value2)
38
+ expect(response_multiple_features.format[:values][0]).to eq %w[Header1 value1]
39
+ expect(response_multiple_features.format[:values][1]).to eq %w[Header2 value2]
39
40
  end
40
41
  end
41
42
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
 
3
4
  describe Geoblacklight::WmsLayer do
@@ -73,7 +74,7 @@ describe Geoblacklight::WmsLayer do
73
74
  context 'when the HTTP connection fails' do
74
75
  before do
75
76
  allow(Geoblacklight.logger).to receive(:error).with('#<Faraday::ConnectionFailed wrapped=#<StandardError: test connection error>>')
76
- allow(connection).to receive(:get).and_raise(Faraday::Error::ConnectionFailed.new(StandardError.new('test connection error')))
77
+ allow(connection).to receive(:get).and_raise(Faraday::ConnectionFailed.new(StandardError.new('test connection error')))
77
78
  end
78
79
 
79
80
  it 'logs the Faraday error' do
@@ -86,7 +87,7 @@ describe Geoblacklight::WmsLayer do
86
87
  context 'when the HTTP connection times out' do
87
88
  before do
88
89
  allow(Geoblacklight.logger).to receive(:error).with('#<Faraday::TimeoutError #<Faraday::TimeoutError: timeout>>')
89
- allow(connection).to receive(:get).and_raise(Faraday::Error::TimeoutError)
90
+ allow(connection).to receive(:get).and_raise(Faraday::TimeoutError)
90
91
  end
91
92
 
92
93
  it 'logs the Faraday error' do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
 
3
4
  describe Geoblacklight::SolrDocument::Carto do
@@ -38,24 +39,4 @@ describe Geoblacklight::SolrDocument::Carto do
38
39
  expect(document.carto_reference).to eq 'http://www.example.com/geojsonDownload'
39
40
  end
40
41
  end
41
-
42
- describe '#cartodb_reference' do
43
- before do
44
- allow(Deprecation).to receive(:warn).with(
45
- described_class,
46
- 'cartodb_reference is deprecated and will be removed from Geoblacklight 2.0.0 (use Geoblacklight::SolrDocument::Carto#carto_reference instead)',
47
- kind_of(Array)
48
- )
49
- allow(document).to receive(:public?).and_return(true)
50
- allow(document).to receive(:download_types).and_return(geojson: { 'stuff' => 'stuff' })
51
- allow(geojson_download)
52
- .to receive(:url_with_params)
53
- .and_return('http://www.example.com/geojsonDownload')
54
- end
55
-
56
- it 'aliases to #carto_reference' do
57
- expect(Deprecation).to receive(:warn)
58
- expect(document.cartodb_reference).to eq(document.carto_reference)
59
- end
60
- end
61
42
  end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+ require 'spec_helper'
3
+
4
+ describe Geoblacklight::SolrDocument::Citation do
5
+ describe '#geoblacklight_citation' do
6
+ let(:fixture) { JSON.parse(read_fixture('solr_documents/restricted-line.json')) }
7
+ let(:document) { SolrDocument.new(fixture) }
8
+
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'
12
+ end
13
+ end
14
+ end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
 
3
4
  describe Geoblacklight::SolrDocument::Finder do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
 
3
4
  describe Geoblacklight::SolrDocument::Inspection do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
 
3
4
  describe Geoblacklight::SolrDocument do
@@ -35,6 +36,32 @@ describe Geoblacklight::SolrDocument do
35
36
  expect(document.public?).to be_falsey
36
37
  end
37
38
  end
39
+ describe 'without rights data' do
40
+ let(:document_attributes) { {} }
41
+ it 'is not public' do
42
+ expect(document.public?).to be_falsey
43
+ end
44
+ end
45
+ end
46
+ describe '#restricted?' do
47
+ describe 'a restricted document' do
48
+ let(:document_attributes) { { rights_field => 'RESTRICTED' } }
49
+ it 'is restricted' do
50
+ expect(document.restricted?).to be_truthy
51
+ end
52
+ end
53
+ describe 'a non-restricted resource' do
54
+ let(:document_attributes) { { rights_field => 'PUBLIC' } }
55
+ it 'is not restricted' do
56
+ expect(document.restricted?).to be_falsey
57
+ end
58
+ end
59
+ describe 'without rights data' do
60
+ let(:document_attributes) { {} }
61
+ it 'is restricted' do
62
+ expect(document.restricted?).to be_truthy
63
+ end
64
+ end
38
65
  end
39
66
  describe '#downloadable?' do
40
67
  describe 'available direct download' do
@@ -1,10 +1,11 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
 
3
4
  describe Geoblacklight::SpatialSearchBehavior do
4
5
  subject { search_builder.with(user_params) }
5
6
 
6
- let(:user_params) { Hash.new }
7
- let(:solr_params) { Hash.new }
7
+ let(:user_params) { {} }
8
+ let(:solr_params) { {} }
8
9
  let(:blacklight_config) { CatalogController.blacklight_config.deep_copy }
9
10
  let(:context) { CatalogController.new }
10
11
  let(:search_builder_class) do
@@ -53,6 +54,18 @@ describe Geoblacklight::SpatialSearchBehavior do
53
54
  expect(subject.add_spatial_params(solr_params)).not_to have_key(:overlap)
54
55
  end
55
56
 
57
+ context 'when local boost parameter is present' do
58
+ before do
59
+ solr_params[:bf] = ['local_boost^5']
60
+ end
61
+
62
+ it 'appends overlap and includes the local boost' do
63
+ allow(Settings).to receive(:OVERLAP_RATIO_BOOST).and_return 2
64
+ expect(subject.add_spatial_params(solr_params)[:bf].to_s).to include('$overlap^2')
65
+ expect(solr_params[:bf].to_s).to include('local_boost^5')
66
+ end
67
+ end
68
+
56
69
  context 'when the wrong format for the bounding box is used' do
57
70
  before do
58
71
  allow(subject).to receive(:bounding_box).and_raise(Geoblacklight::Exceptions::WrongBoundingBoxFormat)
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
 
3
4
  describe 'Catalog Routes', type: :routing do
@@ -1,17 +1,19 @@
1
+ # frozen_string_literal: true
1
2
  ENV['RAILS_ENV'] ||= 'test'
2
3
 
3
4
  require 'simplecov'
4
- require 'coveralls'
5
- SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new(
6
- [
7
- SimpleCov::Formatter::HTMLFormatter,
8
- Coveralls::SimpleCov::Formatter
9
- ]
10
- )
5
+ SimpleCov.formatter = SimpleCov::Formatter::HTMLFormatter
6
+
7
+ if ENV['CIRCLE_ARTIFACTS']
8
+ dir = File.join(ENV['CIRCLE_ARTIFACTS'], 'coverage')
9
+ SimpleCov.coverage_dir(dir)
10
+ end
11
+
11
12
  SimpleCov.start 'rails' do
12
13
  add_filter 'lib/generators/geoblacklight/install_generator.rb'
13
14
  add_filter 'lib/geoblacklight/version.rb'
14
- add_filter 'lib/generators/geoblacklight/templates'
15
+ add_filter 'lib/generators'
16
+ add_filter 'lib/tasks/geoblacklight.rake'
15
17
  add_filter '/spec'
16
18
  add_filter '.internal_test_app/'
17
19
  end
@@ -26,6 +28,7 @@ require 'rails-controller-testing' if Rails::VERSION::MAJOR >= 5
26
28
  require 'rspec/rails'
27
29
  require 'capybara/rspec'
28
30
  require 'selenium-webdriver'
31
+ require 'webdrivers'
29
32
 
30
33
  Capybara.register_driver(:headless_chrome) do |app|
31
34
  Capybara::Selenium::Driver.load_selenium
@@ -56,7 +59,7 @@ FactoryBot.find_definitions
56
59
  RSpec.configure do |config|
57
60
  config.use_transactional_fixtures = false
58
61
 
59
- config.before :each do
62
+ config.before do
60
63
  DatabaseCleaner.strategy = if Capybara.current_driver == :rack_test
61
64
  :transaction
62
65
  else
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # Backport the Rails 5 controller test methods to Rails 4
2
3
  module BackportTestHelpers
3
4
  def delete(*args)
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require File.expand_path('../features/session_helpers.rb', __FILE__)
2
3
 
3
4
  RSpec.configure do |config|
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Features
2
3
  module SessionHelpers
3
4
  def sign_up_with(email, password)
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+ def read_fixture(fname)
3
+ File.read(File.join(fixture_dir, fname))
4
+ end
5
+
6
+ def fixture_dir
7
+ @fixture_dir ||= File.join(File.dirname(__FILE__), '../fixtures')
8
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+ require 'spec_helper'
3
+ require 'rake'
4
+ require 'fileutils'
5
+
6
+ describe 'geoblacklight.rake' do
7
+ describe 'geoblacklight:downloads:mkdir' do
8
+ before do
9
+ Rails.application.load_tasks
10
+ FileUtils.rm_rf Rails.root.join('tmp', 'cache', 'downloads')
11
+ end
12
+
13
+ it 'creates the tmp/cache/downloads directory' do
14
+ Rake::Task['geoblacklight:downloads:mkdir'].invoke
15
+ expect(File.directory?(Rails.root.join('tmp', 'cache', 'downloads')))
16
+ .to be true
17
+ end
18
+ end
19
+ end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  unless defined?(Rails)
2
3
  ENV['RAILS_ROOT'] = File.expand_path('../../', __FILE__)
3
4
  require File.expand_path('../../config/environment', __FILE__)
@@ -0,0 +1 @@
1
+ gem 'sprockets', '< 4'
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'rails/generators'
2
3
 
3
4
  class TestAppGenerator < Rails::Generators::Base
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
 
3
4
  describe 'catalog/_document_split.html.erb' do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
 
3
4
  describe 'catalog/_document_split.html.erb' do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
 
3
4
  describe 'catalog/_results_pagination.html.erb', type: :view do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
 
3
4
  describe 'catalog/_show_downloads.html.erb', type: :view do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'spec_helper'
2
3
 
3
4
  describe 'catalog/_show_tools.html.erb', type: :view do
@@ -6,11 +7,8 @@ describe 'catalog/_show_tools.html.erb', type: :view do
6
7
  let(:context) { Blacklight::Configuration::Context.new(controller) }
7
8
 
8
9
  before do
9
- assign :response, instance_double(Blacklight::Solr::Response, params: {})
10
10
  assign :document, document
11
11
  allow(view).to receive(:blacklight_config).and_return blacklight_config
12
- allow(view).to receive(:has_user_authentication_provider?).and_return false
13
-
14
12
  allow(view).to receive(:blacklight_configuration_context).and_return context
15
13
  end
16
14
 
@@ -18,7 +16,7 @@ describe 'catalog/_show_tools.html.erb', type: :view do
18
16
  let(:document_actions) { blacklight_config.show.document_actions }
19
17
 
20
18
  it 'renders a document action' do
21
- allow(view).to receive(:some_action_solr_document_path).with(document).and_return 'x'
19
+ allow(view).to receive(:some_action_solr_document_path).with(document, any_args).and_return 'x'
22
20
  document_actions[:some_action] = Blacklight::Configuration::ToolConfig.new partial: 'document_action'
23
21
  render partial: 'catalog/show_tools'
24
22
  expect(rendered).to have_link 'Some action', href: 'x'