curate 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +14 -0
- data/app/controllers/application_controller.rb +69 -0
- data/app/controllers/catalog_controller.rb +336 -0
- data/app/controllers/classify_concerns_controller.rb +29 -0
- data/app/controllers/common_objects_controller.rb +27 -0
- data/app/controllers/curation_concern/base_controller.rb +26 -0
- data/app/controllers/curation_concern/generic_files_controller.rb +82 -0
- data/app/controllers/dashboard_controller.rb +85 -0
- data/app/controllers/downloads_controller.rb +22 -0
- data/app/controllers/errors_controller.rb +19 -0
- data/app/controllers/help_requests_controller.rb +38 -0
- data/app/controllers/terms_of_service_agreements_controller.rb +44 -0
- data/app/controllers/welcome_controller.rb +14 -0
- data/app/helpers/application_helper.rb +89 -0
- data/app/helpers/blacklight_helper.rb +19 -0
- data/app/helpers/common_objects_helper.rb +5 -0
- data/app/inputs/multi_value_input.rb +71 -0
- data/app/models/access_right.rb +53 -0
- data/app/models/classify_concern.rb +30 -0
- data/app/models/contributor_agreement.rb +58 -0
- data/app/models/digital_object_identifier.rb +83 -0
- data/app/models/doi_config.rb +26 -0
- data/app/models/help_request.rb +34 -0
- data/app/models/mint_doi.rb +51 -0
- data/app/models/mint_purl.rb +40 -0
- data/app/models/object_access.rb +17 -0
- data/app/models/purl.rb +18 -0
- data/app/models/purl_config.rb +10 -0
- data/app/models/repo_object.rb +24 -0
- data/app/models/solr_document.rb +35 -0
- data/app/repository_datastreams/file_content_datastream.rb +36 -0
- data/app/repository_models/curation_concern/embargoable.rb +43 -0
- data/app/repository_models/curation_concern/with_access_right.rb +31 -0
- data/app/repository_models/generic_file.rb +36 -0
- data/app/services/anti_virus_scanner.rb +28 -0
- data/app/services/curation_concern.rb +22 -0
- data/app/services/curation_concern/base_actor.rb +48 -0
- data/app/services/curation_concern/generic_file_actor.rb +38 -0
- data/app/validators/future_date_validator.rb +19 -0
- data/app/views/_footer.html.erb +19 -0
- data/app/views/_ga.html.erb +6 -0
- data/app/views/_logo.html.erb +34 -0
- data/app/views/_masthead.html.erb +34 -0
- data/app/views/catalog/_bookmark_control.html.erb +25 -0
- data/app/views/catalog/_bookmark_form.html.erb +8 -0
- data/app/views/catalog/_citation.html.erb +11 -0
- data/app/views/catalog/_constraints.html.erb +6 -0
- data/app/views/catalog/_constraints_element.html.erb +20 -0
- data/app/views/catalog/_delete_partials/_default.html.erb +29 -0
- data/app/views/catalog/_did_you_mean.html.erb +10 -0
- data/app/views/catalog/_document.html.erb +19 -0
- data/app/views/catalog/_document_list.html.erb +2 -0
- data/app/views/catalog/_edit_partials/_default.html.erb +58 -0
- data/app/views/catalog/_edit_partials/_default_details.html.erb +13 -0
- data/app/views/catalog/_email_form.html.erb +11 -0
- data/app/views/catalog/_facet_layout.html.erb +12 -0
- data/app/views/catalog/_facet_limit.html.erb +19 -0
- data/app/views/catalog/_facet_selected.html.erb +12 -0
- data/app/views/catalog/_facets.html.erb +5 -0
- data/app/views/catalog/_folder_control.html.erb +12 -0
- data/app/views/catalog/_home.html.erb +2 -0
- data/app/views/catalog/_home_text.html.erb +10 -0
- data/app/views/catalog/_index_default.html.erb +11 -0
- data/app/views/catalog/_index_partials/_default_group.html.erb +37 -0
- data/app/views/catalog/_marc_view.html.erb +33 -0
- data/app/views/catalog/_opensearch_response_metadata.html.erb +2 -0
- data/app/views/catalog/_previous_next_doc.html.erb +6 -0
- data/app/views/catalog/_refworks_form.html.erb +7 -0
- data/app/views/catalog/_results_pagination.html.erb +6 -0
- data/app/views/catalog/_search_form.html.erb +20 -0
- data/app/views/catalog/_show_default.html.erb +9 -0
- data/app/views/catalog/_show_partials/_default.html.erb +22 -0
- data/app/views/catalog/_show_partials/_default_details.html.erb +15 -0
- data/app/views/catalog/_show_partials/_facets.html.erb +52 -0
- data/app/views/catalog/_show_sidebar.html.erb +1 -0
- data/app/views/catalog/_show_tools.html.erb +46 -0
- data/app/views/catalog/_sms_form.html.erb +21 -0
- data/app/views/catalog/_sort_and_per_page.html.erb +38 -0
- data/app/views/catalog/_uva_tabs.html.erb +10 -0
- data/app/views/catalog/about.html.erb +0 -0
- data/app/views/catalog/citation.html.erb +1 -0
- data/app/views/catalog/email.erb +1 -0
- data/app/views/catalog/endnote.endnote.erb +1 -0
- data/app/views/catalog/index.atom.builder +109 -0
- data/app/views/catalog/index.html.erb +55 -0
- data/app/views/catalog/index.rss.builder +19 -0
- data/app/views/catalog/librarian_view.html.erb +3 -0
- data/app/views/catalog/opensearch.json.erb +0 -0
- data/app/views/catalog/opensearch.xml.builder +10 -0
- data/app/views/catalog/send_email_record.erb +0 -0
- data/app/views/catalog/show.endnote.erb +1 -0
- data/app/views/catalog/show.html.erb +40 -0
- data/app/views/catalog/show.refworks.erb +1 -0
- data/app/views/catalog/sms.erb +1 -0
- data/app/views/classify_concerns/new.html.erb +24 -0
- data/app/views/common_objects/_generic_file.html.erb +0 -0
- data/app/views/common_objects/_senior_thesis.html.erb +2 -0
- data/app/views/common_objects/show.html.erb +11 -0
- data/app/views/common_objects/show_stub_information.html.erb +13 -0
- data/app/views/curation_concern/_content_license.html.erb +16 -0
- data/app/views/curation_concern/_contributor_agreement.html.erb +27 -0
- data/app/views/curation_concern/_doi.html.erb +43 -0
- data/app/views/curation_concern/_media_display.html.erb +1 -0
- data/app/views/curation_concern/_permission.html.erb +39 -0
- data/app/views/curation_concern/_related_files.html.erb +46 -0
- data/app/views/curation_concern/generic_files/_attributes.html.erb +63 -0
- data/app/views/curation_concern/generic_files/_form.html.erb +57 -0
- data/app/views/curation_concern/generic_files/edit.html.erb +5 -0
- data/app/views/curation_concern/generic_files/new.html.erb +5 -0
- data/app/views/curation_concern/generic_files/show.html.erb +12 -0
- data/app/views/curation_concern/senior_theses/_attributes.html.erb +13 -0
- data/app/views/curation_concern/senior_theses/_form.html.erb +88 -0
- data/app/views/curation_concern/senior_theses/edit.html.erb +15 -0
- data/app/views/curation_concern/senior_theses/new.html.erb +14 -0
- data/app/views/curation_concern/senior_theses/show.html.erb +18 -0
- data/app/views/dashboard/_constraints.html.erb +22 -0
- data/app/views/dashboard/_did_you_mean.html.erb +26 -0
- data/app/views/dashboard/_document_list.html.erb +20 -0
- data/app/views/dashboard/_facet_layout.html.erb +27 -0
- data/app/views/dashboard/_facet_limit.html.erb +35 -0
- data/app/views/dashboard/_facet_pagination.html.erb +25 -0
- data/app/views/dashboard/_facet_selected.html.erb +28 -0
- data/app/views/dashboard/_facets.html.erb +22 -0
- data/app/views/dashboard/_index_partials/_default_group.html.erb +37 -0
- data/app/views/dashboard/_index_partials/_list_files.html.erb +66 -0
- data/app/views/dashboard/_index_partials/_thumbnail_display.html.erb +0 -0
- data/app/views/dashboard/_results_pagination.html.erb +22 -0
- data/app/views/dashboard/_search_form.html.erb +36 -0
- data/app/views/dashboard/_show_partials/_default.html.erb +38 -0
- data/app/views/dashboard/_show_partials/_default_details.html.erb +31 -0
- data/app/views/dashboard/_show_partials/_facets.html.erb +103 -0
- data/app/views/dashboard/_sort_and_per_page.html.erb +18 -0
- data/app/views/dashboard/facet.html.erb +38 -0
- data/app/views/dashboard/get_related_file.html.erb +4 -0
- data/app/views/dashboard/index.html.erb +60 -0
- data/app/views/errors/401.html.erb +5 -0
- data/app/views/errors/404.html.erb +16 -0
- data/app/views/errors/500.html.erb +10 -0
- data/app/views/help_requests/new.html.erb +60 -0
- data/app/views/layouts/application.html.erb +14 -0
- data/app/views/layouts/boilerplate.html.erb +28 -0
- data/app/views/layouts/common_objects.html.erb +45 -0
- data/app/views/layouts/curate_nd.html.erb +55 -0
- data/app/views/layouts/curate_nd/1_column.html.erb +22 -0
- data/app/views/layouts/curate_nd/2_column.html.erb +26 -0
- data/app/views/layouts/curate_nd/catalog.html.erb +22 -0
- data/app/views/layouts/curate_nd/dashboard.html.erb +22 -0
- data/app/views/layouts/hydra-head.html.erb +95 -0
- data/app/views/shared/_action_bar.html.erb +30 -0
- data/app/views/shared/_flash_message.html.erb +9 -0
- data/app/views/shared/_site_search.html.erb +18 -0
- data/app/views/terms_of_service_agreements/new.html.erb +136 -0
- data/app/views/welcome/index.html.erb +21 -0
- data/app/workers/characterize_job.rb +4 -0
- data/app/workers/doi_worker.rb +16 -0
- data/config/routes.rb +35 -0
- data/lib/curate.rb +6 -0
- data/lib/curate/engine.rb +46 -0
- data/lib/curate/version.rb +1 -1
- data/spec/abilities/generic_file_abilities_spec.rb +55 -0
- data/spec/controllers/application_controller_spec.rb +38 -0
- data/spec/controllers/classify_concerns_controller_spec.rb +36 -0
- data/spec/controllers/common_objects_controller_spec.rb +112 -0
- data/spec/controllers/curation_concern/base_controller_spec.rb +14 -0
- data/spec/controllers/curation_concern/generic_files_controller_spec.rb +156 -0
- data/spec/controllers/dashboard_controller_spec.rb +85 -0
- data/spec/controllers/downloads_controller_spec.rb +42 -0
- data/spec/controllers/help_requests_controller_spec.rb +42 -0
- data/spec/controllers/terms_of_service_agreements_controller_spec.rb +30 -0
- data/spec/controllers/welcome_controller_spec.rb +10 -0
- data/spec/dummy/app/models/solr_document.rb +4 -0
- data/spec/dummy/app/models/user.rb +13 -0
- data/spec/dummy/config/application.rb +8 -1
- data/spec/dummy/config/database.yml +21 -22
- data/spec/dummy/config/doi.yml +11 -0
- data/spec/dummy/config/fedora.yml +20 -0
- data/spec/dummy/config/initializers/devise.rb +232 -0
- data/spec/dummy/config/initializers/hydra_config.rb +41 -0
- data/spec/dummy/config/initializers/mailboxer.rb +17 -0
- data/spec/dummy/config/initializers/redis_config.rb +45 -0
- data/spec/dummy/config/initializers/sufia.rb +66 -0
- data/spec/dummy/config/purl.yml +15 -0
- data/spec/dummy/config/redis.yml +6 -0
- data/spec/dummy/config/role_map_ci.yml +15 -0
- data/spec/dummy/config/role_map_cucumber.yml +10 -0
- data/spec/dummy/config/role_map_development.yml +12 -0
- data/spec/dummy/config/role_map_pre_production.yml +2 -0
- data/spec/dummy/config/role_map_production.yml +2 -0
- data/spec/dummy/config/role_map_test.yml +15 -0
- data/spec/dummy/config/routes.rb +4 -55
- data/spec/dummy/config/solr.yml +17 -0
- data/spec/dummy/db/migrate/20130130142162_create_purl.rb +55 -0
- data/spec/dummy/db/migrate/20130312135359_create_help_requests.rb +22 -0
- data/spec/dummy/db/migrate/20130408165008_create_users.rb +11 -0
- data/spec/dummy/db/migrate/20130408165009_acts_as_follower_migration.rb +31 -0
- data/spec/dummy/db/migrate/20130408165010_add_social_to_users.rb +27 -0
- data/spec/dummy/db/migrate/20130408165011_create_single_use_links.rb +12 -0
- data/spec/dummy/db/migrate/20130408165012_add_ldap_attrs_to_user.rb +41 -0
- data/spec/dummy/db/migrate/20130408165013_add_avatars_to_users.rb +23 -0
- data/spec/dummy/db/migrate/20130408165014_create_checksum_audit_logs.rb +34 -0
- data/spec/dummy/db/migrate/20130408165015_create_version_committers.rb +29 -0
- data/spec/dummy/db/migrate/20130408165016_add_groups_to_users.rb +25 -0
- data/spec/dummy/db/migrate/20130408165017_create_local_authorities.rb +64 -0
- data/spec/dummy/db/migrate/20130408165018_create_trophies.rb +10 -0
- data/spec/dummy/db/migrate/20130408165022_create_mailboxer.mailboxer_engine.rb +62 -0
- data/spec/dummy/db/migrate/20130408165023_add_notified_object.mailboxer_engine.rb +18 -0
- data/spec/dummy/db/migrate/20130408165024_add_notification_code.mailboxer_engine.rb +14 -0
- data/spec/dummy/db/migrate/20130408165025_add_attachments.mailboxer_engine.rb +10 -0
- data/spec/dummy/db/migrate/20130408165026_rename_receipts_read.mailboxer_engine.rb +10 -0
- data/spec/dummy/db/schema.rb +197 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/fedora_conf/conf/development/fedora.fcfg +953 -0
- data/spec/dummy/fedora_conf/conf/test/fedora.fcfg +953 -0
- data/spec/dummy/log/development.log +1791 -0
- data/spec/dummy/log/test.log +176333 -0
- data/spec/dummy/solr_conf/conf/schema.xml +692 -0
- data/spec/dummy/solr_conf/conf/solrconfig.xml +299 -0
- data/spec/dummy/solr_conf/solr.xml +35 -0
- data/spec/factories/create_curation_concern.rb +11 -0
- data/spec/factories/create_generic_file.rb +36 -0
- data/spec/factories/help_requests.rb +10 -0
- data/spec/factories/mock_curation_concerns.rb +4 -0
- data/spec/factories/users.rb +8 -0
- data/spec/helpers/application_helper_spec.rb +139 -0
- data/spec/helpers/common_objects_helper_spec.rb +9 -0
- data/spec/models/access_right_spec.rb +47 -0
- data/spec/models/classify_concern_spec.rb +30 -0
- data/spec/models/contributor_agreement_spec.rb +45 -0
- data/spec/models/digital_object_identifier_spec.rb +50 -0
- data/spec/models/help_request_spec.rb +5 -0
- data/spec/models/mint_doi_spec.rb +79 -0
- data/spec/models/mint_purl_spec.rb +38 -0
- data/spec/models/object_access_spec.rb +24 -0
- data/spec/models/purl_spec.rb +22 -0
- data/spec/models/repo_object_spec.rb +39 -0
- data/spec/repository_models/curation_concern/embargoable_spec.rb +69 -0
- data/spec/repository_models/generic_file_spec.rb +38 -0
- data/spec/services/anti_virus_scanner_spec.rb +26 -0
- data/spec/services/curation_concern/base_actor_spec.rb +28 -0
- data/spec/services/curation_concern/generic_file_actor_spec.rb +75 -0
- data/spec/services/curation_concern_spec.rb +34 -0
- data/spec/spec_helper.rb +54 -1
- data/spec/support/environment_override.rb +17 -0
- data/spec/support/matchers/raise_rescue_response_type_matcher.rb +42 -0
- data/spec/support/mock_curation_concern.rb +61 -0
- data/spec/support/shared/shared_examples_is_embargoable.rb +9 -0
- data/spec/support/shared/shared_examples_with_access_rights.rb +33 -0
- data/spec/workers/characterize_job_spec.rb +26 -0
- metadata +686 -10
- data/MIT-LICENSE +0 -20
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe AccessRight do
|
4
|
+
[
|
5
|
+
[false, AccessRight::PERMISSION_TEXT_VALUE_PUBLIC, nil, true, false, false],
|
6
|
+
[false, AccessRight::PERMISSION_TEXT_VALUE_AUTHENTICATED, nil, true, false, false],
|
7
|
+
[false, nil, nil, true, false, false],
|
8
|
+
[false, nil, AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC, true, false, false],
|
9
|
+
[false, nil, AccessRight::VISIBILITY_TEXT_VALUE_AUTHENTICATED, false, true, false],
|
10
|
+
[false, nil, AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE, false, false, true],
|
11
|
+
[true, AccessRight::PERMISSION_TEXT_VALUE_PUBLIC, nil, true, false, false],
|
12
|
+
[true, AccessRight::PERMISSION_TEXT_VALUE_AUTHENTICATED, nil, false, true, false],
|
13
|
+
[true, nil, nil, false, false, true],
|
14
|
+
[true, nil, AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC, true, false, false],
|
15
|
+
[true, nil, AccessRight::VISIBILITY_TEXT_VALUE_AUTHENTICATED, false, true, false],
|
16
|
+
[true, nil, AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE, false, false, true],
|
17
|
+
].each do |given_persisted, givin_permission, given_visibility, expected_open_access, expected_authentication_only, expected_private|
|
18
|
+
spec_text = <<-TEXT
|
19
|
+
|
20
|
+
GIVEN: {
|
21
|
+
persisted: #{given_persisted.inspect},
|
22
|
+
permission: #{givin_permission.inspect},
|
23
|
+
visibility: #{given_visibility.inspect}
|
24
|
+
},
|
25
|
+
EXPECTED: {
|
26
|
+
open_access: #{expected_open_access.inspect},
|
27
|
+
restricted: #{expected_authentication_only.inspect},
|
28
|
+
private: #{expected_private.inspect}
|
29
|
+
},
|
30
|
+
TEXT
|
31
|
+
|
32
|
+
it spec_text do
|
33
|
+
permissions = [{access: :edit, name: givin_permission}]
|
34
|
+
permissionable = double(
|
35
|
+
'permissionable',
|
36
|
+
permissions: permissions,
|
37
|
+
visibility: given_visibility,
|
38
|
+
persisted?: given_persisted
|
39
|
+
)
|
40
|
+
access_right = AccessRight.new(permissionable)
|
41
|
+
|
42
|
+
expect(access_right.open_access?).to eq(expected_open_access)
|
43
|
+
expect(access_right.authenticated_only?).to eq(expected_authentication_only)
|
44
|
+
expect(access_right.private?).to eq(expected_private)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ClassifyConcern do
|
4
|
+
subject { ClassifyConcern.new(curation_concern_type: curation_concern_type) }
|
5
|
+
let(:curation_concern_type) { nil }
|
6
|
+
|
7
|
+
describe 'with curation_concern_type: nil' do
|
8
|
+
it 'is not valid' do
|
9
|
+
expect(subject).to_not be_valid
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'raises an error on .curation_concern_class' do
|
13
|
+
expect{
|
14
|
+
subject.curation_concern_class
|
15
|
+
}.to raise_error(RuntimeError)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
describe 'with curation_concern_type: "MockCurationConcern"' do
|
20
|
+
let(:curation_concern_type) { "MockCurationConcern" }
|
21
|
+
|
22
|
+
it 'is valid if curation_concern_type is from the right list' do
|
23
|
+
expect(subject).to be_valid
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'has a <MockCurationConcern> class for curation_concern_class' do
|
27
|
+
expect(subject.curation_concern_class).to eq(MockCurationConcern)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ContributorAgreement do
|
4
|
+
subject { ContributorAgreement.new(curation_concern, user, params) }
|
5
|
+
let(:curation_concern) { MockCurationConcern.new }
|
6
|
+
let(:user) { User.new }
|
7
|
+
let(:params) { {} }
|
8
|
+
|
9
|
+
|
10
|
+
it 'has legally binding text' do
|
11
|
+
subject.legally_binding_text.should be_kind_of(String)
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'has acceptance value' do
|
15
|
+
subject.acceptance_value.should == 'accept'
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'has param key' do
|
19
|
+
subject.param_key.should == :accept_contributor_agreement
|
20
|
+
end
|
21
|
+
|
22
|
+
describe 'without acceptance' do
|
23
|
+
let(:params) { {} }
|
24
|
+
|
25
|
+
it 'has param value' do
|
26
|
+
subject.param_value.should == nil
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'is most definitely not being accepted' do
|
30
|
+
subject.is_being_accepted?.should == false
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe 'with acceptance' do
|
35
|
+
let(:params) { {accept_contributor_agreement: 'accept'} }
|
36
|
+
|
37
|
+
it 'has a param value of "accept"' do
|
38
|
+
subject.param_value.should == 'accept'
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'is in the process of being accepted' do
|
42
|
+
subject.is_being_accepted?.should == true
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe DigitalObjectIdentifier do
|
4
|
+
|
5
|
+
before :each do
|
6
|
+
@doi = DigitalObjectIdentifier.new
|
7
|
+
end
|
8
|
+
|
9
|
+
describe 'create_doi' do
|
10
|
+
it 'should_not_create_digital_object_identifier' do
|
11
|
+
expect { @doi.create_doi }.to raise_error(RestClient::BadRequest)
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'should_create_digital_object_identifier' do
|
15
|
+
@doi.target = "https://fedorapprd.library.nd.edu:8443/fedora/get/RBSC-CURRENCY:671/"
|
16
|
+
@doi.title = "Notre Dame Test"
|
17
|
+
@doi.creator = "Comstock, Adam"
|
18
|
+
@doi.publisher = "Hesburgh Library - University of Notre Dame"
|
19
|
+
@doi.publicationyear = "2011"
|
20
|
+
response = @doi.create_doi
|
21
|
+
response.should include("success: doi:10.5072/FK2")
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
describe 'update_doi' do
|
26
|
+
it 'should_add_more_metadata' do
|
27
|
+
@doi.target = "https://fedorapprd.library.nd.edu:8443/fedora/get/RBSC-CURRENCY:671/"
|
28
|
+
@doi.title = "Notre Dame Test"
|
29
|
+
@doi.creator = "Comstock, Adam"
|
30
|
+
@doi.publisher = "Hesburgh Library - University of Notre Dame"
|
31
|
+
@doi.publicationyear = "2011"
|
32
|
+
@doi.description = "Description of content"
|
33
|
+
@doi.rights = ""
|
34
|
+
@doi.version = "1.1"
|
35
|
+
@doi.format = "text/plain"
|
36
|
+
@doi.data_size = "128kb"
|
37
|
+
@doi.contributor = "RNB"
|
38
|
+
@doi.subject = "TEST"
|
39
|
+
@doi.name_id = "87fs89ds"
|
40
|
+
@doi.subtitle = "Currency"
|
41
|
+
@doi.created_date = "2011-12-1"
|
42
|
+
@doi.accepted_date = "2012-01-31"
|
43
|
+
@doi.resource_type = "Test"
|
44
|
+
@doi.lang = "eng"
|
45
|
+
response = @doi.update_doi
|
46
|
+
response.should include("success: doi:10.5072/FK2")
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe MintDoi do
|
4
|
+
|
5
|
+
before :each do
|
6
|
+
WebMock.disable_net_connect!
|
7
|
+
end
|
8
|
+
|
9
|
+
after :each do
|
10
|
+
WebMock.allow_net_connect!
|
11
|
+
end
|
12
|
+
|
13
|
+
def stub_http_for_initial_url(options = {} )
|
14
|
+
request_url = DoiConfig.url_for_creating_doi
|
15
|
+
if options[:to_timeout]
|
16
|
+
stub_request(:get, request_url).to_timeout
|
17
|
+
else
|
18
|
+
headers = options[:headers] || {}
|
19
|
+
status = options[:status] || 200
|
20
|
+
stub_request(:post, request_url).
|
21
|
+
to_return(
|
22
|
+
{
|
23
|
+
body: "doi:10.5072/FK2K361NJ | ack:10.5072/FK2K361NJ",
|
24
|
+
status: status,
|
25
|
+
headers: headers
|
26
|
+
}
|
27
|
+
)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
let(:pid) { "und:j3860692c" }
|
32
|
+
|
33
|
+
let(:mint_doi) { MintDoi.new(pid)}
|
34
|
+
|
35
|
+
let(:fedora_object_without_title){
|
36
|
+
OpenStruct.new(
|
37
|
+
{
|
38
|
+
:pid => pid,
|
39
|
+
:date_added => DateTime.new(2001,-11,-26,-20,-55,-54,'+7'),
|
40
|
+
:date_modified => DateTime.new(2001,-11,-26,-20,-55,-54,'+7'),
|
41
|
+
:information => "_TEST_",
|
42
|
+
:title => nil,
|
43
|
+
:creator => "DLIS"
|
44
|
+
}
|
45
|
+
)
|
46
|
+
}
|
47
|
+
|
48
|
+
let(:fedora_object){
|
49
|
+
OpenStruct.new(
|
50
|
+
{
|
51
|
+
:pid => pid,
|
52
|
+
:date_added => DateTime.new(2001,-11,-26,-20,-55,-54,'+7'),
|
53
|
+
:date_modified => DateTime.new(2001,-11,-26,-20,-55,-54,'+7'),
|
54
|
+
:information => "_TEST_",
|
55
|
+
:title => "Notre Dame Test",
|
56
|
+
:creator => "DLIS"
|
57
|
+
}
|
58
|
+
)
|
59
|
+
}
|
60
|
+
|
61
|
+
let(:expected_doi) { "doi:10.5072/FK2K361NJ" }
|
62
|
+
|
63
|
+
describe 'create_or_retreive_doi' do
|
64
|
+
|
65
|
+
it 'raises exception for fedora object without title' do
|
66
|
+
ActiveFedora::Base.stub(:find).with(pid, cast: true).and_return(fedora_object_without_title)
|
67
|
+
stub_http_for_initial_url
|
68
|
+
expect {mint_doi.create_or_retrieve_doi}.to raise_error(MintDoi::MissingDataError)
|
69
|
+
end
|
70
|
+
|
71
|
+
it 'should return digital object identifier' do
|
72
|
+
ActiveFedora::Base.stub(:find).with(pid, cast: true).and_return(fedora_object)
|
73
|
+
stub_http_for_initial_url
|
74
|
+
mint_doi.create_or_retrieve_doi.should include(expected_doi)
|
75
|
+
end
|
76
|
+
|
77
|
+
end
|
78
|
+
|
79
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
# https://github.com/bblimke/webmock
|
4
|
+
require 'webmock/rspec'
|
5
|
+
|
6
|
+
describe MintPurl do
|
7
|
+
|
8
|
+
subject { MintPurl.new(fedora_object) }
|
9
|
+
let(:pid) { "TEST:#{noid}" }
|
10
|
+
let(:noid) { '1234' }
|
11
|
+
let(:bad_fedora_object) { nil }
|
12
|
+
let(:create_date) { DateTime.new(2000,-11,-26,-20,-55,-54,'+7') }
|
13
|
+
let(:date_added) { DateTime.new(2001,-11,-26,-20,-55,-54,'+7') }
|
14
|
+
let(:modified_date) { DateTime.new(2002,-11,-26,-20,-55,-54,'+7') }
|
15
|
+
|
16
|
+
let(:fedora_object) {
|
17
|
+
double(
|
18
|
+
'FedoraObject',
|
19
|
+
to_param: noid,
|
20
|
+
date_added: date_added,
|
21
|
+
modified_date: modified_date,
|
22
|
+
create_date: create_date
|
23
|
+
)
|
24
|
+
}
|
25
|
+
|
26
|
+
let(:expected_purl_link) { "http://localhost:3000/view/1/#{noid}" }
|
27
|
+
|
28
|
+
it 'requires a fedora object that is present and responds to_param' do
|
29
|
+
expect { MintPurl.new(bad_fedora_object) }.to raise_error(ArgumentError)
|
30
|
+
end
|
31
|
+
|
32
|
+
describe 'create_or_retreive_purl' do
|
33
|
+
it 'should return purl link' do
|
34
|
+
subject.create_or_retreive_purl.should == expected_purl_link
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'ostruct'
|
3
|
+
|
4
|
+
describe ObjectAccess do
|
5
|
+
|
6
|
+
let(:purl) {
|
7
|
+
OpenStruct.new(
|
8
|
+
{
|
9
|
+
:purl_id => 9999,
|
10
|
+
:repo_object_id => 9999,
|
11
|
+
:access_count => 0,
|
12
|
+
:date_created => DateTime.new(2001,-11,-26,-20,-55,-54,'+7')
|
13
|
+
}
|
14
|
+
)
|
15
|
+
}
|
16
|
+
|
17
|
+
describe '.create_from_purl' do
|
18
|
+
it 'should_create_data_in_purl_database' do
|
19
|
+
ObjectAccess.create_from_purl(purl)
|
20
|
+
result = ObjectAccess.first
|
21
|
+
result.repo_object_id.should == purl.repo_object_id
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'ostruct'
|
3
|
+
describe Purl do
|
4
|
+
let(:repo_object) {
|
5
|
+
OpenStruct.new(
|
6
|
+
{
|
7
|
+
:repo_object_id => 9999,
|
8
|
+
:pid => "ARCH-SEASIDE:464",
|
9
|
+
:date_added => DateTime.new(2001,-11,-26,-20,-55,-54,'+7'),
|
10
|
+
:date_modified => DateTime.new(2001,-11,-26,-20,-55,-54,'+7'),
|
11
|
+
:information => "_TEST_"
|
12
|
+
}
|
13
|
+
)
|
14
|
+
}
|
15
|
+
describe '.create_from_repo_object' do
|
16
|
+
it 'should_create_data_in_purl_database' do
|
17
|
+
Purl.create_from_repo_object(repo_object)
|
18
|
+
result = Purl.first
|
19
|
+
result.repo_object_id.should == repo_object.repo_object_id
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require "ostruct"
|
3
|
+
|
4
|
+
describe RepoObject do
|
5
|
+
let(:pid) { "TEST:#{noid}" }
|
6
|
+
let(:noid) { '1234' }
|
7
|
+
let(:bad_fedora_object) { nil }
|
8
|
+
let(:create_date) { DateTime.new(2000,-11,-26,-20,-55,-54,'+7') }
|
9
|
+
let(:date_added) { DateTime.new(2001,-11,-26,-20,-55,-54,'+7') }
|
10
|
+
let(:modified_date) { DateTime.new(2002,-11,-26,-20,-55,-54,'+7') }
|
11
|
+
|
12
|
+
let(:fedora_object) {
|
13
|
+
double(
|
14
|
+
'FedoraObject',
|
15
|
+
to_param: noid,
|
16
|
+
date_added: date_added,
|
17
|
+
modified_date: modified_date,
|
18
|
+
create_date: create_date
|
19
|
+
)
|
20
|
+
}
|
21
|
+
|
22
|
+
describe ".create_repo_object" do
|
23
|
+
let(:expected_url) { File.join(Rails.configuration.application_url, "show", fedora_object.to_param) }
|
24
|
+
it 'should raise exception if no object given' do
|
25
|
+
expect {
|
26
|
+
RepoObject.create_from_fedora_object(nil)
|
27
|
+
}.to raise_error(ArgumentError)
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'should_create_data_in_purl_database' do
|
31
|
+
RepoObject.create_from_fedora_object(fedora_object)
|
32
|
+
results = RepoObject.where(:filename => fedora_object.to_param)
|
33
|
+
object = results.first
|
34
|
+
|
35
|
+
expect(object.filename).to eq(fedora_object.to_param)
|
36
|
+
expect(object.url).to eq(expected_url)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'ostruct'
|
3
|
+
|
4
|
+
describe CurationConcern::Embargoable do
|
5
|
+
let(:model) {
|
6
|
+
Class.new(ActiveFedora::Base) {
|
7
|
+
def save(returning_value = true)
|
8
|
+
valid? && run_callbacks(:save) && !!returning_value
|
9
|
+
end
|
10
|
+
include CurationConcern::Embargoable
|
11
|
+
}
|
12
|
+
}
|
13
|
+
|
14
|
+
let(:persistence) {
|
15
|
+
Class.new {
|
16
|
+
attr_accessor :embargo_release_date
|
17
|
+
}.new
|
18
|
+
}
|
19
|
+
|
20
|
+
subject { model.new }
|
21
|
+
|
22
|
+
before(:each) do
|
23
|
+
subject.embargoable_persistence_container = persistence
|
24
|
+
end
|
25
|
+
|
26
|
+
context 'validation' do
|
27
|
+
it 'is valid without an embargo_release_date' do
|
28
|
+
expect(subject.valid?).to eq(true)
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'is not valid with a past embargo date' do
|
32
|
+
subject.embargo_release_date = 2.days.ago.to_s
|
33
|
+
expect(subject.valid?).to eq(false)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
context 'persistence' do
|
38
|
+
let(:the_date) { 2.days.from_now }
|
39
|
+
|
40
|
+
it 'persists a date object' do
|
41
|
+
subject.embargo_release_date = the_date
|
42
|
+
expect {
|
43
|
+
subject.save
|
44
|
+
}.to change(persistence, :embargo_release_date).from(nil).to(the_date.to_date)
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'persists a valid string' do
|
48
|
+
subject.embargo_release_date = the_date.to_s
|
49
|
+
expect {
|
50
|
+
subject.save
|
51
|
+
}.to change(persistence, :embargo_release_date).from(nil).to(the_date.to_date)
|
52
|
+
end
|
53
|
+
|
54
|
+
it 'persists an empty string' do
|
55
|
+
subject.embargo_release_date = ''
|
56
|
+
expect {
|
57
|
+
subject.save
|
58
|
+
}.to_not change(persistence, :embargo_release_date)
|
59
|
+
end
|
60
|
+
|
61
|
+
it 'does not persist an invalid string' do
|
62
|
+
subject.embargo_release_date = "Tim"
|
63
|
+
expect {
|
64
|
+
expect(subject.save).to eq(false)
|
65
|
+
}.to_not change(persistence, :embargo_release_date)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|