geo_concerns 0.0.3 → 0.0.4
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/app/actors/geo_concerns/actors/file_actor.rb +25 -0
- data/app/actors/geo_concerns/actors/file_set_actor.rb +9 -0
- data/app/controllers/concerns/geo_concerns/file_sets_controller_behavior.rb +3 -2
- data/app/helpers/geo_concerns/bounding_box_helper.rb +26 -0
- data/app/helpers/geo_concerns/geo_works_helper.rb +22 -0
- data/app/models/concerns/geo_concerns/external_metadata_file_behavior.rb +1 -1
- data/app/models/concerns/geo_concerns/file_set/derivatives.rb +5 -5
- data/app/models/concerns/geo_concerns/file_set_metadata.rb +15 -0
- data/app/models/concerns/geo_concerns/geo_file_format_behavior.rb +4 -4
- data/app/models/concerns/geo_concerns/geo_file_set_behavior.rb +1 -0
- data/app/presenters/geo_concerns/geo_concerns_show_presenter.rb +10 -11
- data/app/presenters/geo_concerns/image_work_show_presenter.rb +2 -14
- data/app/presenters/geo_concerns/raster_work_show_presenter.rb +2 -14
- data/app/presenters/geo_concerns/vector_work_show_presenter.rb +1 -6
- data/app/renderers/geo_concerns/coverage_renderer.rb +36 -0
- data/app/schemas/geo_concerns/file_set_metadata_required.rb +5 -0
- data/app/views/curation_concerns/file_sets/_form.html.erb +1 -1
- data/app/views/curation_concerns/image_works/show.html.erb +2 -3
- data/app/views/curation_concerns/raster_works/show.html.erb +2 -3
- data/app/views/curation_concerns/vector_works/show.html.erb +2 -1
- data/app/views/geo_concerns/_related_external_metadata_files.html.erb +2 -2
- data/app/views/{curation_concerns/image_works/_related_image_files.html.erb → geo_concerns/_related_geo_files.html.erb} +5 -5
- data/app/views/{curation_concerns/image_works/_members.html.erb → geo_concerns/_related_geo_works.html.erb} +8 -6
- data/geo_concerns.gemspec +1 -1
- data/lib/generators/geo_concerns/install_generator.rb +2 -2
- data/lib/generators/geo_concerns/templates/actors/curation_concerns/actors/image_work_actor.rb +6 -0
- data/lib/generators/geo_concerns/templates/actors/curation_concerns/actors/raster_work_actor.rb +6 -0
- data/lib/generators/geo_concerns/templates/actors/curation_concerns/actors/vector_work_actor.rb +6 -0
- data/lib/generators/geo_concerns/templates/jobs/characterize_job.rb +4 -3
- data/lib/geo_concerns/version.rb +1 -1
- data/spec/actors/geo_concerns/{file_actor_spec.rb → actors/file_actor_spec.rb} +3 -3
- data/spec/factories/external_metadata_files.rb +2 -2
- data/spec/factories/image_files.rb +5 -5
- data/spec/factories/image_works.rb +4 -3
- data/spec/factories/raster_files.rb +3 -3
- data/spec/factories/raster_works.rb +7 -5
- data/spec/factories/vector_files.rb +3 -3
- data/spec/factories/vector_works.rb +5 -4
- data/spec/features/create_raster_work_spec.rb +1 -1
- data/spec/helpers/bounding_box_helper_spec.rb +2 -2
- data/spec/helpers/geo_works_helper_spec.rb +30 -0
- data/spec/models/concerns/basic_geo_metadata_spec.rb +1 -1
- data/spec/models/concerns/geo_concerns/file_set/derivatives_spec.rb +7 -7
- data/spec/models/concerns/geo_concerns/file_set/geo_file_format_behavior_spec.rb +5 -5
- data/spec/models/external_metadata_file_spec.rb +8 -8
- data/spec/models/image_file_spec.rb +3 -3
- data/spec/models/image_work_spec.rb +5 -5
- data/spec/models/raster_file_spec.rb +3 -3
- data/spec/models/raster_work_spec.rb +9 -9
- data/spec/models/vector_file_spec.rb +3 -3
- data/spec/models/vector_work_spec.rb +7 -7
- data/spec/presenters/geo_concerns_show_presenter_spec.rb +5 -15
- data/spec/presenters/image_work_show_presenter_spec.rb +14 -15
- data/spec/presenters/raster_work_show_presenter_spec.rb +13 -13
- data/spec/presenters/vector_work_show_presenter_spec.rb +10 -10
- data/spec/renderers/{coverage_renderer_spec.rb → geo_concerns/coverage_renderer_spec.rb} +1 -1
- metadata +24 -22
- data/app/actors/geo_concerns/file_actor.rb +0 -20
- data/app/actors/geo_concerns/file_set_actor.rb +0 -7
- data/app/helpers/bounding_box_helper.rb +0 -24
- data/app/renderers/coverage_renderer.rb +0 -34
- data/app/views/curation_concerns/raster_works/_members.html.erb +0 -30
- data/app/views/curation_concerns/raster_works/_related_raster_files.html.erb +0 -24
- data/app/views/curation_concerns/vector_works/_related_vector_files.html.erb +0 -24
- data/lib/generators/geo_concerns/templates/actors/curation_concerns/image_work_actor.rb +0 -4
- data/lib/generators/geo_concerns/templates/actors/curation_concerns/raster_work_actor.rb +0 -4
- data/lib/generators/geo_concerns/templates/actors/curation_concerns/vector_work_actor.rb +0 -4
@@ -2,9 +2,9 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe FileSet do
|
4
4
|
let(:user) { create(:user) }
|
5
|
-
subject { described_class.new(
|
5
|
+
subject { described_class.new(geo_mime_type: 'application/xml; schema=iso19139') }
|
6
6
|
|
7
|
-
context "when
|
7
|
+
context "when geo_mime_type is a metadata format" do
|
8
8
|
it "responds as a metadata file" do
|
9
9
|
expect(subject.external_metadata_file?).to be_truthy
|
10
10
|
end
|
@@ -16,7 +16,7 @@ describe FileSet do
|
|
16
16
|
describe "to_solr" do
|
17
17
|
let(:solr_doc) { FactoryGirl.build(:external_metadata_file,
|
18
18
|
date_uploaded: Time.zone.today,
|
19
|
-
|
19
|
+
geo_mime_type: 'application/xml; schema=iso19139').to_solr
|
20
20
|
}
|
21
21
|
|
22
22
|
it "does not index bbox field" do
|
@@ -26,7 +26,7 @@ describe FileSet do
|
|
26
26
|
|
27
27
|
describe 'metadata' do
|
28
28
|
it 'has standard' do
|
29
|
-
expect(subject).to respond_to(:
|
29
|
+
expect(subject).to respond_to(:geo_mime_type)
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
@@ -38,26 +38,26 @@ describe FileSet do
|
|
38
38
|
it 'will route the extraction request for ISO' do
|
39
39
|
expect(subject).to receive(:original_file) { Hydra::PCDM::File.new }
|
40
40
|
expect(subject).to receive(:extract_iso19139_metadata)
|
41
|
-
subject.
|
41
|
+
subject.geo_mime_type = 'application/xml; schema=iso19139'
|
42
42
|
expect(subject.extract_metadata).to be_nil
|
43
43
|
end
|
44
44
|
|
45
45
|
it 'will route the extraction request for FGDC' do
|
46
46
|
expect(subject).to receive(:original_file) { Hydra::PCDM::File.new }
|
47
47
|
expect(subject).to receive(:extract_fgdc_metadata)
|
48
|
-
subject.
|
48
|
+
subject.geo_mime_type = 'application/xml; schema=fgdc'
|
49
49
|
expect(subject.extract_metadata).to be_nil
|
50
50
|
end
|
51
51
|
|
52
52
|
it 'will route the extraction request for MODS' do
|
53
53
|
expect(subject).to receive(:original_file) { Hydra::PCDM::File.new }
|
54
54
|
expect(subject).to receive(:extract_mods_metadata)
|
55
|
-
subject.
|
55
|
+
subject.geo_mime_type = 'application/mods+xml'
|
56
56
|
expect(subject.extract_metadata).to be_nil
|
57
57
|
end
|
58
58
|
|
59
59
|
it 'will not route the extraction request for bogus standard' do
|
60
|
-
subject.
|
60
|
+
subject.geo_mime_type = 'bogus'
|
61
61
|
expect { subject.extract_metadata }.to raise_error(ArgumentError)
|
62
62
|
end
|
63
63
|
|
@@ -2,9 +2,9 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe FileSet do
|
4
4
|
let(:user) { create(:user) }
|
5
|
-
subject { described_class.new(
|
5
|
+
subject { described_class.new(geo_mime_type: 'image/jpeg') }
|
6
6
|
|
7
|
-
context "when
|
7
|
+
context "when geo_mime_type is an image format" do
|
8
8
|
it "responds as an image file" do
|
9
9
|
expect(subject.image_file?).to be_truthy
|
10
10
|
end
|
@@ -42,7 +42,7 @@ describe FileSet do
|
|
42
42
|
end
|
43
43
|
|
44
44
|
it 'has standard' do
|
45
|
-
expect(subject).to respond_to(:
|
45
|
+
expect(subject).to respond_to(:geo_mime_type)
|
46
46
|
end
|
47
47
|
end
|
48
48
|
end
|
@@ -2,9 +2,9 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe ImageWork do
|
4
4
|
let(:user) { FactoryGirl.find_or_create(:jill) }
|
5
|
-
let(:image_file1) { FileSet.new(
|
6
|
-
let(:ext_metadata_file1) { FileSet.new(
|
7
|
-
let(:ext_metadata_file2) { FileSet.new(
|
5
|
+
let(:image_file1) { FileSet.new(geo_mime_type: 'image/jpeg') }
|
6
|
+
let(:ext_metadata_file1) { FileSet.new(geo_mime_type: 'application/xml; schema=iso19139') }
|
7
|
+
let(:ext_metadata_file2) { FileSet.new(geo_mime_type: 'application/xml; schema=iso19139') }
|
8
8
|
let(:raster1) { RasterWork.new }
|
9
9
|
let(:raster2) { RasterWork.new }
|
10
10
|
let(:coverage) { GeoConcerns::Coverage.new(43.039, -69.856, 42.943, -71.032) }
|
@@ -47,7 +47,7 @@ describe ImageWork do
|
|
47
47
|
subject { FactoryGirl.create(:image_work_with_raster_works, title: ['Test title 4'], coverage: coverage.to_s) }
|
48
48
|
|
49
49
|
it 'aggregates by raster resources' do
|
50
|
-
expect(subject.raster_works.size).to eq
|
50
|
+
expect(subject.raster_works.size).to eq 1
|
51
51
|
expect(subject.raster_works.first).to be_kind_of RasterWork
|
52
52
|
end
|
53
53
|
end
|
@@ -63,7 +63,7 @@ describe ImageWork do
|
|
63
63
|
it 'can perform extraction and set properties for ISO 19139' do
|
64
64
|
external_metadata_file = subject.metadata_files.first
|
65
65
|
allow(external_metadata_file).to receive(:metadata_xml) { doc }
|
66
|
-
allow(external_metadata_file).to receive(:
|
66
|
+
allow(external_metadata_file).to receive(:geo_mime_type) { 'application/xml; schema=iso19139' }
|
67
67
|
subject.populate_metadata
|
68
68
|
expect(subject.title).to eq(['S_566_1914_clip.tif'])
|
69
69
|
end
|
@@ -2,9 +2,9 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe FileSet do
|
4
4
|
let(:user) { create(:user) }
|
5
|
-
subject { described_class.new(
|
5
|
+
subject { described_class.new(geo_mime_type: 'image/tiff; gdal-format=GTiff') }
|
6
6
|
|
7
|
-
context "when
|
7
|
+
context "when geo_mime_type is a raster format" do
|
8
8
|
it "responds as a raster file" do
|
9
9
|
expect(subject.raster_file?).to be_truthy
|
10
10
|
end
|
@@ -42,7 +42,7 @@ describe FileSet do
|
|
42
42
|
end
|
43
43
|
|
44
44
|
it 'has standard' do
|
45
|
-
expect(subject).to respond_to(:
|
45
|
+
expect(subject).to respond_to(:geo_mime_type)
|
46
46
|
end
|
47
47
|
end
|
48
48
|
end
|
@@ -2,10 +2,10 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe RasterWork do
|
4
4
|
let(:user) { FactoryGirl.find_or_create(:jill) }
|
5
|
-
let(:raster_file1) { FileSet.new(
|
6
|
-
let(:raster_file2) { FileSet.new(
|
7
|
-
let(:ext_metadata_file1) { FileSet.new(
|
8
|
-
let(:ext_metadata_file2) { FileSet.new(
|
5
|
+
let(:raster_file1) { FileSet.new(geo_mime_type: 'image/tiff; gdal-format=GTiff') }
|
6
|
+
let(:raster_file2) { FileSet.new(geo_mime_type: 'image/tiff; gdal-format=GTiff') }
|
7
|
+
let(:ext_metadata_file1) { FileSet.new(geo_mime_type: 'application/xml; schema=iso19139') }
|
8
|
+
let(:ext_metadata_file2) { FileSet.new(geo_mime_type: 'application/xml; schema=iso19139') }
|
9
9
|
let(:vector1) { VectorWork.new }
|
10
10
|
let(:vector2) { VectorWork.new }
|
11
11
|
let(:coverage) { GeoConcerns::Coverage.new(43.039, -69.856, 42.943, -71.032) }
|
@@ -59,15 +59,15 @@ describe RasterWork do
|
|
59
59
|
|
60
60
|
it 'has two files' do
|
61
61
|
expect(subject.raster_files.size).to eq 2
|
62
|
-
expect(subject.raster_files.first.
|
62
|
+
expect(subject.raster_files.first.geo_mime_type).to eq 'image/tiff; gdal-format=GTiff'
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
66
66
|
context 'with vector feature extractions' do
|
67
|
-
subject { FactoryGirl.create(:
|
67
|
+
subject { FactoryGirl.create(:raster_work_with_vector_work) }
|
68
68
|
|
69
69
|
it 'aggregates vector data set resources' do
|
70
|
-
expect(subject.vector_works.size).to eq
|
70
|
+
expect(subject.vector_works.size).to eq 1
|
71
71
|
expect(subject.vector_works.first).to be_kind_of VectorWork
|
72
72
|
end
|
73
73
|
end
|
@@ -77,7 +77,7 @@ describe RasterWork do
|
|
77
77
|
|
78
78
|
it 'aggregates external metadata files' do
|
79
79
|
expect(subject.metadata_files.size).to eq 2
|
80
|
-
expect(subject.metadata_files.first.
|
80
|
+
expect(subject.metadata_files.first.geo_mime_type).to eq 'application/xml; schema=iso19139'
|
81
81
|
end
|
82
82
|
end
|
83
83
|
|
@@ -114,7 +114,7 @@ describe RasterWork do
|
|
114
114
|
it 'can perform extraction and set properties for ISO 19139' do
|
115
115
|
external_metadata_file = subject.metadata_files.first
|
116
116
|
allow(external_metadata_file).to receive(:metadata_xml).and_return(doc)
|
117
|
-
allow(external_metadata_file).to receive(:
|
117
|
+
allow(external_metadata_file).to receive(:geo_mime_type).and_return('application/xml; schema=iso19139')
|
118
118
|
subject.should_populate_metadata = 'true'
|
119
119
|
expect(subject.title).to eq(['S_566_1914_clip.tif'])
|
120
120
|
end
|
@@ -2,9 +2,9 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe FileSet do
|
4
4
|
let(:user) { create(:user) }
|
5
|
-
subject { described_class.new(
|
5
|
+
subject { described_class.new(geo_mime_type: 'application/zip; ogr-format="ESRI Shapefile"') }
|
6
6
|
|
7
|
-
context "when
|
7
|
+
context "when geo_mime_type is a vector format" do
|
8
8
|
it "responds as a vector file" do
|
9
9
|
expect(subject.vector_file?).to be_truthy
|
10
10
|
end
|
@@ -42,7 +42,7 @@ describe FileSet do
|
|
42
42
|
end
|
43
43
|
|
44
44
|
it 'has standard' do
|
45
|
-
expect(subject).to respond_to(:
|
45
|
+
expect(subject).to respond_to(:geo_mime_type)
|
46
46
|
end
|
47
47
|
end
|
48
48
|
end
|
@@ -2,10 +2,10 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe VectorWork do
|
4
4
|
let(:user) { FactoryGirl.find_or_create(:jill) }
|
5
|
-
let(:vector_file1) { FileSet.new(
|
6
|
-
let(:vector_file2) { FileSet.new(
|
7
|
-
let(:ext_metadata_file1) { FileSet.new(
|
8
|
-
let(:ext_metadata_file2) { FileSet.new(
|
5
|
+
let(:vector_file1) { FileSet.new(geo_mime_type: 'application/zip; ogr-format="ESRI Shapefile"') }
|
6
|
+
let(:vector_file2) { FileSet.new(geo_mime_type: 'application/zip; ogr-format="ESRI Shapefile"') }
|
7
|
+
let(:ext_metadata_file1) { FileSet.new(geo_mime_type: 'application/xml; schema=iso19139') }
|
8
|
+
let(:ext_metadata_file2) { FileSet.new(geo_mime_type: 'application/xml; schema=iso19139') }
|
9
9
|
let(:coverage) { GeoConcerns::Coverage.new(43.039, -69.856, 42.943, -71.032) }
|
10
10
|
|
11
11
|
describe 'with acceptable inputs' do
|
@@ -55,7 +55,7 @@ describe VectorWork do
|
|
55
55
|
|
56
56
|
it 'has two files' do
|
57
57
|
expect(subject.vector_files.size).to eq 2
|
58
|
-
expect(subject.vector_files.first.
|
58
|
+
expect(subject.vector_files.first.geo_mime_type).to eq 'application/zip; ogr-format="ESRI Shapefile"'
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
@@ -64,7 +64,7 @@ describe VectorWork do
|
|
64
64
|
|
65
65
|
it 'aggregates external metadata files' do
|
66
66
|
expect(subject.metadata_files.size).to eq 2
|
67
|
-
expect(subject.metadata_files.first.
|
67
|
+
expect(subject.metadata_files.first.geo_mime_type).to eq 'application/xml; schema=iso19139'
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
@@ -101,7 +101,7 @@ describe VectorWork do
|
|
101
101
|
it 'can perform extraction and set for ISO 19139' do
|
102
102
|
external_metadata_file = subject.metadata_files.first
|
103
103
|
allow(external_metadata_file).to receive(:metadata_xml) { doc }
|
104
|
-
allow(external_metadata_file).to receive(:
|
104
|
+
allow(external_metadata_file).to receive(:geo_mime_type) { 'application/xml; schema=iso19139' }
|
105
105
|
subject.populate_metadata
|
106
106
|
expect(subject.title).to eq(['S_566_1914_clip.tif'])
|
107
107
|
end
|
@@ -5,32 +5,22 @@ RSpec.describe ::GeoConcerns::GeoConcernsShowPresenter do
|
|
5
5
|
let(:ability) { nil }
|
6
6
|
|
7
7
|
describe "delegated methods" do
|
8
|
-
let(:attributes) { { "
|
8
|
+
let(:attributes) { { "geo_mime_type_tesim" => ['image/tiff; gdal-format=GTiff'] } }
|
9
9
|
subject { described_class.new(solr_document, ability) }
|
10
10
|
|
11
11
|
describe "#first" do
|
12
12
|
it "delegates to solr document" do
|
13
|
-
expect(subject.first('
|
13
|
+
expect(subject.first('geo_mime_type_tesim')).to eq('image/tiff; gdal-format=GTiff')
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
17
|
describe "#has?" do
|
18
18
|
it "delegates to solr document" do
|
19
|
-
expect(subject.has?('
|
19
|
+
expect(subject.has?('geo_mime_type_tesim')).to be_truthy
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
-
describe "#external_metadata_file_formats_presenters" do
|
25
|
-
let(:obj) { FactoryGirl.create(:raster_work_with_metadata_files) }
|
26
|
-
let(:attributes) { obj.to_solr }
|
27
|
-
subject { described_class.new(solr_document, ability) }
|
28
|
-
|
29
|
-
it "returns external_metadata_file_formats_presenters" do
|
30
|
-
expect(subject.external_metadata_file_formats_presenters.count).to eq 2
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
24
|
describe "#attribute_to_html" do
|
35
25
|
let(:attributes) { FactoryGirl.create(:raster_work).to_solr }
|
36
26
|
let(:attribute_renderer) { double('attribute_renderer') }
|
@@ -39,8 +29,8 @@ RSpec.describe ::GeoConcerns::GeoConcernsShowPresenter do
|
|
39
29
|
subject { described_class.new(solr_document, ability) }
|
40
30
|
|
41
31
|
before do
|
42
|
-
allow(CurationConcerns::AttributeRenderer).to receive(:new).and_return(attribute_renderer)
|
43
|
-
allow(CoverageRenderer).to receive(:new).and_return(coverage_renderer)
|
32
|
+
allow(CurationConcerns::Renderers::AttributeRenderer).to receive(:new).and_return(attribute_renderer)
|
33
|
+
allow(GeoConcerns::CoverageRenderer).to receive(:new).and_return(coverage_renderer)
|
44
34
|
end
|
45
35
|
|
46
36
|
it "uses a CoverageRenderer when the field is coverage" do
|
@@ -4,48 +4,47 @@ RSpec.describe GeoConcerns::ImageWorkShowPresenter do
|
|
4
4
|
let(:solr_document) { SolrDocument.new(attributes) }
|
5
5
|
let(:ability) { nil }
|
6
6
|
|
7
|
+
subject { described_class.new(solr_document, ability) }
|
8
|
+
|
7
9
|
describe "delegated methods" do
|
8
|
-
let(:attributes) { { "
|
9
|
-
subject { described_class.new(solr_document, ability) }
|
10
|
+
let(:attributes) { { "geo_mime_type_tesim" => ['image/tiff'] } }
|
10
11
|
|
11
12
|
describe "#first" do
|
12
13
|
it "delegates to solr document" do
|
13
|
-
expect(subject.first('
|
14
|
+
expect(subject.first('geo_mime_type_tesim')).to eq('image/tiff')
|
14
15
|
end
|
15
16
|
end
|
16
17
|
|
17
18
|
describe "#has?" do
|
18
19
|
it "delegates to solr document" do
|
19
|
-
expect(subject.has?('
|
20
|
+
expect(subject.has?('geo_mime_type_tesim')).to be_truthy
|
20
21
|
end
|
21
22
|
end
|
22
23
|
end
|
23
24
|
|
24
|
-
describe "#
|
25
|
+
describe "#work_presenters" do
|
25
26
|
let(:obj) { FactoryGirl.create(:image_work_with_raster_works) }
|
26
27
|
let(:attributes) { obj.to_solr }
|
27
|
-
subject { described_class.new(solr_document, ability) }
|
28
28
|
|
29
29
|
it "returns raster work presenters" do
|
30
|
-
expect(subject.
|
31
|
-
expect(subject.
|
30
|
+
expect(subject.work_presenters.count).to eq 1
|
31
|
+
expect(subject.work_presenters.first.first('has_model_ssim')).to eq "RasterWork"
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
35
|
describe "file presenters" do
|
36
36
|
let(:obj) { FactoryGirl.create(:image_work_with_files_and_metadata_files) }
|
37
37
|
let(:attributes) { obj.to_solr }
|
38
|
-
subject { described_class.new(solr_document, ability) }
|
39
38
|
|
40
|
-
describe "#
|
41
|
-
it "returns
|
42
|
-
expect(subject.
|
39
|
+
describe "#geo_file_set_presenters" do
|
40
|
+
it "returns image file presenters" do
|
41
|
+
expect(subject.geo_file_set_presenters.count).to eq 1
|
43
42
|
end
|
44
43
|
end
|
45
44
|
|
46
|
-
describe "#
|
47
|
-
it "returns only
|
48
|
-
expect(subject.
|
45
|
+
describe "#external_metadata_file_set_presenters" do
|
46
|
+
it "returns only external_metadata_file_set_presenters" do
|
47
|
+
expect(subject.external_metadata_file_set_presenters.count).to eq 1
|
49
48
|
end
|
50
49
|
end
|
51
50
|
end
|
@@ -5,30 +5,30 @@ RSpec.describe GeoConcerns::RasterWorkShowPresenter do
|
|
5
5
|
let(:ability) { nil }
|
6
6
|
|
7
7
|
describe "delegated methods" do
|
8
|
-
let(:attributes) { { "
|
8
|
+
let(:attributes) { { "geo_mime_type_tesim" => ['image/tiff; gdal-format=GTiff'] } }
|
9
9
|
subject { described_class.new(solr_document, ability) }
|
10
10
|
|
11
11
|
describe "#first" do
|
12
12
|
it "delegates to solr document" do
|
13
|
-
expect(subject.first('
|
13
|
+
expect(subject.first('geo_mime_type_tesim')).to eq('image/tiff; gdal-format=GTiff')
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
17
|
describe "#has?" do
|
18
18
|
it "delegates to solr document" do
|
19
|
-
expect(subject.has?('
|
19
|
+
expect(subject.has?('geo_mime_type_tesim')).to be_truthy
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
-
describe "#
|
25
|
-
let(:obj) { FactoryGirl.create(:
|
24
|
+
describe "#work_presenters" do
|
25
|
+
let(:obj) { FactoryGirl.create(:raster_work_with_vector_work) }
|
26
26
|
let(:attributes) { obj.to_solr }
|
27
27
|
subject { described_class.new(solr_document, ability) }
|
28
28
|
|
29
29
|
it "returns vector work presenters" do
|
30
|
-
expect(subject.
|
31
|
-
expect(subject.
|
30
|
+
expect(subject.work_presenters.count).to eq 1
|
31
|
+
expect(subject.work_presenters.first.first('has_model_ssim')).to eq "VectorWork"
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
@@ -37,15 +37,15 @@ RSpec.describe GeoConcerns::RasterWorkShowPresenter do
|
|
37
37
|
let(:attributes) { obj.to_solr }
|
38
38
|
subject { described_class.new(solr_document, ability) }
|
39
39
|
|
40
|
-
describe "#
|
41
|
-
it "returns only
|
42
|
-
expect(subject.
|
40
|
+
describe "#geo_file_set_presenters" do
|
41
|
+
it "returns only raster file presenters" do
|
42
|
+
expect(subject.geo_file_set_presenters.count).to eq 1
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
|
-
describe "#
|
47
|
-
it "returns only
|
48
|
-
expect(subject.
|
46
|
+
describe "#external_metadata_file_set_presenters" do
|
47
|
+
it "returns only external_metadata_file_set_presenters" do
|
48
|
+
expect(subject.external_metadata_file_set_presenters.count).to eq 1
|
49
49
|
end
|
50
50
|
end
|
51
51
|
end
|
@@ -5,36 +5,36 @@ RSpec.describe ::GeoConcerns::VectorWorkShowPresenter do
|
|
5
5
|
let(:ability) { nil }
|
6
6
|
|
7
7
|
describe "delegated methods" do
|
8
|
-
let(:attributes) { { "
|
8
|
+
let(:attributes) { { "geo_mime_type_tesim" => ['application/zip; ogr-format="ESRI Shapefile"'] } }
|
9
9
|
subject { described_class.new(solr_document, ability) }
|
10
10
|
|
11
11
|
describe "#first" do
|
12
12
|
it "delegates to solr document" do
|
13
|
-
expect(subject.first('
|
13
|
+
expect(subject.first('geo_mime_type_tesim')).to eq('application/zip; ogr-format="ESRI Shapefile"')
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
17
|
describe "#has?" do
|
18
18
|
it "delegates to solr document" do
|
19
|
-
expect(subject.has?('
|
19
|
+
expect(subject.has?('geo_mime_type_tesim')).to be_truthy
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
24
|
describe "file presenters" do
|
25
|
-
let(:obj) { FactoryGirl.create(:
|
25
|
+
let(:obj) { FactoryGirl.create(:vector_work_with_vector_and_metadata_file) }
|
26
26
|
let(:attributes) { obj.to_solr }
|
27
27
|
subject { described_class.new(solr_document, ability) }
|
28
28
|
|
29
|
-
describe "#
|
30
|
-
it "returns only vector file presenters" do
|
31
|
-
expect(subject.
|
29
|
+
describe "#geo_file_set_presenters" do
|
30
|
+
it "returns only vector file set presenters" do
|
31
|
+
expect(subject.geo_file_set_presenters.count).to eq 1
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
-
describe "#
|
36
|
-
it "returns only
|
37
|
-
expect(subject.
|
35
|
+
describe "#external_metadata_file_set_presenters" do
|
36
|
+
it "returns only external_metadata_file_set_presenters" do
|
37
|
+
expect(subject.external_metadata_file_set_presenters.count).to eq 1
|
38
38
|
end
|
39
39
|
end
|
40
40
|
end
|