sufia 3.7.2 → 4.0.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/Gemfile +3 -0
- data/README.md +88 -11
- data/SUFIA_VERSION +1 -1
- data/app/assets/images/old_main_tulips.jpg +0 -0
- data/app/assets/javascripts/contact_form.js +0 -16
- data/app/assets/javascripts/jquery.blacklightTagCloud.js +44 -0
- data/app/assets/javascripts/jquery.tagcloud.js +116 -0
- data/app/assets/javascripts/jquery.tinysort.min.js +7 -0
- data/app/assets/javascripts/sufia.js +41 -44
- data/app/assets/javascripts/sufia/edit_metadata.js +1 -1
- data/app/assets/javascripts/sufia/editor.js +12 -0
- data/app/assets/javascripts/sufia/featured_works.js +64 -0
- data/app/assets/javascripts/sufia/fileupload.js +1 -1
- data/app/assets/javascripts/sufia/multiForm.js +1 -1
- data/app/assets/javascripts/sufia/permissions.js +4 -8
- data/app/assets/javascripts/sufia/single_use_link.js +1 -2
- data/app/assets/javascripts/sufia/trophy.js +42 -27
- data/app/assets/javascripts/terms_of_service.js +1 -1
- data/app/assets/stylesheets/dashboard.css.scss +81 -40
- data/app/assets/stylesheets/featured.css.scss +16 -0
- data/app/assets/stylesheets/fileupload/{jquery.fileupload-ui.css → jquery.fileupload-ui.css.erb} +2 -2
- data/app/assets/stylesheets/{generic_files.css → generic_files.css.erb} +6 -7
- data/app/assets/stylesheets/header.css.scss +93 -0
- data/app/assets/stylesheets/home-page.css.scss +50 -0
- data/app/assets/stylesheets/nestable.css.scss +111 -0
- data/app/assets/stylesheets/styles.css.scss +106 -0
- data/app/assets/stylesheets/sufia.css.scss +13 -8
- data/app/assets/stylesheets/tagcloud.css +83 -0
- data/app/assets/stylesheets/usage-stats.css +30 -0
- data/app/controllers/batch_controller.rb +0 -1
- data/app/controllers/concerns/sufia/catalog.rb +64 -0
- data/app/controllers/concerns/sufia/dashboard_controller_behavior.rb +16 -13
- data/app/controllers/content_blocks_controller.rb +8 -0
- data/app/controllers/featured_work_lists_controller.rb +16 -0
- data/app/controllers/featured_works_controller.rb +26 -0
- data/app/controllers/mailbox_controller.rb +1 -1
- data/app/controllers/pages_controller.rb +7 -0
- data/app/controllers/single_use_links_viewer_controller.rb +2 -5
- data/app/controllers/tinymce_assets_controller.rb +12 -0
- data/app/helpers/content_block_helper.rb +21 -0
- data/app/helpers/generic_file_helper.rb +2 -2
- data/app/helpers/sufia_helper.rb +8 -4
- data/app/helpers/trophy_helper.rb +15 -7
- data/app/models/content_block.rb +2 -0
- data/app/models/featured_work_list.rb +42 -0
- data/app/models/tinymce_asset.rb +3 -0
- data/app/uploaders/tinymce_asset_uploader.rb +51 -0
- data/app/views/_add_assets_links.html.erb +0 -16
- data/app/views/_controls.html.erb +17 -0
- data/app/views/_flash_msg.html.erb +2 -18
- data/app/views/_footer.html.erb +10 -15
- data/app/views/_ga.html.erb +0 -16
- data/app/views/_logo.html.erb +2 -2
- data/app/views/_masthead.html.erb +9 -36
- data/app/views/_user_util_links.html.erb +16 -11
- data/app/views/advanced/_advanced_search_facets.html.erb +0 -16
- data/app/views/advanced/_advanced_search_fields.html.erb +0 -16
- data/app/views/advanced/_advanced_search_help.html.erb +0 -16
- data/app/views/advanced/_facet_layout.html.erb +0 -16
- data/app/views/advanced/_facet_limit.html.erb +0 -16
- data/app/views/advanced/index.html.erb +2 -18
- data/app/views/batch/_metadata.html.erb +3 -3
- data/app/views/batch/edit.html.erb +4 -21
- data/app/views/catalog/_facet_limit.html.erb +11 -12
- data/app/views/catalog/_featured_researcher.html.erb +2 -0
- data/app/views/catalog/_home.html.erb +6 -2
- data/app/views/catalog/_home_content.html.erb +36 -0
- data/app/views/catalog/_home_header.html.erb +15 -0
- data/app/views/catalog/_recent_document.html.erb +1 -1
- data/app/views/catalog/_recents.html.erb +3 -4
- data/app/views/catalog/_search_form.html.erb +13 -9
- data/app/views/catalog/_tagcloud.html.erb +7 -0
- data/app/views/catalog/index.html.erb +4 -10
- data/app/views/contact_form/create.html.erb +0 -16
- data/app/views/contact_form/new.html.erb +0 -16
- data/app/views/dashboard/_constraints.html.erb +3 -19
- data/app/views/dashboard/_did_you_mean.html.erb +0 -16
- data/app/views/dashboard/_document_list.html.erb +0 -16
- data/app/views/dashboard/_facet_layout.html.erb +1 -17
- data/app/views/dashboard/_facet_limit.html.erb +5 -5
- data/app/views/dashboard/_facet_selected.html.erb +1 -17
- data/app/views/dashboard/_facets.html.erb +0 -18
- data/app/views/dashboard/_heading.html.erb +1 -1
- data/app/views/dashboard/_index_partials/_default_group.html.erb +7 -23
- data/app/views/dashboard/_index_partials/_list_files.html.erb +62 -57
- data/app/views/dashboard/_search_form.html.erb +10 -7
- data/app/views/dashboard/_show_partials/_default.html.erb +0 -18
- data/app/views/dashboard/_show_partials/_default_details.html.erb +0 -16
- data/app/views/dashboard/_show_partials/_facets.html.erb +0 -16
- data/app/views/dashboard/_sort_and_per_page.html.erb +10 -9
- data/app/views/dashboard/facet.html.erb +4 -19
- data/app/views/dashboard/index.html.erb +27 -49
- data/app/views/error/401.html.erb +1 -17
- data/app/views/error/404.html.erb +0 -16
- data/app/views/error/500.html.erb +0 -16
- data/app/views/error/single_use_error.html.erb +1 -17
- data/app/views/generic_files/_asset_deleted_flash.html.erb +0 -16
- data/app/views/generic_files/_asset_permissions_denial_flash.html.erb +0 -16
- data/app/views/generic_files/_asset_saved_flash.html.erb +0 -16
- data/app/views/generic_files/_asset_updated_flash.html.erb +0 -16
- data/app/views/generic_files/_breadcrumbs.html.erb +0 -16
- data/app/views/generic_files/_browse_everything.html.erb +24 -0
- data/app/views/generic_files/_descriptions.html.erb +1 -1
- data/app/views/generic_files/_field_form.html.erb +5 -5
- data/app/views/generic_files/_media_display.html.erb +3 -3
- data/app/views/generic_files/_permission_form.html.erb +5 -5
- data/app/views/generic_files/_rights_modal.html.erb +13 -29
- data/app/views/generic_files/_show_actions.html.erb +13 -1
- data/app/views/generic_files/_versioning.html.erb +14 -10
- data/app/views/generic_files/citation.html.erb +0 -16
- data/app/views/generic_files/edit.html.erb +10 -12
- data/app/views/generic_files/edit_fields/_default.html.erb +1 -1
- data/app/views/generic_files/edit_fields/_description.html.erb +1 -1
- data/app/views/generic_files/edit_fields/_resource_type.html.erb +2 -3
- data/app/views/generic_files/edit_fields/_rights.html.erb +1 -1
- data/app/views/generic_files/new.html.erb +11 -26
- data/app/views/generic_files/show.html.erb +7 -25
- data/app/views/generic_files/stats.html.erb +141 -0
- data/app/views/homepage/_featured.html.erb +11 -0
- data/app/views/homepage/_featured_fields.html.erb +18 -0
- data/app/views/homepage/_featured_works.html.erb +17 -0
- data/app/views/homepage/_sortable_featured.html.erb +26 -0
- data/app/views/layouts/_head_tag_content.html.erb +1 -1
- data/app/views/layouts/_homepage_sidebar2.html.erb +14 -0
- data/app/views/layouts/error.html.erb +3 -21
- data/app/views/layouts/homepage.html.erb +8 -37
- data/app/views/layouts/sufia-dashboard.html.erb +46 -0
- data/app/views/layouts/sufia-one-column.html.erb +8 -24
- data/app/views/layouts/sufia-two-column.html.erb +9 -8
- data/app/views/pages/show.html.erb +4 -0
- data/app/views/single_use_links_viewer/show.html.erb +2 -2
- data/app/views/static/agreement.html.erb +0 -17
- data/app/views/static/help.html.erb +0 -17
- data/app/views/static/mendeley.html.erb +0 -16
- data/app/views/static/subject_libraries.html.erb +0 -17
- data/app/views/static/terms.html.erb +0 -16
- data/app/views/static/zotero.html.erb +0 -16
- data/app/views/users/_activity_log.html.erb +2 -2
- data/app/views/users/_contributions.html.erb +6 -2
- data/app/views/users/_follower_modal.html.erb +2 -2
- data/app/views/users/_following_modal.html.erb +2 -2
- data/app/views/users/_left_sidebar.html.erb +1 -1
- data/app/views/users/_notify_link.html.erb +1 -1
- data/app/views/users/_notify_number.html.erb +1 -1
- data/app/views/users/_profile_actions.html.erb +3 -3
- data/app/views/users/_profile_tabs.html.erb +1 -1
- data/app/views/users/_search_form.html.erb +3 -2
- data/app/views/users/_social_media_info.html.erb +3 -3
- data/app/views/users/_trophy_edit.html.erb +2 -2
- data/app/views/users/_user_info.html.erb +27 -27
- data/app/views/users/_vitals.html.erb +2 -2
- data/app/views/users/edit.html.erb +39 -39
- data/app/views/users/index.html.erb +3 -3
- data/app/views/users/show.html.erb +7 -9
- data/config/locales/sufia.en.yml +15 -7
- data/config/routes.rb +12 -9
- data/lib/generators/sufia/sufia_generator.rb +18 -15
- data/lib/generators/sufia/templates/catalog_controller.rb +11 -73
- data/lib/generators/sufia/templates/config/tinymce.yml +7 -0
- data/lib/sufia.rb +7 -0
- data/lib/sufia/downloads_controller_behavior.rb +3 -4
- data/lib/sufia/files_controller_behavior.rb +38 -27
- data/lib/sufia/version.rb +1 -1
- data/spec/controllers/batch_controller_spec.rb +1 -1
- data/spec/controllers/batch_edits_controller_spec.rb +5 -5
- data/spec/controllers/catalog_controller_spec.rb +37 -58
- data/spec/controllers/content_blocks_controller_spec.rb +37 -0
- data/spec/controllers/downloads_controller_spec.rb +3 -11
- data/spec/controllers/featured_work_lists_controller_spec.rb +20 -0
- data/spec/controllers/featured_works_controller_spec.rb +50 -0
- data/spec/controllers/generic_files_controller_spec.rb +74 -9
- data/spec/controllers/mailbox_controller_spec.rb +1 -1
- data/spec/controllers/pages_controller_spec.rb +25 -0
- data/spec/controllers/single_use_links_controller_spec.rb +1 -1
- data/spec/controllers/single_use_links_viewer_controller_spec.rb +1 -1
- data/spec/controllers/tinymce_assets_controller_spec.rb +39 -0
- data/spec/controllers/users_controller_spec.rb +3 -8
- data/spec/factories/content_blocks.rb +4 -0
- data/spec/factories/featured_works.rb +4 -0
- data/spec/factories/generic_files.rb +46 -39
- data/spec/factories/users.rb +18 -18
- data/spec/features/browse_dashboard_files_spec.rb +6 -7
- data/spec/features/browse_files_spec.rb +9 -6
- data/spec/features/cloud_upload_spec.rb +18 -0
- data/spec/features/single_use_links_spec.rb +2 -3
- data/spec/helpers/content_block_helper_spec.rb +31 -0
- data/spec/helpers/generic_file_helper_spec.rb +3 -3
- data/spec/helpers/sufia_helper_spec.rb +13 -81
- data/spec/helpers/trophy_helper_spec.rb +39 -0
- data/spec/jobs/import_url_job_spec.rb +1 -1
- data/spec/jobs/ingest_local_file_job_spec.rb +1 -1
- data/spec/lib/sufia/usage_statistics_spec.rb +75 -0
- data/spec/models/ability_spec.rb +31 -0
- data/spec/models/active_fedora_pid_based_job_spec.rb +1 -1
- data/spec/models/audit_job_spec.rb +1 -1
- data/spec/models/batch_spec.rb +1 -1
- data/spec/models/batch_update_job_spec.rb +1 -1
- data/spec/models/event_jobs_spec.rb +1 -1
- data/spec/models/featured_work_list_spec.rb +23 -0
- data/spec/models/featured_work_spec.rb +42 -0
- data/spec/models/fits_datastream_spec.rb +2 -2
- data/spec/models/generic_file/reload_on_save_spec.rb +1 -1
- data/spec/models/generic_file/web_form_spec.rb +4 -4
- data/spec/models/generic_file_spec.rb +41 -40
- data/spec/models/pageview.rb +19 -0
- data/spec/models/properties_datastream_spec.rb +2 -2
- data/spec/models/solr_document_spec.rb +9 -0
- data/spec/models/user_spec.rb +2 -2
- data/spec/routing/featured_works_route_spec.rb +16 -0
- data/spec/routing/route_spec.rb +10 -15
- data/spec/spec_helper.rb +3 -0
- data/spec/support/lib/generators/test_app_generator.rb +19 -8
- data/spec/views/dashboard/facet_limit.html.erb_spec.rb +2 -2
- data/spec/views/generic_file/show.html.erb_spec.rb +44 -0
- data/spec/views/generic_file/stats.html.erb_spec.rb +47 -0
- data/spec/views/users/_follower_modal.html.erb_spec.rb +18 -0
- data/spec/views/users/_following_modal.html.erb_spec.rb +18 -0
- data/spec/views/users/index.html.erb_spec.rb +1 -1
- data/sufia-models/app/models/batch.rb +1 -1
- data/sufia-models/app/models/concerns/sufia/properties_datastream_behavior.rb +30 -0
- data/sufia-models/app/models/concerns/sufia/user.rb +1 -1
- data/sufia-models/app/models/datastreams/batch_rdf_datastream.rb +4 -7
- data/sufia-models/app/models/datastreams/fits_datastream.rb +3 -0
- data/sufia-models/app/models/datastreams/generic_file_rdf_datastream.rb +53 -51
- data/sufia-models/app/models/datastreams/properties_datastream.rb +1 -15
- data/sufia-models/app/models/featured_work.rb +22 -0
- data/sufia-models/app/models/sufia/pageview.rb +9 -0
- data/sufia-models/{lib/sufia/models → app/services/sufia}/id_service.rb +0 -0
- data/sufia-models/{lib/sufia/models → app/services/sufia}/noid.rb +0 -0
- data/sufia-models/app/services/sufia/usage_statistics.rb +73 -0
- data/sufia-models/config/locales/sufia.en.yml +3 -4
- data/sufia-models/lib/generators/sufia/models/install_generator.rb +23 -8
- data/sufia-models/lib/generators/sufia/models/templates/config/analytics.yml +9 -0
- data/sufia-models/lib/generators/sufia/models/templates/config/mime_types.rb +6 -0
- data/sufia-models/lib/generators/sufia/models/templates/config/sufia.rb +11 -2
- data/sufia-models/lib/generators/sufia/models/templates/migrations/create_content_blocks.rb +10 -0
- data/sufia-models/lib/generators/sufia/models/templates/migrations/create_featured_works.rb +12 -0
- data/sufia-models/lib/generators/sufia/models/templates/migrations/create_tinymce_assets.rb +8 -0
- data/sufia-models/lib/generators/sufia/models/usagestats_generator.rb +19 -0
- data/sufia-models/lib/sufia/ability.rb +34 -0
- data/sufia-models/lib/sufia/models/engine.rb +5 -3
- data/sufia-models/lib/sufia/models/generic_file.rb +4 -2
- data/sufia-models/lib/sufia/models/generic_file/export.rb +3 -3
- data/sufia-models/lib/sufia/models/generic_file/featured.rb +14 -0
- data/sufia-models/lib/sufia/models/solr_document_behavior.rb +11 -4
- data/sufia-models/lib/sufia/models/version.rb +1 -1
- data/sufia-models/sufia-models.gemspec +6 -5
- data/sufia.gemspec +6 -4
- data/tasks/release.rake +1 -0
- data/tasks/sufia-dev.rake +5 -1
- data/vendor/assets/javascripts/flot/excanvas.js +1428 -0
- data/vendor/assets/javascripts/flot/jquery.flot.js +3137 -0
- data/vendor/assets/javascripts/flot/jquery.flot.selection.js +360 -0
- data/vendor/assets/javascripts/flot/jquery.flot.time.js +431 -0
- data/vendor/assets/javascripts/nestable.js +647 -0
- data/vendor/assets/javascripts/video.js +135 -126
- data/{app → vendor}/assets/stylesheets/video-js.css.erb +7 -6
- metadata +155 -33
- data/app/assets/stylesheets/application-bootstrap.css.erb +0 -295
- data/app/assets/stylesheets/audio-js.css +0 -3
- data/app/assets/stylesheets/blacklight_more_facets.css +0 -427
- data/app/assets/stylesheets/bootstrap.min.css.erb +0 -1433
- data/app/assets/stylesheets/contact_form.css +0 -4
- data/app/assets/stylesheets/reset_body.css +0 -4
- data/app/assets/stylesheets/trophy.css +0 -7
- data/app/helpers/blacklight/render_constraints_helper_behavior.rb +0 -84
- data/app/helpers/facets_helper.rb +0 -3
- data/app/helpers/sufia/facets_helper_behavior.rb +0 -23
- data/app/views/catalog/_home_text.html.erb +0 -10
- data/app/views/generic_files/_dropbox_import.html.erb +0 -3
- data/app/views/generic_files/upload/_dropbox_chooser.html.erb +0 -39
- data/app/views/static/about.html.erb +0 -21
- data/spec/helpers/render_constraints_helper_behavior_spec.rb +0 -42
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe AuditJob do
|
4
4
|
before do
|
5
|
-
@user = FactoryGirl.find_or_create(:
|
5
|
+
@user = FactoryGirl.find_or_create(:jill)
|
6
6
|
@inbox = @user.mailbox.inbox
|
7
7
|
GenericFile.any_instance.should_receive(:characterize_if_changed).and_yield
|
8
8
|
GenericFile.any_instance.stub(:terms_of_service).and_return('1')
|
data/spec/models/batch_spec.rb
CHANGED
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Batch do
|
4
4
|
before(:all) do
|
5
|
-
@user = FactoryGirl.find_or_create(:
|
5
|
+
@user = FactoryGirl.find_or_create(:jill)
|
6
6
|
GenericFile.any_instance.should_receive(:characterize_if_changed).and_yield
|
7
7
|
GenericFile.any_instance.stub(:terms_of_service).and_return('1')
|
8
8
|
@file = GenericFile.new
|
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe 'event jobs' do
|
4
4
|
before(:each) do
|
5
|
-
@user = FactoryGirl.find_or_create(:
|
5
|
+
@user = FactoryGirl.find_or_create(:jill)
|
6
6
|
@another_user = FactoryGirl.find_or_create(:archivist)
|
7
7
|
@third_user = FactoryGirl.find_or_create(:curator)
|
8
8
|
GenericFile.any_instance.stub(:terms_of_service).and_return('1')
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe FeaturedWorkList do
|
4
|
+
let(:file1) { FactoryGirl.create(:generic_file) }
|
5
|
+
let(:file2) { FactoryGirl.create(:generic_file) }
|
6
|
+
|
7
|
+
before do
|
8
|
+
GenericFile.any_instance.stub(:characterize_if_changed).and_yield
|
9
|
+
FeaturedWork.create(generic_file_id: file1.noid)
|
10
|
+
FeaturedWork.create(generic_file_id: file2.noid)
|
11
|
+
end
|
12
|
+
|
13
|
+
after { GenericFile.destroy_all }
|
14
|
+
|
15
|
+
describe 'featured_works' do
|
16
|
+
it 'should be a list of the featured work objects, each with the generic_file\'s solr_doc' do
|
17
|
+
expect(subject.featured_works.size).to eq 2
|
18
|
+
solr_doc = subject.featured_works.first.generic_file_solr_document
|
19
|
+
expect(solr_doc).to be_kind_of SolrDocument
|
20
|
+
expect(solr_doc.noid).to eq file1.noid
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe FeaturedWork do
|
4
|
+
let(:feature) { FeaturedWork.create(generic_file_id:"99") }
|
5
|
+
|
6
|
+
it "should have a file" do
|
7
|
+
expect(feature.generic_file_id).to eq "99"
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should not allow six features" do
|
11
|
+
5.times do |n|
|
12
|
+
expect(FeaturedWork.create(generic_file_id:n.to_s)).to_not be_new_record
|
13
|
+
end
|
14
|
+
FeaturedWork.create(generic_file_id:"6").tap do |sixth|
|
15
|
+
expect(sixth).to be_new_record
|
16
|
+
expect(sixth.errors.full_messages).to eq ["Limited to 5 featured works."]
|
17
|
+
end
|
18
|
+
expect(FeaturedWork.count).to eq 5
|
19
|
+
end
|
20
|
+
|
21
|
+
describe "can_create_another?" do
|
22
|
+
subject { FeaturedWork }
|
23
|
+
context "when none exist" do
|
24
|
+
its(:can_create_another?) { should be_true }
|
25
|
+
end
|
26
|
+
context "when five exist" do
|
27
|
+
before do
|
28
|
+
5.times do |n|
|
29
|
+
FeaturedWork.create(generic_file_id:n.to_s)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
its(:can_create_another?) { should be_false }
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
describe "#order" do
|
37
|
+
subject { FeaturedWork.new(order: 5) }
|
38
|
+
its(:order) {should eq 5 }
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
|
@@ -72,8 +72,8 @@ describe FitsDatastream, :unless => $in_travis do
|
|
72
72
|
@file.duration.should == ["4.97 s"]
|
73
73
|
end
|
74
74
|
it "should have a frame_rate" do
|
75
|
-
@file.frame_rate.should ==
|
75
|
+
@file.frame_rate.count.should == 1
|
76
|
+
@file.frame_rate[0].to_f.should == 30.0
|
76
77
|
end
|
77
78
|
end
|
78
79
|
end
|
79
|
-
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Sufia::GenericFile::ReloadOnSave do
|
4
|
-
let(:user) { FactoryGirl.find_or_create(:
|
4
|
+
let(:user) { FactoryGirl.find_or_create(:jill) }
|
5
5
|
let(:file) { GenericFile.new.tap { |f| f.apply_depositor_metadata(user); f.save! } }
|
6
6
|
|
7
7
|
it 'defaults to not call reload' do
|
@@ -7,13 +7,13 @@ describe GenericFile do
|
|
7
7
|
|
8
8
|
describe "terms_for_editing" do
|
9
9
|
it "should return a list" do
|
10
|
-
subject.terms_for_editing.should == [:resource_type, :title, :creator, :contributor, :description, :tag,
|
10
|
+
subject.terms_for_editing.should == [:resource_type, :title, :creator, :contributor, :description, :tag,
|
11
11
|
:rights, :publisher, :date_created, :subject, :language, :identifier, :based_near, :related_url]
|
12
12
|
end
|
13
13
|
end
|
14
14
|
describe "terms_for_display" do
|
15
15
|
it "should return a list" do
|
16
|
-
expect(subject.terms_for_display).to eq([:resource_type, :title,
|
16
|
+
expect(subject.terms_for_display).to eq([:resource_type, :title,
|
17
17
|
:creator, :contributor, :description, :tag, :rights, :publisher,
|
18
18
|
:date_created, :date_uploaded, :date_modified, :subject, :language,
|
19
19
|
:identifier, :based_near, :related_url])
|
@@ -22,8 +22,8 @@ describe GenericFile do
|
|
22
22
|
|
23
23
|
describe "accessible_attributes" do
|
24
24
|
it "should have a list" do
|
25
|
-
subject.accessible_attributes.should == [:part_of, :resource_type, :title, :creator, :contributor, :description,
|
26
|
-
:tag, :rights, :publisher, :date_created, :date_uploaded, :date_modified, :subject, :language, :identifier,
|
25
|
+
subject.accessible_attributes.should == [:part_of, :resource_type, :title, :creator, :contributor, :description,
|
26
|
+
:tag, :rights, :publisher, :date_created, :date_uploaded, :date_modified, :subject, :language, :identifier,
|
27
27
|
:based_near, :related_url, :permissions]
|
28
28
|
end
|
29
29
|
|
@@ -291,7 +291,7 @@ describe GenericFile do
|
|
291
291
|
local[Solrizer.solr_name("desc_metadata__date_uploaded", :stored_sortable, type: :date)].should == '2011-01-01T00:00:00Z'
|
292
292
|
local[Solrizer.solr_name("desc_metadata__date_modified", :stored_sortable, type: :date)].should == '2012-01-01T00:00:00Z'
|
293
293
|
local[Solrizer.solr_name("desc_metadata__rights")].should == ["Wide open, buddy."]
|
294
|
-
local[Solrizer.solr_name("desc_metadata__related_url")].should
|
294
|
+
local[Solrizer.solr_name("desc_metadata__related_url")].should == ["http://example.org/TheWork/"]
|
295
295
|
local[Solrizer.solr_name("desc_metadata__contributor")].should == ["Mohammad"]
|
296
296
|
local[Solrizer.solr_name("desc_metadata__creator")].should == ["Allah"]
|
297
297
|
local[Solrizer.solr_name("desc_metadata__title")].should == ["The Work"]
|
@@ -304,7 +304,7 @@ describe GenericFile do
|
|
304
304
|
local[Solrizer.solr_name("file_format")].should == "jpeg (JPEG Image)"
|
305
305
|
local[Solrizer.solr_name("desc_metadata__identifier")].should == ["urn:isbn:1234567890"]
|
306
306
|
local[Solrizer.solr_name("desc_metadata__based_near")].should == ["Medina, Saudi Arabia"]
|
307
|
-
local[Solrizer.solr_name("mime_type")].should == ["image/jpeg"]
|
307
|
+
local[Solrizer.solr_name("mime_type")].should == ["image/jpeg"]
|
308
308
|
local["noid_tsi"].should eq('stubbed_pid')
|
309
309
|
end
|
310
310
|
it "should support multi-valued fields in solr" do
|
@@ -340,7 +340,7 @@ describe GenericFile do
|
|
340
340
|
end
|
341
341
|
describe "trophies" do
|
342
342
|
before do
|
343
|
-
u = FactoryGirl.create(:
|
343
|
+
u = FactoryGirl.create(:jill)
|
344
344
|
@f = GenericFile.new.tap do |gf|
|
345
345
|
gf.apply_depositor_metadata(u)
|
346
346
|
gf.stub(:characterize_if_changed).and_yield #don't run characterization
|
@@ -357,9 +357,10 @@ describe GenericFile do
|
|
357
357
|
Trophy.where(generic_file_id: @f.pid).count.should == 0
|
358
358
|
end
|
359
359
|
end
|
360
|
+
|
360
361
|
describe "audit" do
|
361
|
-
before
|
362
|
-
u = FactoryGirl.create(:
|
362
|
+
before do
|
363
|
+
u = FactoryGirl.create(:jill)
|
363
364
|
f = GenericFile.new
|
364
365
|
f.add_file(File.open(fixture_path + '/world.png'), 'content', 'world.png')
|
365
366
|
f.apply_depositor_metadata(u)
|
@@ -584,19 +585,19 @@ describe GenericFile do
|
|
584
585
|
it "should have read groups writer" do
|
585
586
|
subject.read_groups = ['group-2', 'group-3']
|
586
587
|
subject.rightsMetadata.groups.should == {'group-2' => 'read', 'group-3'=>'read', 'group-8' => 'edit'}
|
587
|
-
subject.rightsMetadata.
|
588
|
+
subject.rightsMetadata.users.should == {"person1"=>"read","person2"=>"read", 'jcoyne' => 'edit'}
|
588
589
|
end
|
589
590
|
|
590
591
|
it "should have read groups string writer" do
|
591
592
|
subject.read_groups_string = 'umg/up.dlt.staff, group-3'
|
592
593
|
subject.rightsMetadata.groups.should == {'umg/up.dlt.staff' => 'read', 'group-3'=>'read', 'group-8' => 'edit'}
|
593
|
-
subject.rightsMetadata.
|
594
|
+
subject.rightsMetadata.users.should == {"person1"=>"read","person2"=>"read", 'jcoyne' => 'edit'}
|
594
595
|
end
|
595
596
|
it "should only revoke eligible groups" do
|
596
597
|
subject.set_read_groups(['group-2', 'group-3'], ['group-6'])
|
597
598
|
# 'group-7' is not eligible to be revoked
|
598
599
|
subject.rightsMetadata.groups.should == {'group-2' => 'read', 'group-3'=>'read', 'group-7' => 'read', 'group-8' => 'edit'}
|
599
|
-
subject.rightsMetadata.
|
600
|
+
subject.rightsMetadata.users.should == {"person1"=>"read","person2"=>"read", 'jcoyne' => 'edit'}
|
600
601
|
end
|
601
602
|
end
|
602
603
|
describe "permissions validation" do
|
@@ -637,7 +638,7 @@ describe GenericFile do
|
|
637
638
|
it "should work via permissions=()" do
|
638
639
|
@file.permissions = {:user => {'mjg36' => 'read'}}
|
639
640
|
lambda { @file.save }.should_not raise_error
|
640
|
-
@file.
|
641
|
+
@file.new_record?.should be_true
|
641
642
|
@file.errors.should include(:edit_users)
|
642
643
|
@file.errors[:edit_users].should include('Depositor must have edit access')
|
643
644
|
@file.valid?.should be_false
|
@@ -645,7 +646,7 @@ describe GenericFile do
|
|
645
646
|
it "should work via update_attributes" do
|
646
647
|
# automatically triggers save
|
647
648
|
lambda { @file.update_attributes(:read_users_string => 'mjg36') }.should_not raise_error
|
648
|
-
@file.
|
649
|
+
@file.new_record?.should be_true
|
649
650
|
@file.errors.should include(:edit_users)
|
650
651
|
@file.errors[:edit_users].should include('Depositor must have edit access')
|
651
652
|
@file.valid?.should be_false
|
@@ -653,7 +654,7 @@ describe GenericFile do
|
|
653
654
|
it "should work via update_indexed_attributes" do
|
654
655
|
@rightsmd.update_indexed_attributes([:edit_access, :person] => '')
|
655
656
|
lambda { @file.save }.should_not raise_error
|
656
|
-
@file.
|
657
|
+
@file.new_record?.should be_true
|
657
658
|
@file.errors.should include(:edit_users)
|
658
659
|
@file.errors[:edit_users].should include('Depositor must have edit access')
|
659
660
|
@file.valid?.should be_false
|
@@ -661,7 +662,7 @@ describe GenericFile do
|
|
661
662
|
it "should work via permissions()" do
|
662
663
|
@rightsmd.permissions({:person => "mjg36"}, "read")
|
663
664
|
lambda { @file.save }.should_not raise_error
|
664
|
-
@file.
|
665
|
+
@file.new_record?.should be_true
|
665
666
|
@file.errors.should include(:edit_users)
|
666
667
|
@file.errors[:edit_users].should include('Depositor must have edit access')
|
667
668
|
@file.valid?.should be_false
|
@@ -669,7 +670,7 @@ describe GenericFile do
|
|
669
670
|
it "should work via update_permissions()" do
|
670
671
|
@rightsmd.update_permissions({"person" => {"mjg36" => "read"}})
|
671
672
|
lambda { @file.save }.should_not raise_error
|
672
|
-
@file.
|
673
|
+
@file.new_record?.should be_true
|
673
674
|
@file.errors.should include(:edit_users)
|
674
675
|
@file.errors[:edit_users].should include('Depositor must have edit access')
|
675
676
|
@file.valid?.should be_false
|
@@ -677,7 +678,7 @@ describe GenericFile do
|
|
677
678
|
it "should work via content=()" do
|
678
679
|
@rightsmd.content=(@rights_xml)
|
679
680
|
lambda { @file.save }.should_not raise_error
|
680
|
-
@file.
|
681
|
+
@file.new_record?.should be_true
|
681
682
|
@file.errors.should include(:edit_users)
|
682
683
|
@file.errors[:edit_users].should include('Depositor must have edit access')
|
683
684
|
@file.valid?.should be_false
|
@@ -685,7 +686,7 @@ describe GenericFile do
|
|
685
686
|
it "should work via ng_xml=()" do
|
686
687
|
@rightsmd.ng_xml=(Nokogiri::XML::Document.parse(@rights_xml))
|
687
688
|
lambda { @file.save }.should_not raise_error
|
688
|
-
@file.
|
689
|
+
@file.new_record?.should be_true
|
689
690
|
@file.errors.should include(:edit_users)
|
690
691
|
@file.errors[:edit_users].should include('Depositor must have edit access')
|
691
692
|
@file.valid?.should be_false
|
@@ -693,7 +694,7 @@ describe GenericFile do
|
|
693
694
|
it "should work via update_values()" do
|
694
695
|
@rightsmd.update_values([:edit_access, :person] => '')
|
695
696
|
lambda { @file.save }.should_not raise_error
|
696
|
-
@file.
|
697
|
+
@file.new_record?.should be_true
|
697
698
|
@file.errors.should include(:edit_users)
|
698
699
|
@file.errors[:edit_users].should include('Depositor must have edit access')
|
699
700
|
@file.valid?.should be_false
|
@@ -737,7 +738,7 @@ describe GenericFile do
|
|
737
738
|
it "should work via permissions=()" do
|
738
739
|
@file.permissions = {:group => {'public' => 'edit'}}
|
739
740
|
lambda { @file.save }.should_not raise_error
|
740
|
-
@file.
|
741
|
+
@file.new_record?.should be_true
|
741
742
|
@file.errors.should include(:edit_groups)
|
742
743
|
@file.errors[:edit_groups].should include('Public cannot have edit access')
|
743
744
|
@file.valid?.should be_false
|
@@ -745,7 +746,7 @@ describe GenericFile do
|
|
745
746
|
it "should work via update_attributes" do
|
746
747
|
# automatically triggers save
|
747
748
|
lambda { @file.update_attributes(:edit_groups_string => 'public') }.should_not raise_error
|
748
|
-
@file.
|
749
|
+
@file.new_record?.should be_true
|
749
750
|
@file.errors.should include(:edit_groups)
|
750
751
|
@file.errors[:edit_groups].should include('Public cannot have edit access')
|
751
752
|
@file.valid?.should be_false
|
@@ -753,7 +754,7 @@ describe GenericFile do
|
|
753
754
|
it "should work via update_indexed_attributes" do
|
754
755
|
@rightsmd.update_indexed_attributes([:edit_access, :group] => 'public')
|
755
756
|
lambda { @file.save }.should_not raise_error
|
756
|
-
@file.
|
757
|
+
@file.new_record?.should be_true
|
757
758
|
@file.errors.should include(:edit_groups)
|
758
759
|
@file.errors[:edit_groups].should include('Public cannot have edit access')
|
759
760
|
@file.valid?.should be_false
|
@@ -761,7 +762,7 @@ describe GenericFile do
|
|
761
762
|
it "should work via permissions()" do
|
762
763
|
@rightsmd.permissions({:group => "public"}, "edit")
|
763
764
|
lambda { @file.save }.should_not raise_error
|
764
|
-
@file.
|
765
|
+
@file.new_record?.should be_true
|
765
766
|
@file.errors.should include(:edit_groups)
|
766
767
|
@file.errors[:edit_groups].should include('Public cannot have edit access')
|
767
768
|
@file.valid?.should be_false
|
@@ -769,7 +770,7 @@ describe GenericFile do
|
|
769
770
|
it "should work via update_permissions()" do
|
770
771
|
@rightsmd.update_permissions({"group" => {"public" => "edit"}})
|
771
772
|
lambda { @file.save }.should_not raise_error
|
772
|
-
@file.
|
773
|
+
@file.new_record?.should be_true
|
773
774
|
@file.errors.should include(:edit_groups)
|
774
775
|
@file.errors[:edit_groups].should include('Public cannot have edit access')
|
775
776
|
@file.valid?.should be_false
|
@@ -777,7 +778,7 @@ describe GenericFile do
|
|
777
778
|
it "should work via content=()" do
|
778
779
|
@rightsmd.content=(@rights_xml)
|
779
780
|
lambda { @file.save }.should_not raise_error
|
780
|
-
@file.
|
781
|
+
@file.new_record?.should be_true
|
781
782
|
@file.errors.should include(:edit_groups)
|
782
783
|
@file.errors[:edit_groups].should include('Public cannot have edit access')
|
783
784
|
@file.valid?.should be_false
|
@@ -785,7 +786,7 @@ describe GenericFile do
|
|
785
786
|
it "should work via ng_xml=()" do
|
786
787
|
@rightsmd.ng_xml=(Nokogiri::XML::Document.parse(@rights_xml))
|
787
788
|
lambda { @file.save }.should_not raise_error
|
788
|
-
@file.
|
789
|
+
@file.new_record?.should be_true
|
789
790
|
@file.errors.should include(:edit_groups)
|
790
791
|
@file.errors[:edit_groups].should include('Public cannot have edit access')
|
791
792
|
@file.valid?.should be_false
|
@@ -793,7 +794,7 @@ describe GenericFile do
|
|
793
794
|
it "should work via update_values()" do
|
794
795
|
@rightsmd.update_values([:edit_access, :group] => 'public')
|
795
796
|
lambda { @file.save }.should_not raise_error
|
796
|
-
@file.
|
797
|
+
@file.new_record?.should be_true
|
797
798
|
@file.errors.should include(:edit_groups)
|
798
799
|
@file.errors[:edit_groups].should include('Public cannot have edit access')
|
799
800
|
@file.valid?.should be_false
|
@@ -837,7 +838,7 @@ describe GenericFile do
|
|
837
838
|
it "should work via permissions=()" do
|
838
839
|
@file.permissions = {:group => {'registered' => 'edit'}}
|
839
840
|
lambda { @file.save }.should_not raise_error
|
840
|
-
@file.
|
841
|
+
@file.new_record?.should be_true
|
841
842
|
@file.errors.should include(:edit_groups)
|
842
843
|
@file.errors[:edit_groups].should include('Registered cannot have edit access')
|
843
844
|
@file.valid?.should be_false
|
@@ -845,7 +846,7 @@ describe GenericFile do
|
|
845
846
|
it "should work via update_attributes" do
|
846
847
|
# automatically triggers save
|
847
848
|
lambda { @file.update_attributes(:edit_groups_string => 'registered') }.should_not raise_error
|
848
|
-
@file.
|
849
|
+
@file.new_record?.should be_true
|
849
850
|
@file.errors.should include(:edit_groups)
|
850
851
|
@file.errors[:edit_groups].should include('Registered cannot have edit access')
|
851
852
|
@file.valid?.should be_false
|
@@ -853,7 +854,7 @@ describe GenericFile do
|
|
853
854
|
it "should work via update_indexed_attributes" do
|
854
855
|
@rightsmd.update_indexed_attributes([:edit_access, :group] => 'registered')
|
855
856
|
lambda { @file.save }.should_not raise_error
|
856
|
-
@file.
|
857
|
+
@file.new_record?.should be_true
|
857
858
|
@file.errors.should include(:edit_groups)
|
858
859
|
@file.errors[:edit_groups].should include('Registered cannot have edit access')
|
859
860
|
@file.valid?.should be_false
|
@@ -861,7 +862,7 @@ describe GenericFile do
|
|
861
862
|
it "should work via permissions()" do
|
862
863
|
@rightsmd.permissions({:group => "registered"}, "edit")
|
863
864
|
lambda { @file.save }.should_not raise_error
|
864
|
-
@file.
|
865
|
+
@file.new_record?.should be_true
|
865
866
|
@file.errors.should include(:edit_groups)
|
866
867
|
@file.errors[:edit_groups].should include('Registered cannot have edit access')
|
867
868
|
@file.valid?.should be_false
|
@@ -869,7 +870,7 @@ describe GenericFile do
|
|
869
870
|
it "should work via update_permissions()" do
|
870
871
|
@rightsmd.update_permissions({"group" => {"registered" => "edit"}})
|
871
872
|
lambda { @file.save }.should_not raise_error
|
872
|
-
@file.
|
873
|
+
@file.new_record?.should be_true
|
873
874
|
@file.errors.should include(:edit_groups)
|
874
875
|
@file.errors[:edit_groups].should include('Registered cannot have edit access')
|
875
876
|
@file.valid?.should be_false
|
@@ -877,7 +878,7 @@ describe GenericFile do
|
|
877
878
|
it "should work via content=()" do
|
878
879
|
@rightsmd.content=(@rights_xml)
|
879
880
|
lambda { @file.save }.should_not raise_error
|
880
|
-
@file.
|
881
|
+
@file.new_record?.should be_true
|
881
882
|
@file.errors.should include(:edit_groups)
|
882
883
|
@file.errors[:edit_groups].should include('Registered cannot have edit access')
|
883
884
|
@file.valid?.should be_false
|
@@ -885,7 +886,7 @@ describe GenericFile do
|
|
885
886
|
it "should work via ng_xml=()" do
|
886
887
|
@rightsmd.ng_xml=(Nokogiri::XML::Document.parse(@rights_xml))
|
887
888
|
lambda { @file.save }.should_not raise_error
|
888
|
-
@file.
|
889
|
+
@file.new_record?.should be_true
|
889
890
|
@file.errors.should include(:edit_groups)
|
890
891
|
@file.errors[:edit_groups].should include('Registered cannot have edit access')
|
891
892
|
@file.valid?.should be_false
|
@@ -893,7 +894,7 @@ describe GenericFile do
|
|
893
894
|
it "should work via update_values()" do
|
894
895
|
@rightsmd.update_values([:edit_access, :group] => 'registered')
|
895
896
|
lambda { @file.save }.should_not raise_error
|
896
|
-
@file.
|
897
|
+
@file.new_record?.should be_true
|
897
898
|
@file.errors.should include(:edit_groups)
|
898
899
|
@file.errors[:edit_groups].should include('Registered cannot have edit access')
|
899
900
|
@file.valid?.should be_false
|
@@ -939,56 +940,56 @@ describe GenericFile do
|
|
939
940
|
it "should work via permissions=()" do
|
940
941
|
@file.permissions = {:group => {'registered' => 'read'}}
|
941
942
|
lambda { @file.save }.should_not raise_error
|
942
|
-
@file.
|
943
|
+
@file.new_record?.should be_false
|
943
944
|
@file.errors.should be_empty
|
944
945
|
@file.valid?.should be_true
|
945
946
|
end
|
946
947
|
it "should work via update_attributes" do
|
947
948
|
# automatically triggers save
|
948
949
|
lambda { @file.update_attributes(:read_groups_string => 'registered') }.should_not raise_error
|
949
|
-
@file.
|
950
|
+
@file.new_record?.should be_false
|
950
951
|
@file.errors.should be_empty
|
951
952
|
@file.valid?.should be_true
|
952
953
|
end
|
953
954
|
it "should work via update_indexed_attributes" do
|
954
955
|
@rightsmd.update_indexed_attributes([:read_access, :group] => 'registered')
|
955
956
|
lambda { @file.save }.should_not raise_error
|
956
|
-
@file.
|
957
|
+
@file.new_record?.should be_false
|
957
958
|
@file.errors.should be_empty
|
958
959
|
@file.valid?.should be_true
|
959
960
|
end
|
960
961
|
it "should work via permissions()" do
|
961
962
|
@rightsmd.permissions({:group => "registered"}, "read")
|
962
963
|
lambda { @file.save }.should_not raise_error
|
963
|
-
@file.
|
964
|
+
@file.new_record?.should be_false
|
964
965
|
@file.errors.should be_empty
|
965
966
|
@file.valid?.should be_true
|
966
967
|
end
|
967
968
|
it "should work via update_permissions()" do
|
968
969
|
@rightsmd.update_permissions({"group" => {"registered" => "read"}})
|
969
970
|
lambda { @file.save }.should_not raise_error
|
970
|
-
@file.
|
971
|
+
@file.new_record?.should be_false
|
971
972
|
@file.errors.should be_empty
|
972
973
|
@file.valid?.should be_true
|
973
974
|
end
|
974
975
|
it "should work via content=()" do
|
975
976
|
@rightsmd.content=(@rights_xml)
|
976
977
|
lambda { @file.save }.should_not raise_error
|
977
|
-
@file.
|
978
|
+
@file.new_record?.should be_false
|
978
979
|
@file.errors.should be_empty
|
979
980
|
@file.valid?.should be_true
|
980
981
|
end
|
981
982
|
it "should work via ng_xml=()" do
|
982
983
|
@rightsmd.ng_xml=(Nokogiri::XML::Document.parse(@rights_xml))
|
983
984
|
lambda { @file.save }.should_not raise_error
|
984
|
-
@file.
|
985
|
+
@file.new_record?.should be_false
|
985
986
|
@file.errors.should be_empty
|
986
987
|
@file.valid?.should be_true
|
987
988
|
end
|
988
989
|
it "should work via update_values()" do
|
989
990
|
@rightsmd.update_values([:read_access, :group] => 'registered')
|
990
991
|
lambda { @file.save }.should_not raise_error
|
991
|
-
@file.
|
992
|
+
@file.new_record?.should be_false
|
992
993
|
@file.errors.should be_empty
|
993
994
|
@file.valid?.should be_true
|
994
995
|
end
|