geoblacklight 0.11.1 → 0.12.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/.gitignore +1 -1
- data/.rubocop.yml +45 -0
- data/CONTRIBUTING.md +38 -0
- data/Gemfile +27 -6
- data/README.md +2 -9
- data/Rakefile +20 -11
- data/app/assets/javascripts/geoblacklight/basemaps.js +6 -3
- data/app/assets/javascripts/geoblacklight/modules/layer_opacity.js +13 -5
- data/app/assets/javascripts/geoblacklight/viewers/map.js +7 -0
- data/app/assets/javascripts/geoblacklight/viewers/wms.js +2 -5
- data/app/assets/stylesheets/geoblacklight/modules/item.scss +1 -1
- data/app/controllers/download_controller.rb +18 -14
- data/app/controllers/wms_controller.rb +1 -1
- data/app/helpers/geoblacklight_helper.rb +17 -11
- data/{lib → app/models/concerns}/geoblacklight/solr_document.rb +13 -8
- data/{lib → app/models/concerns}/geoblacklight/solr_document/carto_db.rb +0 -0
- data/{lib → app/models/concerns}/geoblacklight/solr_document/finder.rb +1 -2
- data/app/models/concerns/geoblacklight/solr_document/inspection.rb +15 -0
- data/{lib → app/presenters}/geoblacklight/document_presenter.rb +0 -0
- data/app/views/catalog/_show_default_viewer_container.html.erb +1 -1
- data/config/initializers/rails_config.rb +2 -2
- data/geoblacklight.gemspec +3 -4
- data/lib/generators/geoblacklight/install_generator.rb +17 -16
- data/lib/generators/geoblacklight/templates/catalog_controller.rb +1 -5
- data/lib/generators/geoblacklight/templates/geoblacklight.css.scss +0 -1
- data/lib/generators/geoblacklight/templates/geoblacklight.js +0 -1
- data/lib/geoblacklight.rb +1 -6
- data/lib/geoblacklight/bounding_box.rb +2 -1
- data/lib/geoblacklight/catalog_helper_override.rb +0 -1
- data/lib/geoblacklight/download.rb +12 -7
- data/lib/geoblacklight/download/hgl_download.rb +2 -3
- data/lib/geoblacklight/download/kmz_download.rb +9 -3
- data/lib/geoblacklight/download/shapefile_download.rb +5 -1
- data/lib/geoblacklight/engine.rb +1 -3
- data/lib/geoblacklight/exceptions.rb +1 -1
- data/lib/geoblacklight/metadata.rb +0 -1
- data/lib/geoblacklight/references.rb +3 -4
- data/lib/geoblacklight/routes.rb +5 -3
- data/lib/geoblacklight/search_builder.rb +3 -2
- data/lib/geoblacklight/version.rb +1 -1
- data/lib/geoblacklight/view_helper_override.rb +9 -10
- data/lib/geoblacklight/wms_layer.rb +12 -15
- data/lib/geoblacklight/wms_layer/feature_info_response.rb +1 -1
- data/spec/controllers/catalog_controller_spec.rb +1 -1
- data/spec/controllers/download_controller_spec.rb +7 -7
- data/spec/features/home_page_spec.rb +1 -1
- data/spec/features/layer_opacity_spec.rb +9 -0
- data/spec/features/metadata_panel_spec.rb +6 -4
- data/spec/features/saved_searches_spec.rb +1 -1
- data/spec/features/split_view.html.erb_spec.rb +3 -3
- data/spec/helpers/geoblacklight_helpers_spec.rb +3 -4
- data/spec/lib/geoblacklight/bounding_box_spec.rb +7 -7
- data/spec/lib/geoblacklight/controller_override_spec.rb +1 -1
- data/spec/lib/geoblacklight/document_presenter_spec.rb +1 -1
- data/spec/lib/geoblacklight/download/geojson_download_spec.rb +5 -5
- data/spec/lib/geoblacklight/download/geotiff_download_spec.rb +5 -5
- data/spec/lib/geoblacklight/download/hgl_download_spec.rb +6 -6
- data/spec/lib/geoblacklight/download/kmz_download_spec.rb +5 -5
- data/spec/lib/geoblacklight/download/shapefile_download_spec.rb +5 -5
- data/spec/lib/geoblacklight/download_spec.rb +14 -14
- data/spec/lib/geoblacklight/geoblacklight_helper_behavior_spec.rb +2 -1
- data/spec/lib/geoblacklight/item_viewer_spec.rb +5 -5
- data/spec/lib/geoblacklight/metadata_spec.rb +3 -3
- data/spec/lib/geoblacklight/reference_spec.rb +3 -3
- data/spec/lib/geoblacklight/references_spec.rb +34 -34
- data/spec/lib/geoblacklight/search_builder_spec.rb +7 -15
- data/spec/lib/geoblacklight/view_helper_override_spec.rb +15 -15
- data/spec/lib/geoblacklight/wms_layer/feature_info_response_spec.rb +10 -10
- data/spec/lib/geoblacklight/wms_layer_spec.rb +7 -7
- data/spec/{lib → models/concerns}/geoblacklight/solr_document/carto_db_spec.rb +0 -0
- data/spec/{lib → models/concerns}/geoblacklight/solr_document/finder_spec.rb +2 -2
- data/spec/models/concerns/geoblacklight/solr_document/inspection_spec.rb +16 -0
- data/spec/{lib → models/concerns}/geoblacklight/solr_document_spec.rb +24 -24
- data/spec/spec_helper.rb +6 -7
- data/spec/support/features.rb +1 -1
- data/spec/support/features/session_helpers.rb +1 -1
- data/spec/teaspoon_env.rb +38 -33
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +4 -4
- data/spec/views/catalog/_document_split.html.erb_spec.rb +1 -1
- data/spec/views/catalog/_index_split.html.erb_spec.rb +1 -1
- metadata +31 -33
- data/lib/geoblacklight/config.rb +0 -0
@@ -2,8 +2,9 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Geoblacklight::GeoblacklightHelperBehavior do
|
4
4
|
let(:dummy_class) do
|
5
|
-
Class.new
|
5
|
+
Class.new.extend(described_class)
|
6
6
|
end
|
7
|
+
|
7
8
|
describe '#wxs_identifier' do
|
8
9
|
it 'calls defined presenter class' do
|
9
10
|
expect(dummy_class).to receive(:presenter)
|
@@ -4,7 +4,7 @@ describe Geoblacklight::ItemViewer do
|
|
4
4
|
let(:document) { SolrDocument.new(document_attributes) }
|
5
5
|
let(:document_attributes) { {} }
|
6
6
|
let(:references) { document.references }
|
7
|
-
let(:item_viewer) {
|
7
|
+
let(:item_viewer) { described_class.new(references) }
|
8
8
|
describe 'viewer_preference' do
|
9
9
|
describe 'for no references' do
|
10
10
|
it 'returns nil' do
|
@@ -12,26 +12,26 @@ describe Geoblacklight::ItemViewer do
|
|
12
12
|
end
|
13
13
|
end
|
14
14
|
describe 'for wms reference' do
|
15
|
-
let(:document_attributes)
|
15
|
+
let(:document_attributes) do
|
16
16
|
{
|
17
17
|
dct_references_s: {
|
18
18
|
'http://www.opengis.net/def/serviceType/ogc/wms' => 'http://www.example.com/wms',
|
19
19
|
'http://iiif.io/api/image' => 'http://www.example.com/iiif'
|
20
20
|
}.to_json
|
21
21
|
}
|
22
|
-
|
22
|
+
end
|
23
23
|
it 'wms if wms is present' do
|
24
24
|
expect(item_viewer.viewer_preference).to eq wms: 'http://www.example.com/wms'
|
25
25
|
end
|
26
26
|
end
|
27
27
|
describe 'for iiif only reference' do
|
28
|
-
let(:document_attributes)
|
28
|
+
let(:document_attributes) do
|
29
29
|
{
|
30
30
|
dct_references_s: {
|
31
31
|
'http://iiif.io/api/image' => 'http://www.example.com/iiif'
|
32
32
|
}.to_json
|
33
33
|
}
|
34
|
-
|
34
|
+
end
|
35
35
|
it 'returns iiif' do
|
36
36
|
expect(item_viewer.viewer_preference).to eq iiif: 'http://www.example.com/iiif'
|
37
37
|
end
|
@@ -3,13 +3,13 @@ require 'spec_helper'
|
|
3
3
|
describe Geoblacklight::Metadata do
|
4
4
|
let(:response) { double('response') }
|
5
5
|
let(:get) { double('get') }
|
6
|
-
let(:opengeometadata)
|
7
|
-
|
6
|
+
let(:opengeometadata) do
|
7
|
+
described_class.new(
|
8
8
|
Geoblacklight::Reference.new(
|
9
9
|
['http://www.loc.gov/mods/v3', 'http://purl.stanford.edu/cg357zz0321.mods']
|
10
10
|
)
|
11
11
|
)
|
12
|
-
|
12
|
+
end
|
13
13
|
describe '#retrieve_metadata' do
|
14
14
|
it 'returns response from an endpoint url' do
|
15
15
|
expect(response).to receive(:get).and_return(get)
|
@@ -2,10 +2,10 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Geoblacklight::Reference do
|
4
4
|
let(:typical_reference) do
|
5
|
-
|
5
|
+
described_class.new(['http://www.opengis.net/def/serviceType/ogc/wms', 'http://hgl.harvard.edu:8080/geoserver/wms'])
|
6
6
|
end
|
7
7
|
let(:blank_reference) do
|
8
|
-
|
8
|
+
described_class.new([])
|
9
9
|
end
|
10
10
|
describe '#initialize' do
|
11
11
|
it 'instance variable reference is set' do
|
@@ -28,7 +28,7 @@ describe Geoblacklight::Reference do
|
|
28
28
|
end
|
29
29
|
describe '#to_hash' do
|
30
30
|
it 'creates a hash using type and endpoint' do
|
31
|
-
expect(typical_reference.to_hash).to eq :
|
31
|
+
expect(typical_reference.to_hash).to eq wms: 'http://hgl.harvard.edu:8080/geoserver/wms'
|
32
32
|
end
|
33
33
|
end
|
34
34
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Geoblacklight::References do
|
4
|
-
let(:typical_ogp_shapefile)
|
5
|
-
|
4
|
+
let(:typical_ogp_shapefile) do
|
5
|
+
described_class.new(
|
6
6
|
SolrDocument.new(
|
7
7
|
dc_format_s: 'Shapefile',
|
8
8
|
dct_references_s: {
|
@@ -11,17 +11,17 @@ describe Geoblacklight::References do
|
|
11
11
|
}.to_json
|
12
12
|
)
|
13
13
|
)
|
14
|
-
|
15
|
-
let(:no_service_shapefile)
|
16
|
-
|
14
|
+
end
|
15
|
+
let(:no_service_shapefile) do
|
16
|
+
described_class.new(
|
17
17
|
SolrDocument.new(
|
18
18
|
dc_format_s: 'Shapefile',
|
19
19
|
dct_references_s: {}.to_json
|
20
20
|
)
|
21
21
|
)
|
22
|
-
|
23
|
-
let(:typical_ogp_geotiff)
|
24
|
-
|
22
|
+
end
|
23
|
+
let(:typical_ogp_geotiff) do
|
24
|
+
described_class.new(
|
25
25
|
SolrDocument.new(
|
26
26
|
dc_format_s: 'GeoTIFF',
|
27
27
|
dct_references_s: {
|
@@ -30,9 +30,9 @@ describe Geoblacklight::References do
|
|
30
30
|
}.to_json
|
31
31
|
)
|
32
32
|
)
|
33
|
-
|
34
|
-
let(:typical_arcgrid)
|
35
|
-
|
33
|
+
end
|
34
|
+
let(:typical_arcgrid) do
|
35
|
+
described_class.new(
|
36
36
|
SolrDocument.new(
|
37
37
|
dc_format_s: 'ArcGRID',
|
38
38
|
dct_references_s: {
|
@@ -41,9 +41,9 @@ describe Geoblacklight::References do
|
|
41
41
|
}.to_json
|
42
42
|
)
|
43
43
|
)
|
44
|
-
|
45
|
-
let(:complex_shapefile)
|
46
|
-
|
44
|
+
end
|
45
|
+
let(:complex_shapefile) do
|
46
|
+
described_class.new(
|
47
47
|
SolrDocument.new(
|
48
48
|
dc_format_s: 'Shapefile',
|
49
49
|
dct_references_s: {
|
@@ -56,17 +56,17 @@ describe Geoblacklight::References do
|
|
56
56
|
}.to_json
|
57
57
|
)
|
58
58
|
)
|
59
|
-
|
60
|
-
let(:direct_download_only)
|
61
|
-
|
59
|
+
end
|
60
|
+
let(:direct_download_only) do
|
61
|
+
described_class.new(
|
62
62
|
dc_format_s: 'GeoTIFF',
|
63
63
|
dct_references_s: {
|
64
64
|
'http://schema.org/downloadUrl' => 'http://example.com/layer-id-geotiff.tiff'
|
65
65
|
}.to_json
|
66
66
|
)
|
67
|
-
|
68
|
-
let(:simple_iiif_image)
|
69
|
-
|
67
|
+
end
|
68
|
+
let(:simple_iiif_image) do
|
69
|
+
described_class.new(
|
70
70
|
SolrDocument.new(
|
71
71
|
dc_format_s: 'Raster',
|
72
72
|
dct_references_s: {
|
@@ -75,12 +75,12 @@ describe Geoblacklight::References do
|
|
75
75
|
}.to_json
|
76
76
|
)
|
77
77
|
)
|
78
|
-
|
79
|
-
let(:custom_fields)
|
80
|
-
|
78
|
+
end
|
79
|
+
let(:custom_fields) do
|
80
|
+
described_class.new(
|
81
81
|
SolrDocument.new, :new_ref_field
|
82
82
|
)
|
83
|
-
|
83
|
+
end
|
84
84
|
describe '#initialize' do
|
85
85
|
it 'parses dct_references_s to @refs' do
|
86
86
|
expect(typical_ogp_shapefile.instance_variable_get(:@refs)).to be_an Array
|
@@ -96,51 +96,51 @@ describe Geoblacklight::References do
|
|
96
96
|
end
|
97
97
|
end
|
98
98
|
describe 'format' do
|
99
|
-
it '
|
99
|
+
it 'returns format' do
|
100
100
|
expect(complex_shapefile.format).to eq 'Shapefile'
|
101
101
|
expect(direct_download_only.format).to eq 'GeoTIFF'
|
102
102
|
end
|
103
103
|
end
|
104
104
|
describe 'refs' do
|
105
|
-
it '
|
105
|
+
it 'is enumberable references' do
|
106
106
|
complex_shapefile.refs.each do |reference|
|
107
107
|
expect(reference).to be_an Geoblacklight::Reference
|
108
108
|
end
|
109
109
|
end
|
110
110
|
end
|
111
111
|
describe 'direct_download' do
|
112
|
-
it '
|
112
|
+
it 'returns the direct download link' do
|
113
113
|
download = complex_shapefile.download
|
114
114
|
expect(download).to be_an Geoblacklight::Reference
|
115
115
|
expect(download.endpoint).to eq('http://example.com/urn:hul.harvard.edu:HARVARD.SDE2.TG10USAIANNH/data.zip')
|
116
116
|
expect(direct_download_only.download.endpoint).to eq 'http://example.com/layer-id-geotiff.tiff'
|
117
117
|
end
|
118
|
-
it '
|
118
|
+
it 'does not return if download not available' do
|
119
119
|
expect(typical_ogp_shapefile.download).to be_nil
|
120
120
|
end
|
121
121
|
end
|
122
122
|
describe 'preferred_download' do
|
123
|
-
it '
|
123
|
+
it 'returns the direct download if available' do
|
124
124
|
expect(complex_shapefile.preferred_download[:file_download][:download]).to eq 'http://example.com/urn:hul.harvard.edu:HARVARD.SDE2.TG10USAIANNH/data.zip'
|
125
125
|
expect(direct_download_only.preferred_download[:file_download][:download]).to eq 'http://example.com/layer-id-geotiff.tiff'
|
126
126
|
end
|
127
|
-
it '
|
127
|
+
it 'returns nil if there is no direct download' do
|
128
128
|
expect(typical_ogp_shapefile.preferred_download).to be_nil
|
129
129
|
end
|
130
|
-
it '
|
130
|
+
it 'returns nil if there is no direct download' do
|
131
131
|
expect(typical_ogp_geotiff.preferred_download).to be_nil
|
132
132
|
end
|
133
133
|
end
|
134
134
|
describe 'download_types' do
|
135
|
-
it '
|
135
|
+
it 'returns available downloads by format' do
|
136
136
|
types = complex_shapefile.download_types
|
137
137
|
expect(types.first[1]).to eq wfs: 'http://hgl.harvard.edu:8080/geoserver/wfs'
|
138
138
|
expect(types.count).to eq 3
|
139
139
|
expect(direct_download_only.download_types).to be_nil
|
140
140
|
end
|
141
|
-
it '
|
141
|
+
it 'onlies return available downloads if no direct is present' do
|
142
142
|
types = typical_ogp_shapefile.download_types
|
143
|
-
expect(types.first[1]).to eq wfs:
|
143
|
+
expect(types.first[1]).to eq wfs: 'http://hgl.harvard.edu:8080/geoserver/wfs'
|
144
144
|
expect(types.count).to eq 3
|
145
145
|
end
|
146
146
|
end
|
@@ -11,31 +11,23 @@ describe Geoblacklight::SearchBuilder do
|
|
11
11
|
subject { search_builder.with(user_params) }
|
12
12
|
|
13
13
|
describe '#initialize' do
|
14
|
-
it '
|
15
|
-
correct_processor_chain = [:default_solr_parameters,
|
16
|
-
:add_query_to_solr,
|
17
|
-
:add_facet_fq_to_solr,
|
18
|
-
:add_facetting_to_solr,
|
19
|
-
:add_solr_fields_to_query,
|
20
|
-
:add_paging_to_solr,
|
21
|
-
:add_sorting_to_solr,
|
22
|
-
:add_group_config_to_solr,
|
23
|
-
:add_range_limit_params,
|
24
|
-
:add_spatial_params]
|
14
|
+
it 'has add_spatial_params in processor chain once' do
|
25
15
|
expect(subject.processor_chain).to include :add_spatial_params
|
26
|
-
expect(subject.processor_chain
|
16
|
+
expect(subject.processor_chain
|
17
|
+
.count { |x| x == :add_spatial_params }).to eq 1
|
27
18
|
new_search = described_class.new(subject.processor_chain, context)
|
28
19
|
expect(new_search.processor_chain).to include :add_spatial_params
|
29
|
-
expect(
|
20
|
+
expect(subject.processor_chain
|
21
|
+
.count { |x| x == :add_spatial_params }).to eq 1
|
30
22
|
end
|
31
23
|
end
|
32
24
|
|
33
25
|
describe '#add_spatial_params' do
|
34
|
-
it '
|
26
|
+
it 'returns the solr_params when no bbox is given' do
|
35
27
|
expect(subject.add_spatial_params(solr_params)).to eq solr_params
|
36
28
|
end
|
37
29
|
|
38
|
-
it '
|
30
|
+
it 'returns a spatial search if bbox is given' do
|
39
31
|
params = { bbox: '-180 -80 120 80' }
|
40
32
|
subject.with(params)
|
41
33
|
expect(subject.add_spatial_params(solr_params)[:fq].to_s).to include('Intersects')
|
@@ -5,32 +5,32 @@ describe Geoblacklight::ViewHelperOverride do
|
|
5
5
|
attr_accessor :params
|
6
6
|
end
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
let(:fake_controller) do
|
9
|
+
GeoblacklightControllerTestClass.new
|
10
|
+
.extend(described_class)
|
11
11
|
end
|
12
12
|
|
13
13
|
describe 'spatial_parameters?' do
|
14
|
-
it '
|
15
|
-
|
16
|
-
expect(
|
14
|
+
it 'does not have spatial parameters' do
|
15
|
+
fake_controller.params = {}
|
16
|
+
expect(fake_controller.spatial_parameters?).to be_falsey
|
17
17
|
end
|
18
|
-
it '
|
19
|
-
|
20
|
-
expect(
|
18
|
+
it 'has spatial parameters' do
|
19
|
+
fake_controller.params = { bbox: '123' }
|
20
|
+
expect(fake_controller.spatial_parameters?).to be_truthy
|
21
21
|
end
|
22
22
|
end
|
23
23
|
describe 'render_search_to_s_bbox' do
|
24
24
|
it 'returns an empty string for no bbox' do
|
25
|
-
|
26
|
-
expect(
|
25
|
+
fake_controller.params = {}
|
26
|
+
expect(fake_controller.render_search_to_s_bbox(fake_controller.params)).to eq ''
|
27
27
|
end
|
28
28
|
it 'returns render_search_to_s_element when bbox is present' do
|
29
|
-
|
29
|
+
fake_controller.params = { bbox: '123' }
|
30
30
|
params = { 'bbox' => '123' }
|
31
|
-
expect(
|
32
|
-
expect(
|
33
|
-
|
31
|
+
expect(fake_controller).to receive(:render_search_to_s_element)
|
32
|
+
expect(fake_controller).to receive(:render_filter_value)
|
33
|
+
fake_controller.render_search_to_s_bbox(params)
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
@@ -1,13 +1,13 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Geoblacklight::FeatureInfoResponse do
|
4
|
-
let(:response) {
|
5
|
-
let(:error_response) {
|
6
|
-
let(:content_response) {
|
4
|
+
let(:response) { described_class.new(OpenStruct.new(body: '<html><body><table><th>Header1</th><th>Header2</th><td>value1</td><td>value2</td></body></html>', headers: { 'content-type' => 'all good' })) }
|
5
|
+
let(:error_response) { described_class.new(error: 'bad stuff') }
|
6
|
+
let(:content_response) { described_class.new(OpenStruct.new(headers: { 'content-type' => 'text/xml' })) }
|
7
7
|
|
8
8
|
describe '#initialize' do
|
9
|
-
it '
|
10
|
-
expect(response).to be_an
|
9
|
+
it 'initializes as a FeatureInfoResponse type' do
|
10
|
+
expect(response).to be_an described_class
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
@@ -24,19 +24,19 @@ describe Geoblacklight::FeatureInfoResponse do
|
|
24
24
|
end
|
25
25
|
|
26
26
|
describe '#format' do
|
27
|
-
it '
|
27
|
+
it 'returns a formated response' do
|
28
28
|
expect(response.format).to_not be_nil
|
29
29
|
expect(response.format[:values].length).to eq 2
|
30
|
-
expect(response.format[:values][0]).to eq
|
31
|
-
expect(response.format[:values][1]).to eq
|
30
|
+
expect(response.format[:values][0]).to eq %w(Header1 value1)
|
31
|
+
expect(response.format[:values][1]).to eq %w(Header2 value2)
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
35
|
describe '#check' do
|
36
|
-
it '
|
36
|
+
it 'returns a formated response if no errors' do
|
37
37
|
expect(response.check).to eq response.format
|
38
38
|
end
|
39
|
-
it '
|
39
|
+
it 'returns the unformated response if there are errors' do
|
40
40
|
expect(error_response.check).to eq error_response.instance_variable_get('@response')
|
41
41
|
end
|
42
42
|
end
|
@@ -2,32 +2,32 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Geoblacklight::WmsLayer do
|
4
4
|
let(:params) { { 'URL' => 'http://www.example.com/', 'X' => '277' } }
|
5
|
-
let(:wms_layer) {
|
5
|
+
let(:wms_layer) { described_class.new(params) }
|
6
6
|
describe '#initialize' do
|
7
|
-
it '
|
8
|
-
expect(wms_layer).to be_an
|
7
|
+
it 'initializes as a WmsLayer object' do
|
8
|
+
expect(wms_layer).to be_an described_class
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
12
12
|
describe '#url' do
|
13
|
-
it '
|
13
|
+
it 'returns only URL parameter' do
|
14
14
|
expect(wms_layer.url).to eq 'http://www.example.com/'
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
18
|
describe '#search_params' do
|
19
|
-
it '
|
19
|
+
it 'returns all params except URL plus default params' do
|
20
20
|
expect(wms_layer.search_params.length).to eq 8
|
21
21
|
expect(wms_layer.search_params).to_not include 'URL' => 'http://www.example.com'
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
25
|
describe '#request_response' do
|
26
|
-
it '
|
26
|
+
it 'returns a Faraday object' do
|
27
27
|
faraday = double('faraday')
|
28
28
|
allow(faraday).to receive(:get)
|
29
29
|
expect(Faraday).to receive(:new).and_return(faraday)
|
30
|
-
|
30
|
+
described_class.new(params)
|
31
31
|
end
|
32
32
|
end
|
33
33
|
end
|
File without changes
|
@@ -14,8 +14,8 @@ describe Geoblacklight::SolrDocument::Finder do
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
describe '#index' do
|
17
|
-
it 'creates and returns a Blacklight::
|
18
|
-
expect(subject.index).to be_an Blacklight::
|
17
|
+
it 'creates and returns a Blacklight::Solr::Repository' do
|
18
|
+
expect(subject.index).to be_an Blacklight::Solr::Repository
|
19
19
|
end
|
20
20
|
end
|
21
21
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Geoblacklight::SolrDocument::Inspection do
|
4
|
+
let(:subject) { SolrDocument.new }
|
5
|
+
describe '#inspectable?' do
|
6
|
+
it 'returns true for wms viewer protocol' do
|
7
|
+
expect(subject).to receive(:viewer_protocol).and_return('wms')
|
8
|
+
expect(subject.inspectable?).to be_truthy
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'returns false for iiif viewer protocol' do
|
12
|
+
expect(subject).to receive(:viewer_protocol).and_return('iiif')
|
13
|
+
expect(subject.inspectable?).to be_falsy
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|