curation_concerns 1.4.0 → 1.5.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 -0
- data/.travis.yml +2 -0
- data/Gemfile +4 -0
- data/Rakefile +2 -2
- data/app/actors/curation_concerns/actors/file_actor.rb +2 -3
- data/app/assets/javascripts/curation_concerns/file_manager.es6 +32 -1
- data/app/assets/javascripts/curation_concerns/file_manager/member.es6 +6 -0
- data/app/assets/stylesheets/curation_concerns/_positioning.scss +3 -2
- data/app/assets/stylesheets/curation_concerns/modules/file_manager.scss +14 -0
- data/app/controllers/concerns/curation_concerns/curation_concern_controller.rb +3 -3
- data/app/controllers/concerns/curation_concerns/single_use_links_controller_behavior.rb +2 -2
- data/app/indexers/curation_concerns/admin_set_indexer.rb +13 -0
- data/app/indexers/curation_concerns/file_set_indexer.rb +5 -0
- data/app/indexers/curation_concerns/work_indexer.rb +3 -0
- data/app/models/admin_set.rb +3 -0
- data/app/models/concerns/curation_concerns/admin_set_behavior.rb +29 -0
- data/app/models/concerns/curation_concerns/file_set/characterization.rb +2 -1
- data/app/models/concerns/curation_concerns/in_admin_set.rb +9 -0
- data/app/models/concerns/curation_concerns/publishable.rb +19 -0
- data/app/models/concerns/curation_concerns/solr_behavior/characterization.rb +106 -0
- data/app/models/concerns/curation_concerns/solr_document_behavior.rb +5 -0
- data/app/models/concerns/curation_concerns/work_behavior.rb +2 -0
- data/app/models/curation_concerns/state_workflow.rb +13 -0
- data/app/models/vocab/fedora_resource_status.rb +6 -0
- data/app/presenters/curation_concerns/characterization_behavior.rb +84 -0
- data/app/presenters/curation_concerns/file_set_presenter.rb +1 -0
- data/app/presenters/curation_concerns/work_show_presenter.rb +1 -1
- data/app/search_builders/curation_concerns/admin_set_search_builder.rb +22 -0
- data/app/services/curation_concerns/admin_set_service.rb +26 -0
- data/app/services/curation_concerns/indexes_thumbnails.rb +1 -0
- data/app/services/curation_concerns/license_service.rb +8 -0
- data/app/services/curation_concerns/qa_select_service.rb +33 -0
- data/app/services/curation_concerns/rights_statements.rb +8 -0
- data/app/services/rights_service.rb +9 -2
- data/app/views/collections/_button_create_collection.html.erb +1 -1
- data/app/views/collections/_button_for_update_collection.html.erb +1 -1
- data/app/views/curation_concerns/base/_file_manager_actions.html.erb +1 -0
- data/app/views/curation_concerns/base/_file_manager_member.html.erb +24 -23
- data/app/views/curation_concerns/base/_file_manager_member_resource_options.html.erb +6 -0
- data/app/views/curation_concerns/base/_file_manager_resource_form.html.erb +5 -0
- data/app/views/curation_concerns/base/_form_rights.html.erb +1 -1
- data/app/views/curation_concerns/file_sets/media_display/_default.html.erb +18 -9
- data/app/views/curation_concerns/file_sets/media_display/_image.html.erb +18 -13
- data/app/views/curation_concerns/file_sets/media_display/_office_document.html.erb +18 -13
- data/app/views/curation_concerns/file_sets/media_display/_pdf.html.erb +18 -13
- data/config/locales/curation_concerns.en.yml +6 -0
- data/curation_concerns.gemspec +2 -2
- data/lib/curation_concerns/version.rb +1 -1
- data/lib/generators/curation_concerns/install_generator.rb +6 -9
- data/lib/generators/curation_concerns/templates/config/authorities/{rights.yml → licenses.yml} +0 -0
- data/lib/generators/curation_concerns/templates/config/authorities/rights_statements.yml +37 -0
- data/spec/abilities/admin_set_abilities_spec.rb +15 -0
- data/spec/actors/curation_concerns/file_actor_spec.rb +1 -2
- data/spec/controllers/catalog_controller_spec.rb +9 -11
- data/spec/controllers/curation_concerns/classify_concerns_controller_spec.rb +2 -2
- data/spec/controllers/curation_concerns/collections_controller_spec.rb +39 -33
- data/spec/controllers/curation_concerns/file_sets_controller_json_spec.rb +10 -10
- data/spec/controllers/curation_concerns/file_sets_controller_spec.rb +54 -35
- data/spec/controllers/curation_concerns/generic_works_controller_json_spec.rb +6 -6
- data/spec/controllers/curation_concerns/generic_works_controller_spec.rb +30 -35
- data/spec/controllers/curation_concerns/operations_controller_spec.rb +2 -2
- data/spec/controllers/curation_concerns/permissions_controller_spec.rb +2 -2
- data/spec/controllers/curation_concerns/single_use_links_controller_spec.rb +10 -10
- data/spec/controllers/curation_concerns/single_use_links_viewer_controller_spec.rb +7 -12
- data/spec/controllers/downloads_controller_spec.rb +15 -19
- data/spec/controllers/embargoes_controller_spec.rb +6 -6
- data/spec/controllers/leases_controller_spec.rb +6 -6
- data/spec/factories/admin_sets.rb +9 -0
- data/spec/indexers/file_set_indexer_spec.rb +11 -2
- data/spec/indexers/work_indexer_spec.rb +41 -20
- data/spec/models/admin_set_spec.rb +78 -0
- data/spec/models/curation_concerns/file_set/characterization_spec.rb +1 -1
- data/spec/models/file_set_spec.rb +4 -1
- data/spec/models/generic_work_spec.rb +24 -1
- data/spec/models/solr_document_spec.rb +30 -0
- data/spec/presenters/curation_concerns/file_set_presenter_spec.rb +131 -6
- data/spec/renderers/curation_concerns/renderers/attribute_renderer_spec.rb +1 -4
- data/spec/search_builders/curation_concerns/admin_set_search_builder_spec.rb +17 -0
- data/spec/services/curation_concerns/admin_set_service_spec.rb +37 -0
- data/spec/services/curation_concerns/license_service_spec.rb +36 -0
- data/spec/services/curation_concerns/rights_statements_spec.rb +11 -0
- data/spec/services/rights_service_spec.rb +2 -0
- data/spec/spec_helper.rb +44 -0
- data/spec/support/backport_test.rb +14 -0
- data/spec/support/curation_concerns/factory_helpers.rb +3 -1
- data/spec/test_app_templates/Gemfile.extra +0 -2
- data/spec/views/curation_concerns/base/file_manager.html.erb_spec.rb +13 -1
- data/spec/views/curation_concerns/file_sets/show.html.erb_spec.rb +8 -8
- metadata +40 -7
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
RSpec.describe AdminSet, type: :model do
|
|
4
|
+
let(:gf1) { create(:generic_work, user: user) }
|
|
5
|
+
let(:gf2) { create(:generic_work, user: user) }
|
|
6
|
+
let(:gf3) { create(:generic_work, user: user) }
|
|
7
|
+
|
|
8
|
+
let(:user) { create(:user) }
|
|
9
|
+
|
|
10
|
+
before do
|
|
11
|
+
subject.title = ['Some title']
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
describe "#to_solr" do
|
|
15
|
+
let(:admin_set) { build(:admin_set, title: ['A good title']) }
|
|
16
|
+
let(:solr_document) { admin_set.to_solr }
|
|
17
|
+
|
|
18
|
+
it "has title information" do
|
|
19
|
+
expect(solr_document).to include 'title_tesim' => ['A good title'],
|
|
20
|
+
'title_sim' => ['A good title']
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
describe "#members" do
|
|
25
|
+
it "is empty by default" do
|
|
26
|
+
expect(subject.members).to be_empty
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
context "adding members" do
|
|
30
|
+
context "using assignment" do
|
|
31
|
+
subject { described_class.create!(title: ['Some title'], members: [gf1, gf2]) }
|
|
32
|
+
|
|
33
|
+
it "has many files" do
|
|
34
|
+
expect(subject.reload.members).to match_array [gf1, gf2]
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
context "using append" do
|
|
39
|
+
before do
|
|
40
|
+
subject.members = [gf1]
|
|
41
|
+
subject.save
|
|
42
|
+
end
|
|
43
|
+
it "allows new files to be added" do
|
|
44
|
+
subject.reload
|
|
45
|
+
subject.members << gf2
|
|
46
|
+
subject.save
|
|
47
|
+
expect(subject.reload.members).to match_array [gf1, gf2]
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
it "has a title" do
|
|
54
|
+
subject.title = ["title"]
|
|
55
|
+
subject.save
|
|
56
|
+
expect(subject.reload.title).to eq ["title"]
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
it "has a description" do
|
|
60
|
+
subject.title = ["title"]
|
|
61
|
+
subject.description = ["description"]
|
|
62
|
+
subject.save
|
|
63
|
+
expect(subject.reload.description).to eq ["description"]
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
describe "#destroy" do
|
|
67
|
+
before do
|
|
68
|
+
subject.members = [gf1, gf2]
|
|
69
|
+
subject.save
|
|
70
|
+
subject.destroy
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
it "does not delete member files when deleted" do
|
|
74
|
+
expect(GenericWork.exists?(gf1.id)).to be true
|
|
75
|
+
expect(GenericWork.exists?(gf2.id)).to be true
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
end
|
|
@@ -16,7 +16,7 @@ describe CurationConcerns::FileSet do
|
|
|
16
16
|
describe '::characterization_terms' do
|
|
17
17
|
subject { file_set.class.characterization_terms }
|
|
18
18
|
it { is_expected.to contain_exactly(:format_label, :file_size, :height, :width, :filename, :well_formed,
|
|
19
|
-
:page_count, :file_title, :last_modified, :original_checksum, :mime_type) }
|
|
19
|
+
:page_count, :file_title, :last_modified, :original_checksum, :mime_type, :duration, :sample_rate) }
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
describe 'characterization_proxy' do
|
|
@@ -68,7 +68,8 @@ describe FileSet do
|
|
|
68
68
|
{ type: 'group', access: 'read', name: 'group2' },
|
|
69
69
|
{ type: 'person', access: 'read', name: 'user2' },
|
|
70
70
|
{ type: 'person', access: 'read', name: 'user3' },
|
|
71
|
-
{ type: 'person', access: 'edit', name: 'user1' }
|
|
71
|
+
{ type: 'person', access: 'edit', name: 'user1' }
|
|
72
|
+
]
|
|
72
73
|
end
|
|
73
74
|
|
|
74
75
|
it "has attached content" do
|
|
@@ -107,6 +108,8 @@ describe FileSet do
|
|
|
107
108
|
expect(subject).to respond_to(:well_formed)
|
|
108
109
|
expect(subject).to respond_to(:page_count)
|
|
109
110
|
expect(subject).to respond_to(:file_title)
|
|
111
|
+
expect(subject).to respond_to(:duration)
|
|
112
|
+
expect(subject).to respond_to(:sample_rate)
|
|
110
113
|
# :creator is characterization metadata?
|
|
111
114
|
expect(subject).to respond_to(:creator)
|
|
112
115
|
end
|
|
@@ -14,6 +14,28 @@ describe GenericWork do
|
|
|
14
14
|
it { is_expected.to eq 'curation_concerns_generic_work' }
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
+
describe '#state' do
|
|
18
|
+
let(:work) { described_class.new(state: inactive) }
|
|
19
|
+
let(:inactive) { ::RDF::URI('http://fedora.info/definitions/1/0/access/ObjState#inactive') }
|
|
20
|
+
subject { work.state.rdf_subject }
|
|
21
|
+
it { is_expected.to eq inactive }
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
describe '#suppressed?' do
|
|
25
|
+
let(:work) { described_class.new(state: state) }
|
|
26
|
+
subject { work.suppressed? }
|
|
27
|
+
|
|
28
|
+
context "when the state is 'pending'" do
|
|
29
|
+
let(:state) { 'pending' }
|
|
30
|
+
it { is_expected.to be true }
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
context "when the state is something else" do
|
|
34
|
+
let(:state) { ::RDF::URI('http://fedora.info/definitions/1/0/access/ObjState#active') }
|
|
35
|
+
it { is_expected.to be false }
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
17
39
|
describe '.valid_child_concerns' do
|
|
18
40
|
it "is all registered curation concerns by default" do
|
|
19
41
|
expect(described_class.valid_child_concerns).to eq [described_class]
|
|
@@ -41,7 +63,8 @@ describe GenericWork do
|
|
|
41
63
|
end
|
|
42
64
|
|
|
43
65
|
describe 'to_solr' do
|
|
44
|
-
|
|
66
|
+
let(:work) { build(:work, date_uploaded: Date.today) }
|
|
67
|
+
subject { work.to_solr }
|
|
45
68
|
|
|
46
69
|
it 'indexes some fields' do
|
|
47
70
|
expect(subject.keys).to include 'date_uploaded_dtsi'
|
|
@@ -16,6 +16,12 @@ describe SolrDocument do
|
|
|
16
16
|
it { is_expected.to eq 'one' }
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
+
describe "thumbnail_id" do
|
|
20
|
+
let(:attributes) { { Solrizer.solr_name('thumbnail_id', :symbol) => ['one'] } }
|
|
21
|
+
subject { document.thumbnail_id }
|
|
22
|
+
it { is_expected.to eq 'one' }
|
|
23
|
+
end
|
|
24
|
+
|
|
19
25
|
describe "creator" do
|
|
20
26
|
let(:attributes) { { Solrizer.solr_name('creator') => ['one', 'two'] } }
|
|
21
27
|
subject { document.creator }
|
|
@@ -64,4 +70,28 @@ describe SolrDocument do
|
|
|
64
70
|
it { is_expected.to eq 'restricted' }
|
|
65
71
|
end
|
|
66
72
|
end
|
|
73
|
+
|
|
74
|
+
describe "#page_count" do
|
|
75
|
+
let(:attributes) { { page_count_tesim: ['1'] } }
|
|
76
|
+
subject { document.page_count }
|
|
77
|
+
it { is_expected.to eq ['1'] }
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
describe "#file_title" do
|
|
81
|
+
let(:attributes) { { file_title_tesim: ['title'] } }
|
|
82
|
+
subject { document.file_title }
|
|
83
|
+
it { is_expected.to eq ['title'] }
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
describe "#duration" do
|
|
87
|
+
let(:attributes) { { duration_tesim: ['time'] } }
|
|
88
|
+
subject { document.duration }
|
|
89
|
+
it { is_expected.to eq ['time'] }
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
describe "#sample_rate" do
|
|
93
|
+
let(:attributes) { { sample_rate_tesim: ['rate'] } }
|
|
94
|
+
subject { document.sample_rate }
|
|
95
|
+
it { is_expected.to eq ['rate'] }
|
|
96
|
+
end
|
|
67
97
|
end
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
3
|
describe CurationConcerns::FileSetPresenter do
|
|
4
|
-
let(:
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
let(:attributes) { { "title_tesim" => ["foo bar"],
|
|
5
|
+
"human_readable_type_tesim" => ["File Set"],
|
|
6
|
+
"mime_type_ssi" => 'image/jpeg',
|
|
7
|
+
'label_tesim' => ['one', 'two'],
|
|
8
|
+
"has_model_ssim" => ["FileSet"] } }
|
|
9
|
+
let(:solr_document) { SolrDocument.new(attributes) }
|
|
9
10
|
let(:ability) { double }
|
|
10
11
|
let(:presenter) { described_class.new(solr_document, ability) }
|
|
11
12
|
|
|
@@ -48,7 +49,10 @@ describe CurationConcerns::FileSetPresenter do
|
|
|
48
49
|
let(:solr_properties) do
|
|
49
50
|
["date_uploaded", "depositor", "keyword", "title_or_label",
|
|
50
51
|
"contributor", "creator", "title", "description", "publisher",
|
|
51
|
-
"subject", "language", "rights"
|
|
52
|
+
"subject", "language", "rights", "format_label", "file_size",
|
|
53
|
+
"height", "width", "filename", "well_formed", "page_count",
|
|
54
|
+
"file_title", "last_modified", "original_checksum", "mime_type",
|
|
55
|
+
"duration", "sample_rate"]
|
|
52
56
|
end
|
|
53
57
|
it "delegates to the solr_document" do
|
|
54
58
|
solr_properties.each do |property|
|
|
@@ -84,4 +88,125 @@ describe CurationConcerns::FileSetPresenter do
|
|
|
84
88
|
subject { presenter.single_use_links }
|
|
85
89
|
it { is_expected.to include(CurationConcerns::SingleUseLinkPresenter) }
|
|
86
90
|
end
|
|
91
|
+
|
|
92
|
+
describe "characterization" do
|
|
93
|
+
describe "#characterization_metadata" do
|
|
94
|
+
subject { presenter.characterization_metadata }
|
|
95
|
+
it { is_expected.to be_kind_of(Hash) }
|
|
96
|
+
|
|
97
|
+
it "only has set attributes are in the metadata" do
|
|
98
|
+
expect(subject[:height]).to be_blank
|
|
99
|
+
expect(subject[:page_count]).to be_blank
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
context "when height is set" do
|
|
103
|
+
let(:attributes) { { height_is: '444' } }
|
|
104
|
+
it "only has set attributes are in the metadata" do
|
|
105
|
+
expect(subject[:height]).not_to be_blank
|
|
106
|
+
expect(subject[:page_count]).to be_blank
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
describe "#characterized?" do
|
|
112
|
+
subject { presenter }
|
|
113
|
+
context "when attributes are not set" do
|
|
114
|
+
let(:attributes) { {} }
|
|
115
|
+
it { is_expected.not_to be_characterized }
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
context "when height is set" do
|
|
119
|
+
let(:attributes) { { height_is: '444' } }
|
|
120
|
+
it { is_expected.to be_characterized }
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
context "when file_format is set" do
|
|
124
|
+
let(:attributes) { { file_format_tesim: ['format'] } }
|
|
125
|
+
it { is_expected.to be_characterized }
|
|
126
|
+
end
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
describe "#label_for_term" do
|
|
130
|
+
subject { presenter.label_for_term(:titleized_key) }
|
|
131
|
+
it { is_expected.to eq("Titleized Key") }
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
describe "with additional characterization metadata" do
|
|
135
|
+
let(:additional_metadata) do
|
|
136
|
+
{
|
|
137
|
+
foo: ["bar"],
|
|
138
|
+
fud: ["bars", "cars"]
|
|
139
|
+
}
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
before { allow(presenter).to receive(:additional_characterization_metadata).and_return(additional_metadata) }
|
|
143
|
+
subject { presenter }
|
|
144
|
+
|
|
145
|
+
specify do
|
|
146
|
+
expect(subject).to be_characterized
|
|
147
|
+
expect(subject.characterization_metadata[:foo]).to contain_exactly("bar")
|
|
148
|
+
expect(subject.characterization_metadata[:fud]).to contain_exactly("bars", "cars")
|
|
149
|
+
end
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
describe "characterization values" do
|
|
153
|
+
before { allow(presenter).to receive(:characterization_metadata).and_return(mock_metadata) }
|
|
154
|
+
|
|
155
|
+
context "with a limited set of short values" do
|
|
156
|
+
let(:mock_metadata) { { term: ["asdf", "qwer"] } }
|
|
157
|
+
describe "#primary_characterization_values" do
|
|
158
|
+
subject { presenter.primary_characterization_values(:term) }
|
|
159
|
+
it { is_expected.to contain_exactly("asdf", "qwer") }
|
|
160
|
+
end
|
|
161
|
+
describe "#secondary_characterization_values" do
|
|
162
|
+
subject { presenter.secondary_characterization_values(:term) }
|
|
163
|
+
it { is_expected.to be_empty }
|
|
164
|
+
end
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
context "with a value set exceeding the configured amount" do
|
|
168
|
+
let(:mock_metadata) { { term: ["1", "2", "3", "4", "5", "6", "7", "8"] } }
|
|
169
|
+
describe "#primary_characterization_values" do
|
|
170
|
+
subject { presenter.primary_characterization_values(:term) }
|
|
171
|
+
it { is_expected.to contain_exactly("1", "2", "3", "4", "5") }
|
|
172
|
+
end
|
|
173
|
+
describe "#secondary_characterization_values" do
|
|
174
|
+
subject { presenter.secondary_characterization_values(:term) }
|
|
175
|
+
it { is_expected.to contain_exactly("6", "7", "8") }
|
|
176
|
+
end
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
context "with values exceeding 250 characters" do
|
|
180
|
+
let(:mock_metadata) { { term: [("a" * 251), "2", "3", "4", "5", "6", ("b" * 251)] } }
|
|
181
|
+
describe "#primary_characterization_values" do
|
|
182
|
+
subject { presenter.primary_characterization_values(:term) }
|
|
183
|
+
it { is_expected.to contain_exactly(("a" * 247) + "...", "2", "3", "4", "5") }
|
|
184
|
+
end
|
|
185
|
+
describe "#secondary_characterization_values" do
|
|
186
|
+
subject { presenter.secondary_characterization_values(:term) }
|
|
187
|
+
it { is_expected.to contain_exactly("6", (("b" * 247) + "...")) }
|
|
188
|
+
end
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
context "with a string as a value" do
|
|
192
|
+
let(:mock_metadata) { { term: "string" } }
|
|
193
|
+
describe "#primary_characterization_values" do
|
|
194
|
+
subject { presenter.primary_characterization_values(:term) }
|
|
195
|
+
it { is_expected.to contain_exactly("string") }
|
|
196
|
+
end
|
|
197
|
+
describe "#secondary_characterization_values" do
|
|
198
|
+
subject { presenter.secondary_characterization_values(:term) }
|
|
199
|
+
it { is_expected.to be_empty }
|
|
200
|
+
end
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
context "with an integer as a value" do
|
|
204
|
+
let(:mock_metadata) { { term: 1440 } }
|
|
205
|
+
describe "#primary_characterization_values" do
|
|
206
|
+
subject { presenter.primary_characterization_values(:term) }
|
|
207
|
+
it { is_expected.to contain_exactly("1440") }
|
|
208
|
+
end
|
|
209
|
+
end
|
|
210
|
+
end
|
|
211
|
+
end
|
|
87
212
|
end
|
|
@@ -19,7 +19,7 @@ describe CurationConcerns::Renderers::AttributeRenderer do
|
|
|
19
19
|
|
|
20
20
|
context 'without microdata enabled' do
|
|
21
21
|
before do
|
|
22
|
-
CurationConcerns.config.display_microdata
|
|
22
|
+
allow(CurationConcerns.config).to receive(:display_microdata).and_return(false)
|
|
23
23
|
end
|
|
24
24
|
let(:tr_content) {
|
|
25
25
|
"<tr><th>Name</th>\n" \
|
|
@@ -44,9 +44,6 @@ describe CurationConcerns::Renderers::AttributeRenderer do
|
|
|
44
44
|
end
|
|
45
45
|
|
|
46
46
|
context 'with microdata enabled' do
|
|
47
|
-
before do
|
|
48
|
-
CurationConcerns.config.display_microdata = true
|
|
49
|
-
end
|
|
50
47
|
let(:tr_content) {
|
|
51
48
|
"<tr><th>Name</th>\n" \
|
|
52
49
|
"<td><ul class='tabular'><li class=\"attribute name\" itemscope itemtype=\"http://schema.org/Person\" itemprop=\"name\">" \
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe CurationConcerns::AdminSetSearchBuilder do
|
|
4
|
+
let(:processor_chain) { [:filter_models] }
|
|
5
|
+
let(:context) { double('context') }
|
|
6
|
+
let(:user) { double('user') }
|
|
7
|
+
let(:solr_params) { { fq: [] } }
|
|
8
|
+
|
|
9
|
+
subject { described_class.new(context, :read) }
|
|
10
|
+
describe '#filter_models' do
|
|
11
|
+
before { subject.filter_models(solr_params) }
|
|
12
|
+
|
|
13
|
+
it 'adds AdminSet to query' do
|
|
14
|
+
expect(solr_params[:fq].first).to include('{!field f=has_model_ssim}AdminSet')
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
RSpec.describe CurationConcerns::AdminSetService do
|
|
4
|
+
describe ".select_options" do
|
|
5
|
+
let(:controller) { ::CatalogController.new }
|
|
6
|
+
|
|
7
|
+
let(:context) do
|
|
8
|
+
double(current_ability: Ability.new(user),
|
|
9
|
+
repository: controller.repository,
|
|
10
|
+
blacklight_config: controller.blacklight_config)
|
|
11
|
+
end
|
|
12
|
+
let(:service) { described_class.new(context) }
|
|
13
|
+
let(:user) { create(:user) }
|
|
14
|
+
let!(:as1) { create(:admin_set, :public, title: ['foo']) }
|
|
15
|
+
let!(:as2) { create(:admin_set, :public, title: ['bar']) }
|
|
16
|
+
let!(:as3) { create(:admin_set, edit_users: [user.user_key], title: ['baz']) }
|
|
17
|
+
|
|
18
|
+
context "with default (read) access" do
|
|
19
|
+
subject { service.select_options }
|
|
20
|
+
it { is_expected.to eq [['foo', as1.id],
|
|
21
|
+
['bar', as2.id],
|
|
22
|
+
['baz', as3.id]] }
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
context "with explicit read access" do
|
|
26
|
+
subject { service.select_options(:read) }
|
|
27
|
+
it { is_expected.to eq [['foo', as1.id],
|
|
28
|
+
['bar', as2.id],
|
|
29
|
+
['baz', as3.id]] }
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
context "with explicit edit access" do
|
|
33
|
+
subject { service.select_options(:edit) }
|
|
34
|
+
it { is_expected.to eq [['baz', as3.id]] }
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe CurationConcerns::LicenseService do
|
|
4
|
+
before do
|
|
5
|
+
# Configure QA to use fixtures
|
|
6
|
+
qa_fixtures = { local_path: File.expand_path('spec/fixtures/authorities') }
|
|
7
|
+
allow(Qa::Authorities::Local).to receive(:config).and_return(qa_fixtures)
|
|
8
|
+
end
|
|
9
|
+
let(:service) { described_class.new }
|
|
10
|
+
|
|
11
|
+
describe "#select_active_options" do
|
|
12
|
+
it "returns active terms" do
|
|
13
|
+
expect(service.select_active_options).to include(["First Active Term", "demo_id_01"], ["Second Active Term", "demo_id_02"])
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
it "does not return inactive terms" do
|
|
17
|
+
expect(service.select_active_options).not_to include(["Third is an Inactive Term", "demo_id_03"], ["Fourth is an Inactive Term", "demo_id_04"])
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
describe "#select_all_options" do
|
|
22
|
+
it "returns both active and inactive terms" do
|
|
23
|
+
expect(service.select_all_options).to include(["Fourth is an Inactive Term", "demo_id_04"], ["First Active Term", "demo_id_01"])
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
describe "#label" do
|
|
28
|
+
it "resolves for ids of active terms" do
|
|
29
|
+
expect(service.label('demo_id_01')).to eq("First Active Term")
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
it "resolves for ids of inactive terms" do
|
|
33
|
+
expect(service.label('demo_id_03')).to eq("Third is an Inactive Term")
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|