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
data/spec/spec_helper.rb
CHANGED
@@ -52,10 +52,10 @@ if $in_travis
|
|
52
52
|
def extract_metadata
|
53
53
|
return unless has_content?
|
54
54
|
Hydra::FileCharacterization.characterize(content, filename_for_characterization, :fits) do |config|
|
55
|
-
config[:fits] = lambda
|
55
|
+
config[:fits] = lambda do |filename|
|
56
56
|
filename = File.expand_path("../fixtures/pdf_fits.xml", __FILE__)
|
57
57
|
File.read(filename)
|
58
|
-
|
58
|
+
end
|
59
59
|
end
|
60
60
|
end
|
61
61
|
end
|
@@ -68,9 +68,10 @@ if defined?(ClamAV)
|
|
68
68
|
else
|
69
69
|
class ClamAV
|
70
70
|
include Singleton
|
71
|
-
def scanfile(
|
71
|
+
def scanfile(_f)
|
72
72
|
0
|
73
73
|
end
|
74
|
+
|
74
75
|
def loaddb
|
75
76
|
nil
|
76
77
|
end
|
@@ -116,7 +117,7 @@ RSpec.configure do |config|
|
|
116
117
|
config.use_transactional_fixtures = false
|
117
118
|
|
118
119
|
config.before :each do |example|
|
119
|
-
unless
|
120
|
+
unless example.metadata[:type] == :view || example.metadata[:no_clean]
|
120
121
|
ActiveFedora::Cleaner.clean!
|
121
122
|
end
|
122
123
|
end
|
@@ -3,7 +3,7 @@ module Features
|
|
3
3
|
module SessionHelpers
|
4
4
|
def sign_in(who = :user)
|
5
5
|
logout
|
6
|
-
user = who.is_a?(User) ? who : FactoryGirl.build(:user).tap
|
6
|
+
user = who.is_a?(User) ? who : FactoryGirl.build(:user).tap(&:save!)
|
7
7
|
visit new_user_session_path
|
8
8
|
fill_in 'Email', with: user.email
|
9
9
|
fill_in 'Password', with: user.password
|
@@ -3,10 +3,9 @@ module InputSupport
|
|
3
3
|
|
4
4
|
include RSpec::Rails::HelperExampleGroup
|
5
5
|
|
6
|
-
def input_for(object, attribute_name, options={})
|
6
|
+
def input_for(object, attribute_name, options = {})
|
7
7
|
helper.simple_form_for object, url: '' do |f|
|
8
8
|
f.input attribute_name, options
|
9
9
|
end
|
10
10
|
end
|
11
11
|
end
|
12
|
-
|
data/spec/support/rake.rb
CHANGED
data/spec/support/selectors.rb
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
module Selectors
|
2
|
-
|
3
2
|
module Header
|
4
|
-
|
5
3
|
def user_notifications_link
|
6
4
|
within '#user_utility_links' do
|
7
5
|
find '#notify_link'
|
@@ -16,8 +14,7 @@ module Selectors
|
|
16
14
|
end
|
17
15
|
|
18
16
|
module Dashboard
|
19
|
-
|
20
|
-
def db_item_actions_toggle item
|
17
|
+
def db_item_actions_toggle(item)
|
21
18
|
within "#document_#{item.id}" do
|
22
19
|
find '.dropdown-toggle'
|
23
20
|
end
|
@@ -25,7 +22,6 @@ module Selectors
|
|
25
22
|
end
|
26
23
|
|
27
24
|
module NewTransfers
|
28
|
-
|
29
25
|
def new_owner_dropdown
|
30
26
|
find '#s2id_proxy_deposit_request_transfer_to'
|
31
27
|
end
|
@@ -50,7 +46,6 @@ module Selectors
|
|
50
46
|
end
|
51
47
|
|
52
48
|
module Transfers
|
53
|
-
|
54
49
|
def first_sent_cancel_button
|
55
50
|
within '#outgoing-transfers' do
|
56
51
|
find '.btn.btn-danger'
|
@@ -1,4 +1,4 @@
|
|
1
|
-
#Monkey patch UploadedFile so that it responds to read (same as ActionDispatch::Http::UploadedFile). Required by RestClient when posting to fedora.
|
1
|
+
# Monkey patch UploadedFile so that it responds to read (same as ActionDispatch::Http::UploadedFile). Required by RestClient when posting to fedora.
|
2
2
|
class Rack::Test::UploadedFile
|
3
3
|
def read(*args)
|
4
4
|
@tempfile.read(*args)
|
data/spec/tasks/rake_spec.rb
CHANGED
@@ -2,21 +2,20 @@ require 'spec_helper'
|
|
2
2
|
require 'rake'
|
3
3
|
|
4
4
|
describe "Rake tasks" do
|
5
|
-
|
6
5
|
describe "sufia:empty_batches" do
|
7
6
|
before do
|
8
7
|
load_rake_environment [File.expand_path("../../../sufia-models/lib/tasks/batch_cleanup.rake", __FILE__)]
|
9
8
|
end
|
10
9
|
subject { run_task "sufia:empty_batches" }
|
11
|
-
|
10
|
+
|
12
11
|
context "without an empty batch" do
|
13
12
|
it { is_expected.to eq "Output: \n Errors:" }
|
14
13
|
end
|
15
|
-
|
14
|
+
|
16
15
|
context "with an empty batch" do
|
17
16
|
before { Batch.create("empty-batch") }
|
18
17
|
it { is_expected.to start_with("Output: empty-batch contains no files - to delete, rerun with the remove option") }
|
19
|
-
|
18
|
+
|
20
19
|
describe "removing the empty batch" do
|
21
20
|
subject { run_task "sufia:empty_batches", "remove" }
|
22
21
|
it { is_expected.to start_with("Output: empty-batch contains no files - deleted") }
|
@@ -75,5 +74,4 @@ describe "Rake tasks" do
|
|
75
74
|
File.delete("abc123.txt")
|
76
75
|
end
|
77
76
|
end
|
78
|
-
|
79
77
|
end
|
@@ -1,45 +1,45 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe "admin/stats/index.html.erb" do
|
4
|
+
before do
|
5
|
+
assign(:files_count, {})
|
6
|
+
assign(:top_formats, [])
|
7
|
+
assign(:users_stats, {})
|
8
|
+
assign(:recent_users, [])
|
9
|
+
assign(:deposit_stats, {})
|
10
|
+
assign(:depositors, [])
|
11
|
+
end
|
12
|
+
|
4
13
|
context "default depositors" do
|
5
|
-
let(:top_5_active_users) do
|
14
|
+
let(:top_5_active_users) do
|
6
15
|
users = {}
|
7
|
-
5.times { |i| users[i.to_s] = i}
|
16
|
+
5.times { |i| users[i.to_s] = i }
|
8
17
|
users
|
9
18
|
end
|
10
19
|
before do
|
11
|
-
assign(:files_count, {})
|
12
|
-
assign(:top_formats, [])
|
13
|
-
assign(:users_stats, {})
|
14
|
-
assign(:recent_users, [])
|
15
20
|
assign(:active_users, top_5_active_users)
|
16
21
|
render
|
17
22
|
end
|
18
|
-
it "
|
23
|
+
it "shows top 5 depositors and option to view more" do
|
19
24
|
expect(rendered).to have_content("(top 5)")
|
20
25
|
expect(rendered).to have_content("View top 20")
|
21
26
|
end
|
22
27
|
end
|
23
28
|
|
24
29
|
context "top 20 depositors" do
|
25
|
-
let(:top_20_active_users) do
|
30
|
+
let(:top_20_active_users) do
|
26
31
|
users = {}
|
27
|
-
20.times { |i| users[i.to_s] = i}
|
32
|
+
20.times { |i| users[i.to_s] = i }
|
28
33
|
users
|
29
34
|
end
|
30
35
|
before do
|
31
|
-
assign(:files_count, {})
|
32
|
-
assign(:top_formats, [])
|
33
|
-
assign(:users_stats, {})
|
34
|
-
assign(:recent_users, [])
|
35
36
|
assign(:active_users, top_20_active_users)
|
36
37
|
params[:dep_count] = 20
|
37
38
|
render
|
38
39
|
end
|
39
|
-
it "
|
40
|
+
it "shows top 20 depositors, without an option to view more" do
|
40
41
|
expect(rendered).to have_content("(top 20)")
|
41
42
|
expect(rendered).to_not have_content("View top 20")
|
42
43
|
end
|
43
44
|
end
|
44
|
-
|
45
|
-
end
|
45
|
+
end
|
@@ -16,7 +16,7 @@ describe 'batch/edit.html.erb' do
|
|
16
16
|
render
|
17
17
|
end
|
18
18
|
|
19
|
-
it "
|
19
|
+
it "draws the page" do
|
20
20
|
# form
|
21
21
|
expect(rendered).to have_selector "form#new_generic_file"
|
22
22
|
# should have browser validations
|
@@ -35,7 +35,5 @@ describe 'batch/edit.html.erb' do
|
|
35
35
|
page.all('select#generic_file_rights option').each do |elem|
|
36
36
|
expect(elem.value).to_not be_empty
|
37
37
|
end
|
38
|
-
|
39
38
|
end
|
40
39
|
end
|
41
|
-
|
@@ -1,20 +1,20 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe 'Check All', :
|
4
|
-
before
|
5
|
-
@document_list = ['a','b','c']
|
3
|
+
describe 'Check All', type: :view do
|
4
|
+
before(:all) do
|
5
|
+
@document_list = ['a', 'b', 'c']
|
6
6
|
@batch_size_on_other_page = 0
|
7
7
|
@max_batch_size = 100
|
8
8
|
end
|
9
9
|
|
10
|
-
it '
|
10
|
+
it 'renders batch edits actions' do
|
11
11
|
allow(controller).to receive(:controller_name).and_return('batch_edits')
|
12
12
|
controller.prepend_view_path "app/views/batch_edits"
|
13
13
|
html = render partial: 'batch_edits/check_all'
|
14
14
|
expect(html).to have_selector("li[data-behavior='batch-edit-select-abc']")
|
15
15
|
end
|
16
16
|
|
17
|
-
it '
|
17
|
+
it 'renders actions for my items' do
|
18
18
|
allow(controller).to receive(:controller_name).and_return('my')
|
19
19
|
controller.prepend_view_path "app/views/my"
|
20
20
|
html = render partial: 'batch_edits/check_all'
|
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe 'catalog/index.html.erb' do
|
4
|
-
|
5
4
|
let(:collection) { stub_model(Collection, title: 'collection1', id: 'abc123') }
|
6
5
|
let(:doc) { SolrDocument.new(collection.to_solr) }
|
7
6
|
|
@@ -17,7 +16,7 @@ describe 'catalog/index.html.erb' do
|
|
17
16
|
params[:view] = 'gallery'
|
18
17
|
|
19
18
|
resp = []
|
20
|
-
assign(:response, resp
|
19
|
+
assign(:response, resp)
|
21
20
|
allow(resp).to receive(:total_pages).and_return(1)
|
22
21
|
allow(resp).to receive(:current_page).and_return(1)
|
23
22
|
allow(resp).to receive(:limit_value).and_return(10)
|
@@ -34,5 +33,4 @@ describe 'catalog/index.html.erb' do
|
|
34
33
|
page = Capybara::Node::Simple.new(rendered)
|
35
34
|
expect(page).to have_selector("span.glyphicon.glyphicon-th.collection-icon-search")
|
36
35
|
end
|
37
|
-
|
38
36
|
end
|
@@ -1,11 +1,11 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe 'catalog/_sort_and_per_page.html.erb', :
|
3
|
+
describe 'catalog/_sort_and_per_page.html.erb', type: :view do
|
4
4
|
before do
|
5
5
|
allow(controller).to receive(:current_user).and_return(stub_model(User))
|
6
6
|
allow_any_instance_of(Ability).to receive(:can?).and_return(true)
|
7
|
-
@resp = ["a","b","c"]
|
8
|
-
assign(:response, @resp
|
7
|
+
@resp = ["a", "b", "c"]
|
8
|
+
assign(:response, @resp)
|
9
9
|
allow(@resp).to receive(:total_count).and_return(20)
|
10
10
|
allow(@resp).to receive(:limit_value).and_return(3)
|
11
11
|
allow(@resp).to receive(:rows).and_return(3)
|
@@ -21,10 +21,9 @@ describe 'catalog/_sort_and_per_page.html.erb', :type => :view do
|
|
21
21
|
expect(page).to have_selector('span.page_entries', count: 1)
|
22
22
|
expect(rendered).to include("<strong>4</strong> - <strong>6</strong> of <strong>20</strong>")
|
23
23
|
end
|
24
|
-
|
24
|
+
|
25
25
|
it 'displays the relevance option for sorting' do
|
26
26
|
render
|
27
27
|
expect(rendered).to include("<li><a href=\"/catalog?sort=score+desc%2C+date_uploaded_dtsi+desc\">relevance</a></li>")
|
28
28
|
end
|
29
|
-
|
30
29
|
end
|
@@ -1,8 +1,10 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe 'collections/_form.html.erb' do
|
4
|
-
let(:collection)
|
5
|
-
|
4
|
+
let(:collection) do
|
5
|
+
Collection.new(title: 'the title', description: 'the description',
|
6
|
+
creator: ['the creator'])
|
7
|
+
end
|
6
8
|
|
7
9
|
let(:collection_form) { Sufia::Forms::CollectionEditForm.new(collection) }
|
8
10
|
|
@@ -11,7 +13,7 @@ describe 'collections/_form.html.erb' do
|
|
11
13
|
assign(:form, collection_form)
|
12
14
|
end
|
13
15
|
|
14
|
-
it "
|
16
|
+
it "draws the metadata fields for collection" do
|
15
17
|
render
|
16
18
|
expect(rendered).to have_selector("input#collection_title")
|
17
19
|
expect(rendered).to_not have_selector("div#additional_title.multi_value")
|
@@ -1,14 +1,14 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe 'collections/_show_descriptions.html.erb', :
|
3
|
+
describe 'collections/_show_descriptions.html.erb', type: :view do
|
4
4
|
context 'displaying a custom collection' do
|
5
5
|
let(:collection) do
|
6
6
|
mock_model(Collection,
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
7
|
+
resource_type: [], creator: [], contributor: [], tag: [],
|
8
|
+
description: '', title: 'hmm',
|
9
|
+
rights: [], publisher: [], date_created: ['2000-01-01'], subject: [],
|
10
|
+
language: [], identifier: [], based_near: [], related_url: [],
|
11
|
+
members: ['foo', 'bar'], bytes: 123_456_678
|
12
12
|
)
|
13
13
|
end
|
14
14
|
before do
|
@@ -17,8 +17,7 @@ describe 'collections/_show_descriptions.html.erb', :type => :view do
|
|
17
17
|
|
18
18
|
let(:presenter) { Sufia::CollectionPresenter.new(collection) }
|
19
19
|
|
20
|
-
|
21
|
-
it "should draw the metadata fields for collection" do
|
20
|
+
it "draws the metadata fields for collection" do
|
22
21
|
render
|
23
22
|
expect(rendered).to have_content 'Date Created'
|
24
23
|
expect(rendered).to include('itemprop="dateCreated"')
|
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe 'collections/_show_document_list.html.erb', :
|
4
|
-
|
3
|
+
describe 'collections/_show_document_list.html.erb', type: :view do
|
5
4
|
let(:user) { FactoryGirl.find_or_create(:jill) }
|
6
5
|
let(:collection) { mock_model(Collection) }
|
7
6
|
|
@@ -12,7 +11,7 @@ describe 'collections/_show_document_list.html.erb', :type => :view do
|
|
12
11
|
gf
|
13
12
|
end
|
14
13
|
|
15
|
-
let(:documents) {[file]}
|
14
|
+
let(:documents) { [file] }
|
16
15
|
|
17
16
|
context 'when not logged in' do
|
18
17
|
before do
|
@@ -22,10 +21,9 @@ describe 'collections/_show_document_list.html.erb', :type => :view do
|
|
22
21
|
allow(file).to receive(:edit_people).and_return([])
|
23
22
|
end
|
24
23
|
|
25
|
-
it "
|
26
|
-
render(partial: 'collections/show_document_list.html.erb', locals: {documents: documents})
|
24
|
+
it "renders collection" do
|
25
|
+
render(partial: 'collections/show_document_list.html.erb', locals: { documents: documents })
|
27
26
|
expect(rendered).to have_content 'One Hundred Years of Solitude'
|
28
27
|
end
|
29
28
|
end
|
30
|
-
|
31
29
|
end
|
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe "dashboard/index.html.erb", :
|
4
|
-
|
3
|
+
describe "dashboard/index.html.erb", type: :view do
|
5
4
|
before do
|
6
5
|
@user = mock_model(User, name: "Charles Francis Xavier", user_key: "charles")
|
7
6
|
allow(@user).to receive(:title).and_return("Professor, Head")
|
@@ -10,7 +9,7 @@ describe "dashboard/index.html.erb", :type => :view do
|
|
10
9
|
allow(@user).to receive(:email).and_return("chuck@xsgy.edu")
|
11
10
|
allow(@user).to receive(:login).and_return("chuck")
|
12
11
|
allow(@user).to receive(:all_following).and_return(["magneto"])
|
13
|
-
allow(@user).to receive(:followers).and_return(["wolverine","storm"])
|
12
|
+
allow(@user).to receive(:followers).and_return(["wolverine", "storm"])
|
14
13
|
allow(@user).to receive(:can_receive_deposits_from).and_return([])
|
15
14
|
allow(@user).to receive(:total_file_views).and_return(1)
|
16
15
|
allow(@user).to receive(:total_file_downloads).and_return(3)
|
@@ -28,13 +27,12 @@ describe "dashboard/index.html.erb", :type => :view do
|
|
28
27
|
let(:can_create_collection) { true }
|
29
28
|
|
30
29
|
describe "heading" do
|
31
|
-
|
32
30
|
before do
|
33
31
|
render
|
34
32
|
@heading = view.content_for(:heading)
|
35
33
|
end
|
36
34
|
|
37
|
-
it "
|
35
|
+
it "displays welcome message and links" do
|
38
36
|
expect(@heading).to have_link("Upload", sufia.new_generic_file_path)
|
39
37
|
expect(@heading).to have_link("Create Collection", collections.new_collection_path)
|
40
38
|
expect(@heading).to have_link("View Files", sufia.dashboard_files_path)
|
@@ -44,27 +42,25 @@ describe "dashboard/index.html.erb", :type => :view do
|
|
44
42
|
|
45
43
|
context "when the user can't create files" do
|
46
44
|
let(:can_create_file) { false }
|
47
|
-
it "
|
45
|
+
it "does not display the upload button" do
|
48
46
|
expect(@heading).not_to have_link("Upload", sufia.new_generic_file_path)
|
49
47
|
end
|
50
48
|
end
|
51
49
|
context "when the user can't create collections" do
|
52
50
|
let(:can_create_collection) { false }
|
53
|
-
it "
|
51
|
+
it "does not display the create collection button" do
|
54
52
|
expect(@heading).not_to have_link("Create Collection", collections.new_collection_path)
|
55
53
|
end
|
56
54
|
end
|
57
|
-
|
58
55
|
end
|
59
56
|
|
60
57
|
describe "sidebar" do
|
61
|
-
|
62
58
|
before do
|
63
59
|
render
|
64
60
|
@sidebar = view.content_for(:sidebar)
|
65
61
|
end
|
66
62
|
|
67
|
-
it "
|
63
|
+
it "displays information about the user" do
|
68
64
|
expect(@sidebar).to include "Charles Francis Xavier"
|
69
65
|
expect(@sidebar).to include "Professor, Head"
|
70
66
|
expect(@sidebar).to include "Xavier’s School for Gifted Youngsters"
|
@@ -72,12 +68,12 @@ describe "dashboard/index.html.erb", :type => :view do
|
|
72
68
|
expect(@sidebar).to include "chuck@xsgy.edu"
|
73
69
|
end
|
74
70
|
|
75
|
-
it "
|
71
|
+
it "has links to view and edit the user's profile" do
|
76
72
|
expect(@sidebar).to include '<a class="btn btn-default" href="' + sufia.profile_path(@user) + '">View Profile</a>'
|
77
73
|
expect(@sidebar).to include '<a class="btn btn-default" href="' + sufia.edit_profile_path(@user) + '">Edit Profile</a>'
|
78
74
|
end
|
79
75
|
|
80
|
-
it "
|
76
|
+
it "displays user statistics" do
|
81
77
|
expect(@sidebar).to include "Your Statistics"
|
82
78
|
expect(@sidebar).to include '<span class="badge">1</span>'
|
83
79
|
expect(@sidebar).to include '<span class="badge">2</span>'
|
@@ -87,29 +83,26 @@ describe "dashboard/index.html.erb", :type => :view do
|
|
87
83
|
expect(@sidebar).to include '<span class="badge-optional">3</span> Downloads'
|
88
84
|
end
|
89
85
|
|
90
|
-
it "
|
86
|
+
it "shows the statistics before the profile" do
|
91
87
|
expect(@sidebar).to match(/Your Statistics.*Charles Francis Xavier/m)
|
92
88
|
end
|
93
89
|
end
|
94
90
|
|
95
91
|
describe "main" do
|
96
|
-
|
97
92
|
context "with activities and notifications" do
|
98
|
-
|
99
93
|
before do
|
100
94
|
@now = DateTime.now.to_i
|
101
95
|
assign(:activity, [
|
102
|
-
|
103
|
-
|
96
|
+
{ action: 'so and so edited their profile', timestamp: @now },
|
97
|
+
{ action: 'so and so uploaded a file', timestamp: (@now - 360) }
|
104
98
|
])
|
105
99
|
end
|
106
100
|
|
107
|
-
it "
|
101
|
+
it "includes recent activities and notifications" do
|
108
102
|
render
|
109
103
|
expect(rendered).to include "so and so edited their profile"
|
110
104
|
expect(rendered).to include "6 minutes ago"
|
111
105
|
end
|
112
|
-
|
113
106
|
end
|
114
107
|
|
115
108
|
context "with notifications" do
|
@@ -167,13 +160,13 @@ describe "dashboard/index.html.erb", :type => :view do
|
|
167
160
|
end
|
168
161
|
|
169
162
|
context "without activities and notifications" do
|
170
|
-
it "
|
163
|
+
it "includes headings for activities and notifications" do
|
171
164
|
render
|
172
165
|
expect(rendered).to include "User Activity"
|
173
166
|
expect(rendered).to include "User Notifications"
|
174
167
|
end
|
175
168
|
|
176
|
-
it "
|
169
|
+
it "shows no activities or notifications" do
|
177
170
|
render
|
178
171
|
expect(rendered).to include "User has no notifications"
|
179
172
|
expect(rendered).to include "User has no recent activity"
|