geoblacklight 2.4.0 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +142 -0
- data/.gitignore +8 -0
- data/.rubocop.yml +24 -23
- data/.rubocop_todo.yml +398 -12
- data/README.md +3 -3
- data/Rakefile +13 -4
- data/app/assets/images/favicon.ico +0 -0
- data/app/assets/javascripts/geoblacklight/downloaders/downloader.js +1 -1
- data/app/assets/javascripts/geoblacklight/geoblacklight.js +18 -1
- data/app/assets/javascripts/geoblacklight/modules/bookmarks.js +43 -0
- data/app/assets/javascripts/geoblacklight/modules/metadata_download_button.js +6 -1
- data/app/assets/javascripts/geoblacklight/modules/results.js +7 -8
- data/app/assets/javascripts/geoblacklight/modules/svg_tooltips.js +31 -0
- data/app/assets/javascripts/geoblacklight/modules/util.js +5 -0
- data/app/assets/javascripts/geoblacklight/viewers/esri.js +3 -3
- data/app/assets/javascripts/geoblacklight/viewers/esri/tiled_map_layer.js +1 -1
- data/app/assets/javascripts/geoblacklight/viewers/index_map.js +1 -1
- data/app/assets/javascripts/geoblacklight/viewers/map.js +12 -2
- data/app/assets/javascripts/geoblacklight/viewers/tms.js +10 -0
- data/app/assets/javascripts/geoblacklight/viewers/wms.js +3 -3
- data/app/assets/stylesheets/geoblacklight/geoblacklight.scss +2 -0
- data/app/assets/stylesheets/geoblacklight/modules/_base.scss +33 -0
- data/app/assets/stylesheets/geoblacklight/{_blacklight_overrides.scss → modules/_blacklight_overrides.scss} +1 -1
- data/app/assets/stylesheets/geoblacklight/{_styles.scss → modules/_styles.scss} +1 -0
- data/app/assets/stylesheets/geoblacklight/modules/downloads.scss +37 -54
- data/app/assets/stylesheets/geoblacklight/modules/item.scss +1 -0
- data/app/assets/stylesheets/geoblacklight/modules/results.scss +17 -29
- data/app/assets/stylesheets/geoblacklight/modules/sidebar.scss +12 -42
- data/app/assets/stylesheets/geoblacklight/modules/toolbar.scss +17 -59
- data/app/controllers/download_controller.rb +12 -12
- data/app/controllers/relation_controller.rb +1 -0
- data/app/controllers/wms_controller.rb +1 -0
- data/app/helpers/arcgis_helper.rb +1 -0
- data/app/helpers/blacklight_helper.rb +1 -0
- data/app/helpers/carto_helper.rb +1 -0
- data/app/helpers/geoblacklight_helper.rb +37 -72
- data/app/models/concerns/geoblacklight/solr_document.rb +15 -19
- data/app/models/concerns/geoblacklight/solr_document/arcgis.rb +2 -1
- data/app/models/concerns/geoblacklight/solr_document/carto.rb +1 -13
- data/app/models/concerns/geoblacklight/solr_document/citation.rb +1 -0
- data/app/models/concerns/geoblacklight/solr_document/finder.rb +1 -0
- data/app/models/concerns/geoblacklight/solr_document/inspection.rb +2 -1
- data/app/models/concerns/geoblacklight/spatial_search_behavior.rb +6 -4
- data/app/presenters/geoblacklight/document_presenter.rb +2 -1
- data/app/views/catalog/_arcgis.html.erb +4 -0
- data/app/views/catalog/_carto.html.erb +4 -0
- data/app/views/catalog/_document_split.html.erb +1 -1
- data/app/views/catalog/_downloads_primary.html.erb +8 -1
- data/app/views/catalog/_header_icons.html.erb +3 -3
- data/app/views/catalog/_home_text.html.erb +3 -0
- data/app/views/catalog/_index_split_default.html.erb +21 -21
- data/app/views/catalog/_show_default_viewer_container.html.erb +1 -1
- data/app/views/download/hgl.html.erb +13 -11
- data/app/views/relation/_ancestors.html.erb +3 -6
- data/app/views/relation/_descendants.html.erb +4 -7
- data/app/views/relation/index.html.erb +20 -8
- data/app/views/relation/index.json.jbuilder +2 -1
- data/app/views/shared/_header_navbar.html.erb +0 -2
- data/babel.config.json +4 -0
- data/bin/coverage.rb +36 -0
- data/config/initializers/new_gbl_settings_defaults_3_3.yml +10 -0
- data/config/initializers/rails_config.rb +5 -0
- data/config/locales/geoblacklight.en.yml +7 -2
- data/geoblacklight.gemspec +7 -9
- data/jest.config.js +25 -0
- data/lib/generators/geoblacklight/assets_generator.rb +46 -0
- data/lib/generators/geoblacklight/install_generator.rb +4 -10
- data/lib/generators/geoblacklight/templates/assets/_blacklight.scss +1 -0
- data/lib/generators/geoblacklight/templates/assets/_customizations.scss +28 -0
- data/{app/assets/stylesheets/geoblacklight/application.scss → lib/generators/geoblacklight/templates/assets/_geoblacklight.scss} +0 -1
- data/lib/generators/geoblacklight/templates/assets/application.scss +7 -0
- data/lib/generators/geoblacklight/templates/{geoblacklight.js → assets/geoblacklight.js} +0 -0
- data/lib/generators/geoblacklight/templates/catalog_controller.rb +5 -3
- data/lib/generators/geoblacklight/templates/settings.yml +20 -17
- data/lib/generators/geoblacklight/webpacker_generator.rb +1 -0
- data/lib/geoblacklight.rb +2 -2
- data/lib/geoblacklight/bounding_box.rb +2 -1
- data/lib/geoblacklight/catalog_helper_override.rb +1 -0
- data/lib/geoblacklight/constants.rb +2 -0
- data/lib/geoblacklight/download.rb +2 -1
- data/lib/geoblacklight/download/geojson_download.rb +1 -0
- data/lib/geoblacklight/download/geotiff_download.rb +1 -0
- data/lib/geoblacklight/download/hgl_download.rb +1 -0
- data/lib/geoblacklight/download/kmz_download.rb +3 -2
- data/lib/geoblacklight/download/shapefile_download.rb +1 -0
- data/lib/geoblacklight/engine.rb +2 -2
- data/lib/geoblacklight/exceptions.rb +1 -0
- data/lib/geoblacklight/geoblacklight_helper_behavior.rb +1 -0
- data/lib/geoblacklight/geometry.rb +70 -0
- data/lib/geoblacklight/item_viewer.rb +6 -1
- data/lib/geoblacklight/metadata.rb +1 -0
- data/lib/geoblacklight/metadata/base.rb +2 -7
- data/lib/geoblacklight/metadata/fgdc.rb +1 -0
- data/lib/geoblacklight/metadata/html.rb +2 -2
- data/lib/geoblacklight/metadata/iso19139.rb +1 -0
- data/lib/geoblacklight/metadata_transformer.rb +1 -0
- data/lib/geoblacklight/metadata_transformer/base.rb +1 -0
- data/lib/geoblacklight/metadata_transformer/fgdc.rb +1 -0
- data/lib/geoblacklight/metadata_transformer/iso19139.rb +1 -0
- data/lib/geoblacklight/reference.rb +1 -0
- data/lib/geoblacklight/references.rb +7 -3
- data/lib/geoblacklight/relation/ancestors.rb +3 -2
- data/lib/geoblacklight/relation/descendants.rb +2 -1
- data/lib/geoblacklight/relation/relation_response.rb +2 -1
- data/lib/geoblacklight/routes.rb +1 -0
- data/lib/geoblacklight/routes/downloadable.rb +1 -0
- data/lib/geoblacklight/routes/exportable.rb +1 -0
- data/lib/geoblacklight/routes/wms.rb +1 -0
- data/lib/geoblacklight/version.rb +2 -1
- data/lib/geoblacklight/view_helper_override.rb +1 -0
- data/lib/geoblacklight/wms_layer.rb +2 -4
- data/lib/geoblacklight/wms_layer/feature_info_response.rb +1 -0
- data/lib/tasks/geoblacklight.rake +38 -32
- data/package.json +17 -1
- data/setupJest.js +14 -0
- data/solr/conf/schema.xml +1 -3
- data/spec/config/initializers/rails_config_spec.rb +14 -0
- data/spec/controllers/catalog_controller_spec.rb +7 -6
- data/spec/controllers/download_controller_spec.rb +1 -0
- data/spec/controllers/relation_controller_spec.rb +1 -0
- data/spec/controllers/wms_controller_spec.rb +1 -0
- data/spec/factories/user.rb +1 -0
- data/spec/features/bookmarks_spec.rb +1 -0
- data/spec/features/configurable_basemap_spec.rb +1 -0
- data/spec/features/data_dictionary_download_spec.rb +1 -0
- data/spec/features/download_layer_spec.rb +2 -1
- data/spec/features/empty_search_spec.rb +1 -0
- data/spec/features/esri_viewer_spec.rb +1 -5
- data/spec/features/exports_spec.rb +4 -12
- data/spec/features/help_text_spec.rb +1 -0
- data/spec/features/home_page_spec.rb +6 -0
- data/spec/features/iiif_viewer_spec.rb +1 -0
- data/spec/features/index_map_spec.rb +1 -0
- data/spec/features/layer_inspection_spec.rb +1 -0
- data/spec/features/layer_opacity_spec.rb +1 -0
- data/spec/features/layer_preview_spec.rb +1 -0
- data/spec/features/layer_with_no_references_spec.rb +1 -0
- data/spec/features/linkified_attribute_table_spec.rb +1 -0
- data/spec/features/metadata_panel_spec.rb +1 -0
- data/spec/features/missing_metadata_spec.rb +1 -0
- data/spec/features/multiple_downloads_spec.rb +15 -0
- data/spec/features/oembed_spec.rb +1 -0
- data/spec/features/relations_spec.rb +10 -29
- data/spec/features/saved_searches_spec.rb +1 -0
- data/spec/features/search_bar_spec.rb +1 -0
- data/spec/features/search_results_map_spec.rb +1 -6
- data/spec/features/search_results_overlap_ratio_spec.rb +6 -5
- data/spec/features/search_spec.rb +1 -0
- data/spec/features/show_page_metadata_spec.rb +1 -0
- data/spec/features/sms_spec.rb +1 -0
- data/spec/features/split_view.html.erb_spec.rb +3 -2
- data/spec/features/suppressed_records_spec.rb +1 -0
- data/spec/features/tms_spec.rb +10 -0
- data/spec/features/web_services_modal_spec.rb +1 -0
- data/spec/fixtures/solr_documents/multiple-downloads.json +30 -0
- data/spec/fixtures/solr_documents/public_iiif_princeton.json +1 -1
- data/spec/fixtures/solr_documents/tms.json +29 -0
- data/spec/helpers/arcgis_helper_spec.rb +1 -0
- data/spec/helpers/carto_helper_spec.rb +1 -0
- data/spec/helpers/geoblacklight_helper_spec.rb +73 -14
- data/spec/javascripts/geoblacklight_spec.js +0 -6
- data/spec/javascripts/metadata_download_button_spec.js +5 -3
- data/spec/javascripts/util_spec.js +2 -4
- data/spec/lib/geoblacklight/bounding_box_spec.rb +1 -0
- data/spec/lib/geoblacklight/document_presenter_spec.rb +3 -2
- data/spec/lib/geoblacklight/download/geojson_download_spec.rb +1 -0
- data/spec/lib/geoblacklight/download/geotiff_download_spec.rb +1 -0
- data/spec/lib/geoblacklight/download/hgl_download_spec.rb +1 -0
- data/spec/lib/geoblacklight/download/kmz_download_spec.rb +3 -2
- data/spec/lib/geoblacklight/download/shapefile_download_spec.rb +1 -0
- data/spec/lib/geoblacklight/download_spec.rb +3 -2
- data/spec/lib/geoblacklight/geoblacklight_helper_behavior_spec.rb +1 -0
- data/spec/lib/geoblacklight/geometry_spec.rb +48 -0
- data/spec/lib/geoblacklight/item_viewer_spec.rb +13 -0
- data/spec/lib/geoblacklight/metadata/base_spec.rb +1 -0
- data/spec/lib/geoblacklight/metadata/html_spec.rb +1 -0
- data/spec/lib/geoblacklight/metadata_spec.rb +1 -0
- data/spec/lib/geoblacklight/metadata_transformer/base_spec.rb +3 -2
- data/spec/lib/geoblacklight/metadata_transformer/fgdc_spec.rb +3 -2
- data/spec/lib/geoblacklight/metadata_transformer/iso19139_spec.rb +3 -2
- data/spec/lib/geoblacklight/metadata_transformer_spec.rb +4 -3
- data/spec/lib/geoblacklight/reference_spec.rb +1 -0
- data/spec/lib/geoblacklight/references_spec.rb +3 -4
- data/spec/lib/geoblacklight/relation/ancestors_spec.rb +2 -1
- data/spec/lib/geoblacklight/relation/descendants_spec.rb +2 -1
- data/spec/lib/geoblacklight/relation/relation_response_spec.rb +1 -0
- data/spec/lib/geoblacklight/view_helper_override_spec.rb +1 -0
- data/spec/lib/geoblacklight/wms_layer/feature_info_response_spec.rb +5 -4
- data/spec/lib/geoblacklight/wms_layer_spec.rb +1 -0
- data/spec/models/concerns/geoblacklight/solr_document/carto_spec.rb +1 -20
- data/spec/models/concerns/geoblacklight/solr_document/citation_spec.rb +1 -0
- data/spec/models/concerns/geoblacklight/solr_document/finder_spec.rb +1 -0
- data/spec/models/concerns/geoblacklight/solr_document/inspection_spec.rb +1 -0
- data/spec/models/concerns/geoblacklight/solr_document_spec.rb +1 -0
- data/spec/models/concerns/geoblacklight/spatial_search_behavior_spec.rb +15 -2
- data/spec/routing/catalog_routing_spec.rb +1 -0
- data/spec/spec_helper.rb +12 -9
- data/spec/support/backport_test_helpers.rb +1 -0
- data/spec/support/features.rb +1 -0
- data/spec/support/features/session_helpers.rb +1 -0
- data/spec/support/fixtures.rb +1 -0
- data/spec/tasks/geoblacklight_spec.rb +4 -3
- data/spec/test_app_templates/Gemfile.extra +1 -0
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +2 -8
- data/spec/views/catalog/_document_split.html.erb_spec.rb +2 -1
- data/spec/views/catalog/_index_split.html.erb_spec.rb +2 -1
- data/spec/views/catalog/_results_pagination.html.erb_spec.rb +1 -0
- data/spec/views/catalog/_show_downloads.html.erb_spec.rb +1 -0
- data/spec/views/catalog/_show_tools.html.erb_spec.rb +3 -5
- data/template.rb +4 -2
- metadata +74 -78
- data/.circleci/config.yml +0 -164
- data/app/assets/stylesheets/geoblacklight/_geoblacklight.scss +0 -36
- data/app/assets/stylesheets/geoblacklight/modules/relations.scss +0 -15
- data/app/views/catalog/_exports.html.erb +0 -3
- data/app/views/catalog/_show_tools.html.erb +0 -25
- data/lib/generators/geoblacklight/templates/geoblacklight.scss +0 -4
- data/spec/javascripts/spec_helper.js +0 -32
- data/spec/lib/geoblacklight/controller_override_spec.rb +0 -1
- data/spec/teaspoon_env.rb +0 -213
- data/vendor/assets/javascripts/readmore.js +0 -0
- data/vendor/assets/javascripts/readmore.min.js +0 -0
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require 'spec_helper'
|
2
3
|
|
3
4
|
describe Geoblacklight::ItemViewer do
|
@@ -25,6 +26,18 @@ describe Geoblacklight::ItemViewer do
|
|
25
26
|
expect(item_viewer.viewer_preference).to eq wms: 'http://www.example.com/wms'
|
26
27
|
end
|
27
28
|
end
|
29
|
+
describe 'for tms reference' do
|
30
|
+
let(:document_attributes) do
|
31
|
+
{
|
32
|
+
references_field => {
|
33
|
+
'https://wiki.osgeo.org/wiki/Tile_Map_Service_Specification' => 'http://www.example.com/tms'
|
34
|
+
}.to_json
|
35
|
+
}
|
36
|
+
end
|
37
|
+
it 'tms if tms is present' do
|
38
|
+
expect(item_viewer.viewer_preference).to eq tms: 'http://www.example.com/tms'
|
39
|
+
end
|
40
|
+
end
|
28
41
|
describe 'for iiif only reference' do
|
29
42
|
let(:document_attributes) do
|
30
43
|
{
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require 'spec_helper'
|
2
3
|
|
3
4
|
describe Geoblacklight::MetadataTransformer::Base do
|
@@ -8,8 +9,8 @@ describe Geoblacklight::MetadataTransformer::Base do
|
|
8
9
|
end
|
9
10
|
|
10
11
|
context 'with metadata types without XSL Stylesheets' do
|
11
|
-
let(:metadata) { instance_double(GeoCombine::Metadata) }
|
12
12
|
subject { described_class.new(metadata) }
|
13
|
+
let(:metadata) { instance_double(GeoCombine::Metadata) }
|
13
14
|
describe '#transform' do
|
14
15
|
before do
|
15
16
|
allow(metadata).to receive(:to_html).and_raise(NoMethodError, 'undefined method `to_html\'')
|
@@ -21,8 +22,8 @@ describe Geoblacklight::MetadataTransformer::Base do
|
|
21
22
|
end
|
22
23
|
|
23
24
|
context 'with metadata types with XSL Stylesheets but invalid HTML' do
|
24
|
-
let(:metadata) { instance_double(GeoCombine::Metadata) }
|
25
25
|
subject { described_class.new(metadata) }
|
26
|
+
let(:metadata) { instance_double(GeoCombine::Metadata) }
|
26
27
|
describe '#transform' do
|
27
28
|
before do
|
28
29
|
allow(metadata).to receive(:to_html).and_return('<invalid-html></invalid-html>')
|
@@ -1,11 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require 'spec_helper'
|
2
3
|
|
3
4
|
describe Geoblacklight::MetadataTransformer::Fgdc do
|
4
|
-
let(:fgdc_html) { File.read(File.join(Rails.root, 'spec', 'fixtures', 'metadata', 'fgdc.html')) }
|
5
|
-
let(:metadata) { instance_double('Geoblacklight::Metadata::Fgdc') }
|
6
5
|
subject do
|
7
6
|
described_class.new(metadata)
|
8
7
|
end
|
8
|
+
let(:fgdc_html) { File.read(Rails.root.join('spec', 'fixtures', 'metadata', 'fgdc.html')) }
|
9
|
+
let(:metadata) { instance_double('Geoblacklight::Metadata::Fgdc') }
|
9
10
|
|
10
11
|
describe '#transform' do
|
11
12
|
before do
|
@@ -1,11 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require 'spec_helper'
|
2
3
|
|
3
4
|
describe Geoblacklight::MetadataTransformer::Iso19139 do
|
4
|
-
let(:iso_html) { File.read(File.join(Rails.root, 'spec', 'fixtures', 'metadata', 'iso.html')) }
|
5
|
-
let(:metadata) { instance_double('Geoblacklight::Metadata::Iso19139') }
|
6
5
|
subject do
|
7
6
|
described_class.new(metadata)
|
8
7
|
end
|
8
|
+
let(:iso_html) { File.read(Rails.root.join('spec', 'fixtures', 'metadata', 'iso.html')) }
|
9
|
+
let(:metadata) { instance_double('Geoblacklight::Metadata::Iso19139') }
|
9
10
|
|
10
11
|
describe '#transform' do
|
11
12
|
before do
|
@@ -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::References do
|
@@ -75,7 +76,7 @@ describe Geoblacklight::References do
|
|
75
76
|
file_format_field => 'Raster',
|
76
77
|
references_field => {
|
77
78
|
'http://schema.org/url' => 'http://arks.princeton.edu/ark:/88435/02870w62c',
|
78
|
-
'http://iiif.io/api/image' => '
|
79
|
+
'http://iiif.io/api/image' => 'https://iiif-cloud.princeton.edu/iiif/2/6c%2F52%2F12%2F6c5212e81bc845f59bb1cdc740a88bad%2Fintermediate_file/info.json'
|
79
80
|
}.to_json
|
80
81
|
)
|
81
82
|
)
|
@@ -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
|
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
|
11
|
+
expect(ancestors.create_search_params).to eq(fq: ["{!join from=#{Settings.FIELDS.SOURCE} to=#{Settings.FIELDS.UNIQUE_KEY}}#{Settings.FIELDS.UNIQUE_KEY}:nyu_2451_34502"], fl: [Settings.FIELDS.TITLE.to_s, Settings.FIELDS.UNIQUE_KEY, Settings.FIELDS.GEOM_TYPE])
|
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,
|
11
|
+
expect(descendants.create_search_params).to eq(fq: "#{Settings.FIELDS.SOURCE}:nyu_2451_34636", fl: [Settings.FIELDS.TITLE.to_s, Settings.FIELDS.UNIQUE_KEY, Settings.FIELDS.GEOM_TYPE])
|
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::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
|
32
|
-
expect(response.format[:values][1]).to eq %w
|
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
|
38
|
-
expect(response_multiple_features.format[:values][1]).to eq %w
|
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::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
|
@@ -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) {
|
7
|
-
let(:solr_params) {
|
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)
|
data/spec/spec_helper.rb
CHANGED
@@ -1,17 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
ENV['RAILS_ENV'] ||= 'test'
|
2
3
|
|
3
4
|
require 'simplecov'
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
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
|
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
|
62
|
+
config.before do
|
60
63
|
DatabaseCleaner.strategy = if Capybara.current_driver == :rack_test
|
61
64
|
:transaction
|
62
65
|
else
|
data/spec/support/features.rb
CHANGED
data/spec/support/fixtures.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require 'spec_helper'
|
2
3
|
require 'rake'
|
3
4
|
require 'fileutils'
|
@@ -6,13 +7,13 @@ describe 'geoblacklight.rake' do
|
|
6
7
|
describe 'geoblacklight:downloads:mkdir' do
|
7
8
|
before do
|
8
9
|
Rails.application.load_tasks
|
9
|
-
FileUtils.rm_rf Rails.root.join('tmp
|
10
|
+
FileUtils.rm_rf Rails.root.join('tmp', 'cache', 'downloads')
|
10
11
|
end
|
11
12
|
|
12
13
|
it 'creates the tmp/cache/downloads directory' do
|
13
14
|
Rake::Task['geoblacklight:downloads:mkdir'].invoke
|
14
|
-
expect(File.directory?
|
15
|
-
to be true
|
15
|
+
expect(File.directory?(Rails.root.join('tmp', 'cache', 'downloads')))
|
16
|
+
.to be true
|
16
17
|
end
|
17
18
|
end
|
18
19
|
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require 'rails/generators'
|
2
3
|
|
3
4
|
class TestAppGenerator < Rails::Generators::Base
|
@@ -13,9 +14,7 @@ class TestAppGenerator < Rails::Generators::Base
|
|
13
14
|
|
14
15
|
def add_gems
|
15
16
|
gem 'blacklight'
|
16
|
-
gem '
|
17
|
-
gem 'teaspoon-jasmine'
|
18
|
-
gem 'webpacker'
|
17
|
+
gem 'webpacker' unless Rails.version.to_s.start_with? '6.1.'
|
19
18
|
Bundler.with_clean_env do
|
20
19
|
run 'bundle install'
|
21
20
|
end
|
@@ -41,9 +40,4 @@ class TestAppGenerator < Rails::Generators::Base
|
|
41
40
|
FileUtils.mkdir_p 'spec/fixtures/metadata'
|
42
41
|
directory 'metadata', 'spec/fixtures/metadata'
|
43
42
|
end
|
44
|
-
|
45
|
-
def install_teaspoon
|
46
|
-
# Implicit copy of GeoBlacklight checked-in teaspoon_env.rb
|
47
|
-
copy_file '../teaspoon_env.rb', 'spec/teaspoon_env.rb'
|
48
|
-
end
|
49
43
|
end
|