sufia 6.2.0 → 6.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +146 -0
- data/.travis.yml +4 -7
- data/Gemfile +2 -0
- data/History.md +29 -1
- data/README.md +25 -9
- data/SUFIA_VERSION +1 -1
- data/app/assets/stylesheets/sufia/_collections.scss +15 -0
- data/app/assets/stylesheets/sufia/_file-listing.scss +7 -0
- data/app/assets/stylesheets/sufia/_home-page.scss +10 -0
- data/app/builders/sufia/bootstrap_breadcrumbs_builder.rb +3 -5
- data/app/controllers/admin/stats_controller.rb +1 -76
- data/app/controllers/api/items_controller.rb +4 -6
- data/app/controllers/api/zotero_controller.rb +5 -5
- data/app/controllers/authorities_controller.rb +5 -1
- data/app/controllers/batch_edits_controller.rb +3 -3
- data/app/controllers/concerns/sufia/admin/depositor_stats.rb +41 -0
- data/app/controllers/concerns/sufia/admin/stats_behavior.rb +94 -0
- data/app/controllers/concerns/sufia/batch_controller_behavior.rb +16 -18
- data/app/controllers/concerns/sufia/batch_edits_controller_behavior.rb +54 -56
- data/app/controllers/concerns/sufia/breadcrumbs.rb +3 -6
- data/app/controllers/concerns/sufia/collections_controller_behavior.rb +39 -39
- data/app/controllers/concerns/sufia/controller.rb +10 -10
- data/app/controllers/concerns/sufia/dashboard_controller_behavior.rb +17 -18
- data/app/controllers/concerns/sufia/depositors_controller_behavior.rb +9 -12
- data/app/controllers/concerns/sufia/files_controller/browse_everything.rb +6 -7
- data/app/controllers/concerns/sufia/files_controller/local_ingest_behavior.rb +39 -40
- data/app/controllers/concerns/sufia/files_controller/upload_complete_behavior.rb +1 -1
- data/app/controllers/concerns/sufia/files_controller_behavior.rb +109 -110
- data/app/controllers/concerns/sufia/homepage_controller.rb +8 -8
- data/app/controllers/concerns/sufia/my_controller_behavior.rb +13 -10
- data/app/controllers/concerns/sufia/single_use_links_controller_behavior.rb +11 -14
- data/app/controllers/concerns/sufia/single_use_links_viewer_controller_behavior.rb +27 -21
- data/app/controllers/concerns/sufia/transfers_controller_behavior.rb +17 -17
- data/app/controllers/concerns/sufia/users_controller_behavior.rb +54 -54
- data/app/controllers/contact_form_controller.rb +1 -1
- data/app/controllers/content_blocks_controller.rb +11 -12
- data/app/controllers/directory_controller.rb +2 -3
- data/app/controllers/featured_work_lists_controller.rb +1 -1
- data/app/controllers/featured_works_controller.rb +2 -4
- data/app/controllers/homepage_controller.rb +1 -2
- data/app/controllers/mailbox_controller.rb +12 -32
- data/app/controllers/my/collections_controller.rb +3 -4
- data/app/controllers/my/files_controller.rb +4 -6
- data/app/controllers/my/highlights_controller.rb +4 -6
- data/app/controllers/my/shares_controller.rb +3 -5
- data/app/controllers/pages_controller.rb +1 -3
- data/app/controllers/single_use_links_controller.rb +0 -1
- data/app/controllers/single_use_links_viewer_controller.rb +0 -1
- data/app/controllers/static_controller.rb +1 -0
- data/app/forms/sufia/forms/collection_edit_form.rb +2 -2
- data/app/helpers/batch_edits_helper.rb +1 -3
- data/app/helpers/content_block_helper.rb +7 -8
- data/app/helpers/generic_file_helper.rb +23 -24
- data/app/helpers/sufia/blacklight_override.rb +6 -7
- data/app/helpers/sufia/dashboard_helper_behavior.rb +4 -7
- data/app/helpers/sufia/permissions_helper.rb +3 -4
- data/app/helpers/sufia/sufia_helper_behavior.rb +30 -29
- data/app/helpers/trophy_helper.rb +15 -15
- data/app/inputs/select_with_modal_help_input.rb +3 -3
- data/app/inputs/with_help_icon.rb +4 -4
- data/app/jobs/content_delete_event_job.rb +0 -1
- data/app/jobs/content_depositor_change_event_job.rb +1 -2
- data/app/jobs/event_job.rb +0 -1
- data/app/jobs/user_unfollow_event_job.rb +1 -0
- data/app/models/concerns/sufia/solr_document_behavior.rb +1 -2
- data/app/models/contact_form.rb +6 -6
- data/app/models/content_block.rb +1 -2
- data/app/models/featured_work_list.rb +3 -5
- data/app/models/user_mailbox.rb +44 -0
- data/app/presenters/sufia/collection_presenter.rb +6 -8
- data/app/presenters/sufia/generic_file_presenter.rb +2 -2
- data/app/presenters/sufia/presenter_renderer.rb +2 -2
- data/app/presenters/sufia/version_list_presenter.rb +1 -1
- data/app/presenters/sufia/version_presenter.rb +3 -6
- data/app/search_builders/deposit_search_builder.rb +19 -0
- data/app/search_builders/sufia/my_search_builder_behavior.rb +1 -2
- data/app/search_builders/sufia/search_builder.rb +1 -3
- data/app/uploaders/tinymce_asset_uploader.rb +0 -2
- data/app/views/_controls.html.erb +5 -5
- data/app/views/admin/stats/_deposits.html.erb +19 -0
- data/app/views/admin/stats/index.html.erb +2 -0
- data/app/views/batch_edits/edit.html.erb +2 -2
- data/app/views/collections/_edit_actions.html.erb +3 -3
- data/app/views/collections/_form_for_select_collection.html.erb +2 -2
- data/app/views/collections/_sort_and_per_page.html.erb +12 -9
- data/app/views/collections/_view_type_group.html.erb +1 -1
- data/app/views/collections/edit.html.erb +5 -5
- data/app/views/collections/show.html.erb +7 -6
- data/app/views/homepage/_announcement.html.erb +5 -0
- data/app/views/homepage/_home.html.erb +1 -0
- data/app/views/my/_sort_and_per_page.html.erb +14 -10
- data/app/views/my/index.html.erb +1 -1
- data/app/views/pages/show.html.erb +0 -2
- data/app/views/single_use_links/new_download.html.erb +1 -1
- data/app/views/single_use_links_viewer/show.html.erb +1 -1
- data/app/views/users/_notify_link.html.erb +1 -1
- data/app/views/users/_notify_number.html.erb +2 -2
- data/config/initializers/simple_form.rb +1 -1
- data/config/initializers/simple_form_bootstrap.rb +1 -1
- data/config/locales/sufia.en.yml +4 -0
- data/config/routes.rb +2 -3
- data/lib/generators/sufia/admin_stat_generator.rb +0 -3
- data/lib/generators/sufia/install_generator.rb +8 -9
- data/lib/generators/sufia/templates/catalog_controller.rb +2 -3
- data/lib/generators/sufia/templates/config/action_dispatch_http_upload_monkey_patch.rb +1 -0
- data/lib/generators/sufia/upgrade400_generator.rb +9 -9
- data/lib/generators/sufia/upgrade600_generator.rb +1 -4
- data/lib/sufia.rb +2 -2
- data/lib/sufia/arkivo/actor.rb +1 -1
- data/lib/sufia/arkivo/create_subscription_job.rb +30 -30
- data/lib/sufia/arkivo/metadata_munger.rb +7 -7
- data/lib/sufia/arkivo/schema_validator.rb +1 -1
- data/lib/sufia/single_use_error.rb +0 -1
- data/lib/sufia/version.rb +1 -1
- data/lib/sufia/zotero/config.rb +13 -13
- data/spec/actors/generic_file/actor_spec.rb +17 -18
- data/spec/controllers/admin_stats_controller_spec.rb +56 -5
- data/spec/controllers/api/zotero_controller_spec.rb +10 -9
- data/spec/controllers/authorities_controller_spec.rb +8 -8
- data/spec/controllers/batch_controller_spec.rb +19 -20
- data/spec/controllers/batch_edits_controller_spec.rb +8 -9
- data/spec/controllers/catalog_controller_spec.rb +7 -9
- data/spec/controllers/collections_controller_spec.rb +30 -32
- data/spec/controllers/content_blocks_controller_spec.rb +4 -4
- data/spec/controllers/dashboard_controller_spec.rb +12 -12
- data/spec/controllers/depositors_controller_spec.rb +8 -8
- data/spec/controllers/downloads_controller_spec.rb +10 -11
- data/spec/controllers/featured_work_lists_controller_spec.rb +4 -4
- data/spec/controllers/featured_works_controller_spec.rb +11 -12
- data/spec/controllers/generic_files_controller_spec.rb +154 -125
- data/spec/controllers/homepage_controller_spec.rb +22 -15
- data/spec/controllers/mailbox_controller_spec.rb +20 -36
- data/spec/controllers/my/collections_controller_spec.rb +4 -5
- data/spec/controllers/my/files_controller_spec.rb +10 -11
- data/spec/controllers/my/highlights_controller_spec.rb +4 -5
- data/spec/controllers/my/shares_controller_spec.rb +12 -14
- data/spec/controllers/my_controller_spec.rb +1 -3
- data/spec/controllers/pages_controller_spec.rb +4 -4
- data/spec/controllers/single_use_links_controller_spec.rb +1 -3
- data/spec/controllers/single_use_links_viewer_controller_spec.rb +1 -2
- data/spec/controllers/static_controller_spec.rb +1 -1
- data/spec/controllers/tinymce_assets_controller_spec.rb +8 -9
- data/spec/controllers/transfers_controller_spec.rb +19 -19
- data/spec/controllers/users_controller_spec.rb +33 -35
- data/spec/factories/api_items.rb +2 -2
- data/spec/factories/content_blocks.rb +1 -1
- data/spec/factories/featured_works.rb +1 -1
- data/spec/factories/generic_files.rb +3 -3
- data/spec/factories/users.rb +7 -8
- data/spec/features/browse_dashboard_files_spec.rb +14 -18
- data/spec/features/browse_files_spec.rb +3 -4
- data/spec/features/catalog_search_spec.rb +3 -5
- data/spec/features/cloud_upload_spec.rb +2 -2
- data/spec/features/collection_spec.rb +21 -21
- data/spec/features/contact_form_spec.rb +10 -11
- data/spec/features/display_dashboard_spec.rb +5 -9
- data/spec/features/edit_file_spec.rb +8 -9
- data/spec/features/featured_item_spec.rb +1 -1
- data/spec/features/ingest_upload_files_spec.rb +5 -5
- data/spec/features/notifications_spec.rb +2 -6
- data/spec/features/ownership_transfer_spec.rb +2 -2
- data/spec/features/proxy_spec.rb +2 -2
- data/spec/features/search_spec.rb +3 -4
- data/spec/features/single_use_links_spec.rb +1 -1
- data/spec/features/users_spec.rb +4 -5
- data/spec/forms/collection_edit_form_spec.rb +2 -2
- data/spec/forms/generic_file_edit_form_spec.rb +6 -7
- data/spec/helpers/batch_edits_helper_spec.rb +9 -13
- data/spec/helpers/content_block_helper_spec.rb +3 -3
- data/spec/helpers/dashboard_helper_spec.rb +19 -24
- data/spec/helpers/generic_file_helper_spec.rb +5 -7
- data/spec/helpers/sufia_helper_spec.rb +43 -54
- data/spec/helpers/trophy_helper_spec.rb +5 -5
- data/spec/inputs/multi_value_with_help_input_spec.rb +1 -2
- data/spec/inputs/select_with_help_input_spec.rb +19 -15
- data/spec/javascripts/jasmine_spec.rb +4 -5
- data/spec/javascripts/support/jasmine_helper.rb +9 -9
- data/spec/jobs/active_fedora_id_based_job_spec.rb +7 -5
- data/spec/jobs/audit_job_spec.rb +7 -7
- data/spec/jobs/batch_update_job_spec.rb +5 -6
- data/spec/jobs/characterize_job_spec.rb +1 -1
- data/spec/jobs/content_depositor_change_event_job_spec.rb +1 -1
- data/spec/jobs/create_derivatives_job_spec.rb +5 -5
- data/spec/jobs/event_jobs_spec.rb +16 -16
- data/spec/jobs/import_url_job_spec.rb +36 -5
- data/spec/jobs/ingest_local_file_job_spec.rb +31 -20
- data/spec/jobs/sufia_resque_queue_spec.rb +1 -1
- data/spec/lib/sufia/analytics_spec.rb +0 -1
- data/spec/lib/sufia/arkivo/actor_spec.rb +6 -6
- data/spec/lib/sufia/arkivo/schema_validator_spec.rb +18 -18
- data/spec/lib/sufia/breadcrumbs_spec.rb +5 -6
- data/spec/lib/sufia/messages_spec.rb +11 -12
- data/spec/lib/sufia/readable_permissions_spec.rb +8 -10
- data/spec/lib/sufia/upload_complete_behavior_spec.rb +6 -7
- data/spec/lib/sufia/user_stat_importer_spec.rb +30 -33
- data/spec/lib/sufia/writable_permissions_spec.rb +1 -3
- data/spec/lib/sufia/zotero/config_spec.rb +4 -6
- data/spec/models/ability_spec.rb +11 -9
- data/spec/models/batch_spec.rb +13 -13
- data/spec/models/characterization_spec.rb +2 -3
- data/spec/models/checksum_audit_log_spec.rb +18 -19
- data/spec/models/collection_spec.rb +11 -12
- data/spec/models/content_block_spec.rb +33 -22
- data/spec/models/download_spec.rb +3 -5
- data/spec/models/featured_work_list_spec.rb +3 -3
- data/spec/models/featured_work_spec.rb +12 -14
- data/spec/models/file_content_datastream_spec.rb +9 -7
- data/spec/models/file_download_stat_spec.rb +34 -40
- data/spec/models/file_usage_spec.rb +46 -52
- data/spec/models/file_view_stat_spec.rb +35 -41
- data/spec/models/fits_datastream_spec.rb +23 -25
- data/spec/models/generic_file/visibility_spec.rb +10 -5
- data/spec/models/generic_file_spec.rb +86 -88
- data/spec/models/geo_names_resource_spec.rb +3 -5
- data/spec/models/local_authority_spec.rb +30 -33
- data/spec/models/pageview_spec.rb +3 -3
- data/spec/models/proxy_deposit_request_spec.rb +3 -3
- data/spec/models/single_use_link_spec.rb +36 -36
- data/spec/models/solr_document_spec.rb +3 -6
- data/spec/models/trophy_spec.rb +8 -9
- data/spec/models/user_mailbox_spec.rb +62 -0
- data/spec/models/user_spec.rb +28 -29
- data/spec/presenters/presenter_renderer_spec.rb +1 -1
- data/spec/presenters/sufia/generic_file_presenter_spec.rb +5 -5
- data/spec/presenters/sufia/version_list_presenter_spec.rb +2 -2
- data/spec/presenters/sufia/version_presenter_spec.rb +1 -1
- data/spec/routing/featured_works_route_spec.rb +4 -4
- data/spec/routing/ownership_transfers_route_spec.rb +1 -1
- data/spec/routing/route_spec.rb +89 -89
- data/spec/services/generic_file_audit_service_spec.rb +8 -8
- data/spec/services/repository_audit_service_spec.rb +7 -3
- data/spec/spec_helper.rb +5 -4
- data/spec/support/features/session_helpers.rb +1 -1
- data/spec/support/input_support.rb +1 -2
- data/spec/support/rake.rb +1 -1
- data/spec/support/selectors.rb +1 -6
- data/spec/support/statistic_helper.rb +1 -1
- data/spec/support/uploaded_file_monkeypatch.rb +1 -1
- data/spec/tasks/rake_spec.rb +3 -5
- data/spec/views/admin/stats/index.html.erb_spec.rb +16 -16
- data/spec/views/batch/edit.html.erb_spec.rb +1 -3
- data/spec/views/batch_edits/check_all_spec.rb +5 -5
- data/spec/views/batch_edits/edit.html.erb_spec.rb +1 -3
- data/spec/views/catalog/index.html.erb_spec.rb +1 -3
- data/spec/views/catalog/sort_and_per_page.html.erb_spec.rb +4 -5
- data/spec/views/collections/_form.html.erb_spec.rb +5 -3
- data/spec/views/collections/_show_descriptions.html.erb_spec.rb +7 -8
- data/spec/views/collections/_show_document_list.erb_spec.rb +4 -6
- data/spec/views/dashboard/index_spec.rb +14 -21
- data/spec/views/generic_file/_browse_everything.html.erb_spec.rb +2 -2
- data/spec/views/generic_file/_permission_form.html.erb_spec.rb +8 -9
- data/spec/views/generic_file/edit.html.erb_spec.rb +7 -7
- data/spec/views/generic_file/show.html.erb_spec.rb +24 -25
- data/spec/views/generic_file/stats.html.erb_spec.rb +19 -19
- data/spec/views/homepage/_announcement.html.erb_spec.rb +51 -0
- data/spec/views/homepage/_featured_works.html.erb_spec.rb +5 -9
- data/spec/views/homepage/_home_header.html.erb_spec.rb +2 -2
- data/spec/views/my/facet.html.erb_spec.rb +4 -4
- data/spec/views/single_use_links/new_download.html.erb_spec.rb +28 -0
- data/spec/views/single_use_links_viewer/show.html.erb_spec.rb +29 -0
- data/spec/views/users/_follower_modal.html.erb_spec.rb +7 -8
- data/spec/views/users/_following_modal.html.erb_spec.rb +4 -5
- data/spec/views/users/_notify_number.html.erb_spec.rb +2 -5
- data/spec/views/users/_user_util_links.html.erb_spec.rb +5 -8
- data/spec/views/users/index.html.erb_spec.rb +4 -6
- data/spec/views/users/show.html.erb_spec.rb +4 -7
- data/tasks/sufia-dev.rake +19 -3
- metadata +20 -5
@@ -1,9 +1,9 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe 'generic_files/_browse_everything.html.erb', :
|
3
|
+
describe 'generic_files/_browse_everything.html.erb', type: :view do
|
4
4
|
it 'shows user timing warning' do
|
5
5
|
render
|
6
6
|
page = Capybara::Node::Simple.new(rendered)
|
7
|
-
expect(page).to have_selector('div.alert-success', text: /Please note that if you upload a large number of files/i
|
7
|
+
expect(page).to have_selector('div.alert-success', text: /Please note that if you upload a large number of files/i, count: 1)
|
8
8
|
end
|
9
9
|
end
|
@@ -1,11 +1,11 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe 'generic_files/_permission_form.html.erb', :
|
4
|
-
let(:generic_file)
|
3
|
+
describe 'generic_files/_permission_form.html.erb', type: :view do
|
4
|
+
let(:generic_file) do
|
5
5
|
stub_model(GenericFile, id: '123',
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
depositor: 'bob',
|
7
|
+
resource_type: ['Dataset'])
|
8
|
+
end
|
9
9
|
|
10
10
|
let(:form) do
|
11
11
|
form_for(generic_file, url: '/update') do |gf_form|
|
@@ -23,7 +23,7 @@ describe 'generic_files/_permission_form.html.erb', :type => :view do
|
|
23
23
|
context "without additional users" do
|
24
24
|
let(:permissions) { [] }
|
25
25
|
|
26
|
-
it "
|
26
|
+
it "draws the permissions form without error" do
|
27
27
|
expect(rendered).to have_css("input#new_user_name_skel")
|
28
28
|
expect(rendered).not_to have_css("button.remove_perm")
|
29
29
|
end
|
@@ -33,13 +33,12 @@ describe 'generic_files/_permission_form.html.erb', :type => :view do
|
|
33
33
|
let(:depositor_permission) { Hydra::AccessControls::Permission.new(id: '123', name: 'bob', type: 'person', access: 'edit') }
|
34
34
|
let(:public_permission) { Hydra::AccessControls::Permission.new(id: '124', name: 'public', type: 'group', access: 'read') }
|
35
35
|
let(:other_permission) { Hydra::AccessControls::Permission.new(id: '125', name: 'joe@example.com', type: 'person', access: 'edit') }
|
36
|
-
let(:permissions) { [
|
36
|
+
let(:permissions) { [depositor_permission, public_permission, other_permission] }
|
37
37
|
|
38
|
-
it "
|
38
|
+
it "draws the permissions form without error" do
|
39
39
|
expect(rendered).to have_css("input#new_user_name_skel")
|
40
40
|
expect(rendered).to have_css("button.remove_perm", count: 1) # depositor and public should be filtered out
|
41
41
|
expect(rendered).to have_css("button.remove_perm[data-index='2']")
|
42
42
|
end
|
43
43
|
end
|
44
|
-
|
45
44
|
end
|
@@ -13,15 +13,15 @@ describe 'generic_files/edit.html.erb', :no_clean do
|
|
13
13
|
let(:versions_graph) { double(all: [version1]) }
|
14
14
|
let(:content) { double('content', mimeType: 'application/pdf') }
|
15
15
|
|
16
|
-
let(:generic_file)
|
16
|
+
let(:generic_file) do
|
17
17
|
stub_model(GenericFile, id: '123',
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
depositor: 'bob',
|
19
|
+
resource_type: ['Book', 'Dataset'])
|
20
|
+
end
|
21
21
|
|
22
|
-
let(:form)
|
22
|
+
let(:form) do
|
23
23
|
Sufia::Forms::GenericFileEditForm.new(generic_file)
|
24
|
-
|
24
|
+
end
|
25
25
|
|
26
26
|
before do
|
27
27
|
allow(generic_file).to receive(:content).and_return(content)
|
@@ -36,7 +36,7 @@ describe 'generic_files/edit.html.erb', :no_clean do
|
|
36
36
|
Capybara::Node::Simple.new(rendered)
|
37
37
|
end
|
38
38
|
|
39
|
-
it "
|
39
|
+
it "onlies draw one resource_type multiselect" do
|
40
40
|
expect(page).to have_selector("select#generic_file_resource_type", count: 1)
|
41
41
|
end
|
42
42
|
end
|
@@ -1,29 +1,29 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe 'generic_files/show.html.erb', :
|
4
|
-
let(:depositor)
|
3
|
+
describe 'generic_files/show.html.erb', type: :view do
|
4
|
+
let(:depositor) do
|
5
5
|
stub_model(User,
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
user_key: 'bob',
|
7
|
+
twitter_handle: 'bot4lib')
|
8
|
+
end
|
9
9
|
|
10
|
-
let(:content){ double('content', versions: [], mimeType: 'application/pdf') }
|
10
|
+
let(:content) { double('content', versions: [], mimeType: 'application/pdf') }
|
11
11
|
|
12
12
|
let(:generic_file) do
|
13
13
|
stub_model(GenericFile, id: '123',
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
14
|
+
depositor: depositor.user_key,
|
15
|
+
audit_stat: 1,
|
16
|
+
title: ['My Title'],
|
17
|
+
description: ['Lorem ipsum lorem ipsum. http://my.link.com'],
|
18
|
+
tag: ['bacon', 'sausage', 'eggs'],
|
19
|
+
rights: ['http://example.org/rights/1'],
|
20
|
+
based_near: ['Seattle, WA, US'],
|
21
|
+
contributor: ['Tweedledee', 'Tweedledum'],
|
22
|
+
creator: ['Doe, John', 'Doe, Jane'],
|
23
|
+
date_created: ['1984-01-02'],
|
24
|
+
language: ['Quechua'],
|
25
|
+
publisher: ['Random Publishing, Inc.'],
|
26
|
+
subject: ['Biology', 'Physiology', 'Ethnography'])
|
27
27
|
end
|
28
28
|
|
29
29
|
let(:presenter) do
|
@@ -248,15 +248,15 @@ describe 'generic_files/show.html.erb', :type => :view do
|
|
248
248
|
|
249
249
|
context "when the file is not featured in any collections" do
|
250
250
|
let(:collections) { [] }
|
251
|
-
it "
|
251
|
+
it "displays the empty message" do
|
252
252
|
expect(rendered).to have_text(t('sufia.file.collections_list.empty'))
|
253
253
|
end
|
254
254
|
end
|
255
255
|
|
256
256
|
context "when the file is featured in collections" do
|
257
|
-
let(:collections) { [stub_model(Collection, title: 'collection1', id: '456')
|
257
|
+
let(:collections) { [stub_model(Collection, title: 'collection1', id: '456')] }
|
258
258
|
|
259
|
-
it "
|
259
|
+
it "displays the header and titles of collections it belongs to" do
|
260
260
|
expect(rendered).to have_text(t('sufia.file.collections_list.heading'))
|
261
261
|
expect(rendered).to have_text('collection1')
|
262
262
|
end
|
@@ -267,9 +267,8 @@ describe 'generic_files/show.html.erb', :type => :view do
|
|
267
267
|
before do
|
268
268
|
render
|
269
269
|
end
|
270
|
-
it "
|
271
|
-
expect(rendered).to include('<span class="label label-danger" title="'+t('sufia.visibility.private_title_attr')+'">'+t('sufia.visibility.private')+'</span></a>')
|
270
|
+
it "displays the visibility badge" do
|
271
|
+
expect(rendered).to include('<span class="label label-danger" title="' + t('sufia.visibility.private_title_attr') + '">' + t('sufia.visibility.private') + '</span></a>')
|
272
272
|
end
|
273
273
|
end
|
274
|
-
|
275
274
|
end
|
@@ -1,32 +1,32 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe 'generic_files/stats.html.erb', :
|
3
|
+
describe 'generic_files/stats.html.erb', type: :view do
|
4
4
|
describe 'usage statistics' do
|
5
|
-
let(:generic_file)
|
5
|
+
let(:generic_file) do
|
6
6
|
stub_model(GenericFile, id: '123',
|
7
|
-
|
8
|
-
|
7
|
+
title: ['file1.txt'])
|
8
|
+
end
|
9
9
|
|
10
|
-
let(:no_stats)
|
10
|
+
let(:no_stats) do
|
11
11
|
allow_message_expectations_on_nil
|
12
12
|
allow(FileUsage).to receive(:new)
|
13
13
|
stub_model(FileUsage,
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
let(:stats)
|
14
|
+
created: Date.parse('2014-01-01'),
|
15
|
+
total_pageviews: 0,
|
16
|
+
total_downloads: 0,
|
17
|
+
to_flot: []
|
18
|
+
)
|
19
|
+
end
|
20
|
+
|
21
|
+
let(:stats) do
|
22
22
|
allow(FileUsage).to receive(:new)
|
23
23
|
stub_model(FileUsage,
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
24
|
+
created: Date.parse('2014-01-01'),
|
25
|
+
total_pageviews: 9,
|
26
|
+
total_downloads: 4,
|
27
|
+
to_flot: [[1_396_422_000_000, 2], [1_396_508_400_000, 3], [1_396_594_800_000, 4]]
|
28
|
+
)
|
29
|
+
end
|
30
30
|
|
31
31
|
before do
|
32
32
|
assign(:generic_file, generic_file)
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "homepage/_announcement.html.erb" do
|
4
|
+
let(:groups) { [] }
|
5
|
+
let(:ability) { instance_double("Ability") }
|
6
|
+
let(:announcement) { ContentBlock.new(name: ContentBlock::ANNOUNCEMENT, value: announcement_value) }
|
7
|
+
|
8
|
+
subject { rendered }
|
9
|
+
|
10
|
+
before do
|
11
|
+
assign(:announcement_text, announcement)
|
12
|
+
allow(controller).to receive(:current_ability).and_return(ability)
|
13
|
+
allow(ability).to receive(:can?).with(:update, ContentBlock).and_return(can_update_content_block)
|
14
|
+
render
|
15
|
+
end
|
16
|
+
|
17
|
+
context "when there is an announcement" do
|
18
|
+
let(:announcement_value) { "I have an announcement!" }
|
19
|
+
|
20
|
+
context "when the user can update content" do
|
21
|
+
let(:can_update_content_block) { true }
|
22
|
+
|
23
|
+
it { is_expected.to have_content announcement_value }
|
24
|
+
it { is_expected.to have_button("Edit") }
|
25
|
+
end
|
26
|
+
|
27
|
+
context "when the user can't update content" do
|
28
|
+
let(:can_update_content_block) { false }
|
29
|
+
|
30
|
+
it { is_expected.to have_content announcement_value }
|
31
|
+
it { is_expected.not_to have_button("Edit") }
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
context "when there is no announcement" do
|
36
|
+
let(:announcement_value) { "" }
|
37
|
+
|
38
|
+
context "when the user can update content" do
|
39
|
+
let(:can_update_content_block) { true }
|
40
|
+
|
41
|
+
it { is_expected.to have_selector "#announcement" }
|
42
|
+
it { is_expected.to have_button("Edit") }
|
43
|
+
end
|
44
|
+
|
45
|
+
context "when the user can't update content" do
|
46
|
+
let(:can_update_content_block) { false }
|
47
|
+
|
48
|
+
it { is_expected.not_to have_selector "#announcement" }
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -7,10 +7,8 @@ describe "homepage/_featured_works.html.erb" do
|
|
7
7
|
|
8
8
|
context "without featured works" do
|
9
9
|
before { render }
|
10
|
-
it {
|
11
|
-
|
12
|
-
is_expected.not_to have_selector('form')
|
13
|
-
}
|
10
|
+
it { is_expected.to have_content 'No works have been featured' }
|
11
|
+
it { is_expected.not_to have_selector('form') }
|
14
12
|
end
|
15
13
|
|
16
14
|
context "with featured works" do
|
@@ -20,10 +18,8 @@ describe "homepage/_featured_works.html.erb" do
|
|
20
18
|
render
|
21
19
|
end
|
22
20
|
|
23
|
-
it {
|
24
|
-
|
25
|
-
|
26
|
-
is_expected.to have_selector('ol#featured_works')
|
27
|
-
}
|
21
|
+
it { is_expected.not_to have_content 'No works have been featured' }
|
22
|
+
it { is_expected.not_to have_selector('form') }
|
23
|
+
it { is_expected.to have_selector('ol#featured_works') }
|
28
24
|
end
|
29
25
|
end
|
@@ -12,13 +12,13 @@ describe "homepage/_home_header.html.erb" do
|
|
12
12
|
end
|
13
13
|
context "when the user can view" do
|
14
14
|
let(:can_view_share_work) { true }
|
15
|
-
it "
|
15
|
+
it "displays" do
|
16
16
|
expect(rendered).to have_content t("sufia.share_button")
|
17
17
|
end
|
18
18
|
end
|
19
19
|
context "when the user can't view" do
|
20
20
|
let(:can_view_share_work) { false }
|
21
|
-
it "
|
21
|
+
it "does not display" do
|
22
22
|
expect(rendered).not_to have_content t("sufia.share_button")
|
23
23
|
end
|
24
24
|
end
|
@@ -3,7 +3,7 @@ require 'spec_helper'
|
|
3
3
|
# Note: this is a direct copy of the corresponding test in Blacklight
|
4
4
|
# with changes for "views/my" instead of "views/catalog"
|
5
5
|
|
6
|
-
describe "my/facet.html.erb", :
|
6
|
+
describe "my/facet.html.erb", type: :view do
|
7
7
|
let(:display_facet) { double }
|
8
8
|
let(:blacklight_config) { Blacklight::Configuration.new }
|
9
9
|
before do
|
@@ -15,19 +15,19 @@ describe "my/facet.html.erb", :type => :view do
|
|
15
15
|
assign :display_facet, display_facet
|
16
16
|
end
|
17
17
|
|
18
|
-
it "
|
18
|
+
it "has the facet title" do
|
19
19
|
allow(view).to receive(:render_facet_limit)
|
20
20
|
render
|
21
21
|
expect(rendered).to have_selector "h3", text: "Facet title"
|
22
22
|
end
|
23
23
|
|
24
|
-
it "
|
24
|
+
it "renders facet pagination" do
|
25
25
|
allow(view).to receive(:render_facet_limit)
|
26
26
|
render
|
27
27
|
expect(rendered).to have_content "pagination"
|
28
28
|
end
|
29
29
|
|
30
|
-
it "
|
30
|
+
it "renders the facet limit" do
|
31
31
|
expect(view).to receive(:render_facet_limit).with(display_facet, layout: false)
|
32
32
|
render
|
33
33
|
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'single_use_links/new_download.html.erb' do
|
4
|
+
let(:user) { FactoryGirl.find_or_create(:jill) }
|
5
|
+
let(:file) do
|
6
|
+
GenericFile.create do |f|
|
7
|
+
f.add_file(File.open(fixture_path + '/world.png'), path: 'content', original_name: 'world.png')
|
8
|
+
f.label = 'world.png'
|
9
|
+
f.apply_depositor_metadata(user)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
let(:hash) { "some-dummy-sha2-hash" }
|
14
|
+
|
15
|
+
before do
|
16
|
+
assign :asset, file
|
17
|
+
assign :link, Sufia::Engine.routes.url_helpers.download_single_use_link_path(hash)
|
18
|
+
render
|
19
|
+
end
|
20
|
+
|
21
|
+
it "has the download link" do
|
22
|
+
expect(rendered).to have_selector "a.download-link"
|
23
|
+
end
|
24
|
+
|
25
|
+
it "has turbolinks disabled in the download link" do
|
26
|
+
expect(rendered).to have_selector "a.download-link[data-no-turbolink]"
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'single_use_links_viewer/show.html.erb' do
|
4
|
+
let(:user) { FactoryGirl.find_or_create(:jill) }
|
5
|
+
let(:file) do
|
6
|
+
GenericFile.create do |f|
|
7
|
+
f.add_file(File.open(fixture_path + '/world.png'), path: 'content', original_name: 'world.png')
|
8
|
+
f.label = 'world.png'
|
9
|
+
f.apply_depositor_metadata(user)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
let(:hash) { "some-dummy-sha2-hash" }
|
14
|
+
|
15
|
+
before do
|
16
|
+
assign :asset, file
|
17
|
+
assign :download_link, Sufia::Engine.routes.url_helpers.download_single_use_link_path(hash)
|
18
|
+
assign :presenter, Sufia::GenericFilePresenter.new(file)
|
19
|
+
render
|
20
|
+
end
|
21
|
+
|
22
|
+
it "contains a download link" do
|
23
|
+
expect(rendered).to have_selector "a[href^='/single_use_link/download/']"
|
24
|
+
end
|
25
|
+
|
26
|
+
it "has turbolinks disabled in the download link" do
|
27
|
+
expect(rendered).to have_selector "a[data-no-turbolink][href^='/single_use_link/download/']"
|
28
|
+
end
|
29
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe 'users/_follower_modal.html.erb', :
|
3
|
+
describe 'users/_follower_modal.html.erb', type: :view do
|
4
4
|
let(:frank) { FactoryGirl.create(:user, display_name: "Frank") }
|
5
5
|
let(:page) { Capybara::Node::Simple.new(rendered) }
|
6
6
|
|
@@ -12,18 +12,17 @@ describe 'users/_follower_modal.html.erb', :type => :view do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
context "when followers" do
|
15
|
-
let(:view_user) {
|
16
|
-
let(:current_user) {
|
17
|
-
let(:followers) { [frank]}
|
15
|
+
let(:view_user) {}
|
16
|
+
let(:current_user) {}
|
17
|
+
let(:followers) { [frank] }
|
18
18
|
|
19
19
|
it "draws user list" do
|
20
20
|
expect(page).to have_link "Frank", href: "/users/#{frank.to_param}"
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
-
|
25
24
|
context "when no followers" do
|
26
|
-
let(:followers) { []}
|
25
|
+
let(:followers) { [] }
|
27
26
|
let(:view_user) { frank }
|
28
27
|
|
29
28
|
context "when logged in " do
|
@@ -45,11 +44,11 @@ describe 'users/_follower_modal.html.erb', :type => :view do
|
|
45
44
|
end
|
46
45
|
|
47
46
|
context "when not logged in" do
|
48
|
-
let(:current_user) {
|
47
|
+
let(:current_user) {}
|
49
48
|
|
50
49
|
it "indicates the lack of followers for this user" do
|
51
50
|
expect(page).to have_text "No one is following this user."
|
52
51
|
end
|
53
52
|
end
|
54
53
|
end
|
55
|
-
end
|
54
|
+
end
|