sufia 6.2.0 → 6.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.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,6 +1,6 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
|
-
describe TrophyHelper, :
|
|
3
|
+
describe TrophyHelper, type: :helper do
|
|
4
4
|
describe "#display_trophy_link" do
|
|
5
5
|
let(:user) { FactoryGirl.create(:user) }
|
|
6
6
|
let(:id) { '9999' }
|
|
@@ -9,7 +9,7 @@ describe TrophyHelper, :type => :helper do
|
|
|
9
9
|
let(:url_attribute) { "[data-url=\"/users/#{user.to_param}/trophy?file_id=#{id}\"]" }
|
|
10
10
|
|
|
11
11
|
context "when there is no trophy" do
|
|
12
|
-
it "
|
|
12
|
+
it "has a link for highlighting" do
|
|
13
13
|
out = helper.display_trophy_link(user, id) { |text| "foo #{text} bar" }
|
|
14
14
|
node = Capybara::Node::Simple.new(out)
|
|
15
15
|
expect(node).to have_selector("a.trophy-class.trophy-off#{text_attributes}#{url_attribute}")
|
|
@@ -22,15 +22,15 @@ describe TrophyHelper, :type => :helper do
|
|
|
22
22
|
user.trophies.create(generic_file_id: id)
|
|
23
23
|
end
|
|
24
24
|
|
|
25
|
-
it "
|
|
25
|
+
it "has a link for highlighting" do
|
|
26
26
|
out = helper.display_trophy_link(user, id) { |text| "foo #{text} bar" }
|
|
27
27
|
node = Capybara::Node::Simple.new(out)
|
|
28
28
|
expect(node).to have_selector("a.trophy-class.trophy-on#{text_attributes}#{url_attribute}")
|
|
29
29
|
expect(node).to have_link 'foo Unhighlight File bar', href: '#'
|
|
30
30
|
end
|
|
31
31
|
|
|
32
|
-
it "
|
|
33
|
-
out = helper.display_trophy_link(user, id, data: {removerow: true}) { |text| "foo #{text} bar" }
|
|
32
|
+
it "allows removerow to be passed" do
|
|
33
|
+
out = helper.display_trophy_link(user, id, data: { removerow: true }) { |text| "foo #{text} bar" }
|
|
34
34
|
node = Capybara::Node::Simple.new(out)
|
|
35
35
|
expect(node).to have_selector("a.trophy-class.trophy-on[data-removerow=\"true\"]#{text_attributes}#{url_attribute}")
|
|
36
36
|
end
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
3
|
describe 'MultiValueWithHelpInput', type: :input do
|
|
4
|
-
subject { input_for file, field,
|
|
4
|
+
subject { input_for file, field, as: :multi_value_with_help, required: true }
|
|
5
5
|
let(:file) { GenericFile.new }
|
|
6
6
|
|
|
7
7
|
context "when the field has a translation" do
|
|
@@ -21,5 +21,4 @@ describe 'MultiValueWithHelpInput', type: :input do
|
|
|
21
21
|
expect(subject).to have_selector('i.help-icon')
|
|
22
22
|
end
|
|
23
23
|
end
|
|
24
|
-
|
|
25
24
|
end
|
|
@@ -4,28 +4,32 @@ describe 'SelectWithHelpInput', type: :input do
|
|
|
4
4
|
subject { input_for form, :resource_type, options }
|
|
5
5
|
let(:file) { GenericFile.new }
|
|
6
6
|
let(:form) { Sufia::Forms::BatchEditForm.new(file) }
|
|
7
|
-
let(:base_options)
|
|
8
|
-
|
|
7
|
+
let(:base_options) do
|
|
8
|
+
{ as: :select_with_help, collection: Sufia.config.resource_types,
|
|
9
|
+
input_html: { class: 'form-control', multiple: true } }
|
|
10
|
+
end
|
|
9
11
|
let(:options) { base_options }
|
|
10
12
|
|
|
11
|
-
it "
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
it "is not required by default" do
|
|
14
|
+
expect(subject).to have_selector 'select'
|
|
15
|
+
expect(subject).not_to match(/required/)
|
|
14
16
|
end
|
|
15
|
-
end
|
|
16
17
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
context 'with File Edit', type: :input do
|
|
19
|
+
let(:user) { FactoryGirl.find_or_create(:jill) }
|
|
20
|
+
let(:file) { GenericFile.create(batch: Batch.create, label: 'f1') { |f| f.apply_depositor_metadata(user) } }
|
|
21
|
+
let(:form) { Sufia::Forms::GenericFileEditForm.new(file) }
|
|
22
|
+
let(:base_options) do
|
|
23
|
+
{ as: :select_with_help, collection: Sufia.config.resource_types,
|
|
24
|
+
input_html: { class: 'form-control', multiple: true } }
|
|
25
|
+
end
|
|
26
|
+
let(:options) { base_options }
|
|
24
27
|
|
|
25
|
-
|
|
28
|
+
subject { input_for form, :resource_type, options }
|
|
26
29
|
|
|
27
|
-
|
|
30
|
+
it "is not required by default" do
|
|
28
31
|
expect(subject).to have_selector 'select'
|
|
29
32
|
expect(subject).not_to match(/required/)
|
|
33
|
+
end
|
|
30
34
|
end
|
|
31
35
|
end
|
|
@@ -12,18 +12,17 @@ describe "Jasmine" do
|
|
|
12
12
|
it "expects all jasmine tests to pass" do
|
|
13
13
|
load_rake_environment ["#{jasmine_path}/lib/jasmine/tasks/jasmine.rake"]
|
|
14
14
|
jasmine_out = run_task 'jasmine:ci'
|
|
15
|
-
|
|
15
|
+
if jasmine_out.include? "0 failures"
|
|
16
|
+
js_specs_count = Dir['spec/javascripts/**/*_spec.js*'].count
|
|
17
|
+
puts "#{jasmine_out.match(/\n(.+) specs/)[1]} jasmine specs run (in #{js_specs_count} jasmine test files)"
|
|
18
|
+
else
|
|
16
19
|
puts "\n\n************************ Jasmine Output *************"
|
|
17
20
|
puts jasmine_out
|
|
18
21
|
puts "************************ Jasmine Output *************\n\n"
|
|
19
|
-
else
|
|
20
|
-
js_specs_count = Dir['spec/javascripts/**/*_spec.js*'].count
|
|
21
|
-
puts "#{jasmine_out.match(/\n(.+) specs/)[1]} jasmine specs run (in #{js_specs_count} jasmine test files)"
|
|
22
22
|
end
|
|
23
23
|
expect(jasmine_out).to include "0 failures"
|
|
24
24
|
expect(jasmine_out).to_not include "\n0 specs"
|
|
25
25
|
end
|
|
26
|
-
|
|
27
26
|
end
|
|
28
27
|
|
|
29
28
|
def jasmine_path
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
#Use this file to set/override Jasmine configuration options
|
|
2
|
-
#You can remove it if you don't need it.
|
|
3
|
-
#This file is loaded *after* jasmine.yml is interpreted.
|
|
1
|
+
# Use this file to set/override Jasmine configuration options
|
|
2
|
+
# You can remove it if you don't need it.
|
|
3
|
+
# This file is loaded *after* jasmine.yml is interpreted.
|
|
4
4
|
#
|
|
5
|
-
#Example: using a different boot file.
|
|
6
|
-
#Jasmine.configure do |config|
|
|
5
|
+
# Example: using a different boot file.
|
|
6
|
+
# Jasmine.configure do |config|
|
|
7
7
|
# config.boot_dir = '/absolute/path/to/boot_dir'
|
|
8
8
|
# config.boot_files = lambda { ['/absolute/path/to/boot_dir/file.js'] }
|
|
9
|
-
#end
|
|
9
|
+
# end
|
|
10
10
|
#
|
|
11
|
-
#Example: prevent PhantomJS auto install, uses PhantomJS already on your path.
|
|
12
|
-
#Jasmine.configure do |config|
|
|
11
|
+
# Example: prevent PhantomJS auto install, uses PhantomJS already on your path.
|
|
12
|
+
# Jasmine.configure do |config|
|
|
13
13
|
# config.prevent_phantom_js_auto_install = true
|
|
14
|
-
#end
|
|
14
|
+
# end
|
|
15
15
|
#
|
|
@@ -2,13 +2,15 @@ require 'spec_helper'
|
|
|
2
2
|
|
|
3
3
|
describe ActiveFedoraIdBasedJob do
|
|
4
4
|
let(:user) { FactoryGirl.find_or_create(:jill) }
|
|
5
|
-
let(:file)
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
let(:file) do
|
|
6
|
+
GenericFile.new.tap do |gf|
|
|
7
|
+
gf.apply_depositor_metadata(user)
|
|
8
|
+
gf.save!
|
|
9
|
+
end
|
|
10
|
+
end
|
|
9
11
|
|
|
10
12
|
it "finds object" do
|
|
11
|
-
job =
|
|
13
|
+
job = described_class.new(file.id)
|
|
12
14
|
expect(job.generic_file).to_not be_nil
|
|
13
15
|
end
|
|
14
16
|
end
|
data/spec/jobs/audit_job_spec.rb
CHANGED
|
@@ -10,25 +10,25 @@ describe AuditJob do
|
|
|
10
10
|
end
|
|
11
11
|
end
|
|
12
12
|
|
|
13
|
-
let(:job) {
|
|
13
|
+
let(:job) { described_class.new(file.id, 'content', uri) }
|
|
14
14
|
|
|
15
15
|
describe "audit on content" do
|
|
16
16
|
let(:uri) { file.content.uri }
|
|
17
|
-
it "
|
|
17
|
+
it "passes" do
|
|
18
18
|
expect(job.run).to eq(true)
|
|
19
19
|
end
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
describe "audit on a version of the content" do
|
|
23
23
|
let(:uri) { file.content.versions.first.uri }
|
|
24
|
-
it "
|
|
24
|
+
it "passes" do
|
|
25
25
|
expect(job.run).to eq(true)
|
|
26
26
|
end
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
describe "audit on an invalid version of the content" do
|
|
30
30
|
let(:uri) { file.content.versions.first.uri + "bogus" }
|
|
31
|
-
it "
|
|
31
|
+
it "fails" do
|
|
32
32
|
expect(job.run).to eq(false)
|
|
33
33
|
end
|
|
34
34
|
end
|
|
@@ -44,13 +44,13 @@ describe AuditJob do
|
|
|
44
44
|
|
|
45
45
|
context "when the audit passes" do
|
|
46
46
|
let(:result) { true }
|
|
47
|
-
it "
|
|
47
|
+
it "does not send mail" do
|
|
48
48
|
expect(inbox.count).to eq(0)
|
|
49
49
|
end
|
|
50
50
|
end
|
|
51
51
|
context "when the audit fails" do
|
|
52
52
|
let(:result) { false }
|
|
53
|
-
it "
|
|
53
|
+
it "sends failing mail" do
|
|
54
54
|
expect(inbox.count).to eq(1)
|
|
55
55
|
inbox.each { |msg| expect(msg.last_message.subject).to eq(AuditJob::FAIL) }
|
|
56
56
|
end
|
|
@@ -68,7 +68,7 @@ describe AuditJob do
|
|
|
68
68
|
allow(mock_service).to receive(:check).and_return(true, false, false, true, false)
|
|
69
69
|
end
|
|
70
70
|
|
|
71
|
-
it "
|
|
71
|
+
it "does not prune failed audits" do
|
|
72
72
|
5.times { job.send(:run_audit) }
|
|
73
73
|
expect(ChecksumAuditLog.logs_for(file.id, 'content').map(&:pass)).to eq [0, 1, 0, 0, 1, 0, 1]
|
|
74
74
|
end
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
3
|
describe BatchUpdateJob do
|
|
4
|
-
|
|
5
4
|
let(:user) { FactoryGirl.find_or_create(:jill) }
|
|
6
5
|
let(:batch) { Batch.create }
|
|
7
6
|
|
|
@@ -20,7 +19,7 @@ describe BatchUpdateJob do
|
|
|
20
19
|
end
|
|
21
20
|
|
|
22
21
|
describe "#run" do
|
|
23
|
-
let(:title) { { file.id => ['File One'], file2.id => ['File Two'] }}
|
|
22
|
+
let(:title) { { file.id => ['File One'], file2.id => ['File Two'] } }
|
|
24
23
|
let(:metadata) do
|
|
25
24
|
{ read_groups_string: '', read_users_string: 'archivist1, archivist2',
|
|
26
25
|
tag: [''] }.with_indifferent_access
|
|
@@ -28,10 +27,10 @@ describe BatchUpdateJob do
|
|
|
28
27
|
|
|
29
28
|
let(:visibility) { nil }
|
|
30
29
|
|
|
31
|
-
let(:job) {
|
|
30
|
+
let(:job) { described_class.new(user.user_key, batch.id, title, metadata, visibility) }
|
|
32
31
|
|
|
33
32
|
context "with a failing update" do
|
|
34
|
-
it "
|
|
33
|
+
it "checks permissions for each file before updating" do
|
|
35
34
|
expect_any_instance_of(User).to receive(:can?).with(:edit, file).and_return(false)
|
|
36
35
|
expect_any_instance_of(User).to receive(:can?).with(:edit, file2).and_return(false)
|
|
37
36
|
job.run
|
|
@@ -44,7 +43,7 @@ describe BatchUpdateJob do
|
|
|
44
43
|
describe "sends events" do
|
|
45
44
|
let(:s1) { double('one') }
|
|
46
45
|
let(:s2) { double('two') }
|
|
47
|
-
it "
|
|
46
|
+
it "logs a content update event" do
|
|
48
47
|
expect_any_instance_of(User).to receive(:can?).with(:edit, file).and_return(true)
|
|
49
48
|
expect_any_instance_of(User).to receive(:can?).with(:edit, file2).and_return(true)
|
|
50
49
|
expect(ContentUpdateEventJob).to receive(:new).with(file.id, user.user_key).and_return(s1)
|
|
@@ -64,7 +63,7 @@ describe BatchUpdateJob do
|
|
|
64
63
|
job.run
|
|
65
64
|
end
|
|
66
65
|
|
|
67
|
-
it "
|
|
66
|
+
it "updates the titles" do
|
|
68
67
|
expect(file.reload.title).to eq ['File One']
|
|
69
68
|
end
|
|
70
69
|
end
|
|
@@ -11,7 +11,7 @@ describe CharacterizeJob do
|
|
|
11
11
|
end
|
|
12
12
|
end
|
|
13
13
|
|
|
14
|
-
subject {
|
|
14
|
+
subject { described_class.new(@generic_file.id) }
|
|
15
15
|
|
|
16
16
|
it 'spawns a CreateDerivatives job' do
|
|
17
17
|
expect(CreateDerivativesJob).to receive(:new).with(@generic_file.id).once.and_call_original
|
|
@@ -8,7 +8,7 @@ describe ContentDepositorChangeEventJob do
|
|
|
8
8
|
gf.apply_depositor_metadata(@depositor.user_key)
|
|
9
9
|
gf.save!
|
|
10
10
|
end
|
|
11
|
-
|
|
11
|
+
described_class.new(@file.id, @receiver.user_key).run
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
it "changes the depositor and records an original depositor" do
|
|
@@ -11,7 +11,7 @@ describe CreateDerivativesJob do
|
|
|
11
11
|
Sufia.config.enable_ffmpeg = @ffmpeg_enabled
|
|
12
12
|
end
|
|
13
13
|
|
|
14
|
-
subject {
|
|
14
|
+
subject { described_class.new(@generic_file.id) }
|
|
15
15
|
|
|
16
16
|
describe 'thumbnail generation' do
|
|
17
17
|
before do
|
|
@@ -134,8 +134,8 @@ describe CreateDerivativesJob do
|
|
|
134
134
|
# @generic_file.save!
|
|
135
135
|
# end
|
|
136
136
|
|
|
137
|
-
#Need a way to do this in hydra-derivatives
|
|
138
|
-
it '
|
|
137
|
+
# Need a way to do this in hydra-derivatives
|
|
138
|
+
it 'copies the content to the mp3 datastream and transcode to ogg', skip: true do
|
|
139
139
|
subject.run
|
|
140
140
|
reloaded = @generic_file.reload
|
|
141
141
|
derivative = reloaded.attached_files['mp3']
|
|
@@ -155,8 +155,8 @@ describe CreateDerivativesJob do
|
|
|
155
155
|
# @generic_file.save!
|
|
156
156
|
# end
|
|
157
157
|
|
|
158
|
-
#Need a way to do this in hydra-derivatives
|
|
159
|
-
it '
|
|
158
|
+
# Need a way to do this in hydra-derivatives
|
|
159
|
+
it 'copies the content to the ogg datastream and transcode to mp3', skip: true do
|
|
160
160
|
subject.run
|
|
161
161
|
reloaded = @generic_file.reload
|
|
162
162
|
derivative = reloaded.attached_files['mp3']
|
|
@@ -15,7 +15,7 @@ describe 'event jobs' do
|
|
|
15
15
|
$redis.keys('User:*').each { |key| $redis.del key }
|
|
16
16
|
$redis.keys('GenericFile:*').each { |key| $redis.del key }
|
|
17
17
|
end
|
|
18
|
-
it "
|
|
18
|
+
it "logs user edit profile events" do
|
|
19
19
|
# UserEditProfile should log the event to the editor's dashboard and his/her followers' dashboards
|
|
20
20
|
@another_user.follow(@user)
|
|
21
21
|
count_user = @user.events.length
|
|
@@ -28,7 +28,7 @@ describe 'event jobs' do
|
|
|
28
28
|
expect(@another_user.events.length).to eq(count_another + 1)
|
|
29
29
|
expect(@another_user.events.first).to eq(event)
|
|
30
30
|
end
|
|
31
|
-
it "
|
|
31
|
+
it "logs user follow events" do
|
|
32
32
|
# UserFollow should log the event to the follower's dashboard, the followee's dashboard, and followers' dashboards
|
|
33
33
|
@third_user.follow(@user)
|
|
34
34
|
expect(@user.events.length).to eq(0)
|
|
@@ -44,7 +44,7 @@ describe 'event jobs' do
|
|
|
44
44
|
expect(@third_user.events.length).to eq(1)
|
|
45
45
|
expect(@third_user.events.first).to eq(event)
|
|
46
46
|
end
|
|
47
|
-
it "
|
|
47
|
+
it "logs user unfollow events" do
|
|
48
48
|
# UserUnfollow should log the event to the unfollower's dashboard, the unfollowee's dashboard, and followers' dashboards
|
|
49
49
|
@third_user.follow(@user)
|
|
50
50
|
@user.follow(@another_user)
|
|
@@ -61,7 +61,7 @@ describe 'event jobs' do
|
|
|
61
61
|
expect(@third_user.events.length).to eq(1)
|
|
62
62
|
expect(@third_user.events.first).to eq(event)
|
|
63
63
|
end
|
|
64
|
-
it "
|
|
64
|
+
it "logs content deposit events" do
|
|
65
65
|
# ContentDeposit should log the event to the depositor's profile, followers' dashboards, and the GF
|
|
66
66
|
@another_user.follow(@user)
|
|
67
67
|
@third_user.follow(@user)
|
|
@@ -71,7 +71,7 @@ describe 'event jobs' do
|
|
|
71
71
|
expect(@third_user.events.length).to eq(0)
|
|
72
72
|
expect(@gf.events.length).to eq(0)
|
|
73
73
|
expect(Time).to receive(:now).at_least(:once).and_return(1)
|
|
74
|
-
event = {action: 'User <a href="/users/jilluser@example-dot-com">jilluser@example.com</a> has deposited <a href="/files/test-123">Hamlet</a>', timestamp: '1' }
|
|
74
|
+
event = { action: 'User <a href="/users/jilluser@example-dot-com">jilluser@example.com</a> has deposited <a href="/files/test-123">Hamlet</a>', timestamp: '1' }
|
|
75
75
|
ContentDepositEventJob.new('test-123', @user.user_key).run
|
|
76
76
|
expect(@user.profile_events.length).to eq(1)
|
|
77
77
|
expect(@user.profile_events.first).to eq(event)
|
|
@@ -87,7 +87,7 @@ describe 'event jobs' do
|
|
|
87
87
|
@third_user.follow(@another_user)
|
|
88
88
|
allow_any_instance_of(User).to receive(:can?).and_return(true)
|
|
89
89
|
allow(Time).to receive(:now).at_least(:once).and_return(1)
|
|
90
|
-
event = {action: 'User <a href="/users/jilluser@example-dot-com">jilluser@example.com</a> has transferred <a href="/files/test-123">Hamlet</a> to user <a href="/users/archivist1@example-dot-com">archivist1@example.com</a>', timestamp: '1' }
|
|
90
|
+
event = { action: 'User <a href="/users/jilluser@example-dot-com">jilluser@example.com</a> has transferred <a href="/files/test-123">Hamlet</a> to user <a href="/users/archivist1@example-dot-com">archivist1@example.com</a>', timestamp: '1' }
|
|
91
91
|
ContentDepositorChangeEventJob.new('test-123', @another_user.user_key).run
|
|
92
92
|
expect(@user.profile_events.length).to eq(1)
|
|
93
93
|
expect(@user.profile_events.first).to eq(event)
|
|
@@ -98,7 +98,7 @@ describe 'event jobs' do
|
|
|
98
98
|
expect(@gf.events.length).to eq(1)
|
|
99
99
|
expect(@gf.events.first).to eq(event)
|
|
100
100
|
end
|
|
101
|
-
it "
|
|
101
|
+
it "logs content update events" do
|
|
102
102
|
# ContentUpdate should log the event to the depositor's profile, followers' dashboards, and the GF
|
|
103
103
|
@another_user.follow(@user)
|
|
104
104
|
@third_user.follow(@user)
|
|
@@ -108,7 +108,7 @@ describe 'event jobs' do
|
|
|
108
108
|
expect(@third_user.events.length).to eq(0)
|
|
109
109
|
expect(@gf.events.length).to eq(0)
|
|
110
110
|
expect(Time).to receive(:now).at_least(:once).and_return(1)
|
|
111
|
-
event = {action: 'User <a href="/users/jilluser@example-dot-com">jilluser@example.com</a> has updated <a href="/files/test-123">Hamlet</a>', timestamp: '1' }
|
|
111
|
+
event = { action: 'User <a href="/users/jilluser@example-dot-com">jilluser@example.com</a> has updated <a href="/files/test-123">Hamlet</a>', timestamp: '1' }
|
|
112
112
|
ContentUpdateEventJob.new('test-123', @user.user_key).run
|
|
113
113
|
expect(@user.profile_events.length).to eq(1)
|
|
114
114
|
expect(@user.profile_events.first).to eq(event)
|
|
@@ -119,7 +119,7 @@ describe 'event jobs' do
|
|
|
119
119
|
expect(@gf.events.length).to eq(1)
|
|
120
120
|
expect(@gf.events.first).to eq(event)
|
|
121
121
|
end
|
|
122
|
-
it "
|
|
122
|
+
it "logs content new version events" do
|
|
123
123
|
# ContentNewVersion should log the event to the depositor's profile, followers' dashboards, and the GF
|
|
124
124
|
@another_user.follow(@user)
|
|
125
125
|
@third_user.follow(@user)
|
|
@@ -129,7 +129,7 @@ describe 'event jobs' do
|
|
|
129
129
|
expect(@third_user.events.length).to eq(0)
|
|
130
130
|
expect(@gf.events.length).to eq(0)
|
|
131
131
|
expect(Time).to receive(:now).at_least(:once).and_return(1)
|
|
132
|
-
event = {action: 'User <a href="/users/jilluser@example-dot-com">jilluser@example.com</a> has added a new version of <a href="/files/test-123">Hamlet</a>', timestamp: '1' }
|
|
132
|
+
event = { action: 'User <a href="/users/jilluser@example-dot-com">jilluser@example.com</a> has added a new version of <a href="/files/test-123">Hamlet</a>', timestamp: '1' }
|
|
133
133
|
ContentNewVersionEventJob.new('test-123', @user.user_key).run
|
|
134
134
|
expect(@user.profile_events.length).to eq(1)
|
|
135
135
|
expect(@user.profile_events.first).to eq(event)
|
|
@@ -140,7 +140,7 @@ describe 'event jobs' do
|
|
|
140
140
|
expect(@gf.events.length).to eq(1)
|
|
141
141
|
expect(@gf.events.first).to eq(event)
|
|
142
142
|
end
|
|
143
|
-
it "
|
|
143
|
+
it "logs content restored version events" do
|
|
144
144
|
# ContentRestoredVersion should log the event to the depositor's profile, followers' dashboards, and the GF
|
|
145
145
|
@another_user.follow(@user)
|
|
146
146
|
@third_user.follow(@user)
|
|
@@ -150,7 +150,7 @@ describe 'event jobs' do
|
|
|
150
150
|
expect(@third_user.events.length).to eq(0)
|
|
151
151
|
expect(@gf.events.length).to eq(0)
|
|
152
152
|
expect(Time).to receive(:now).at_least(:once).and_return(1)
|
|
153
|
-
event = {action: 'User <a href="/users/jilluser@example-dot-com">jilluser@example.com</a> has restored a version \'content.0\' of <a href="/files/test-123">Hamlet</a>', timestamp: '1' }
|
|
153
|
+
event = { action: 'User <a href="/users/jilluser@example-dot-com">jilluser@example.com</a> has restored a version \'content.0\' of <a href="/files/test-123">Hamlet</a>', timestamp: '1' }
|
|
154
154
|
ContentRestoredVersionEventJob.new('test-123', @user.user_key, 'content.0').run
|
|
155
155
|
expect(@user.profile_events.length).to eq(1)
|
|
156
156
|
expect(@user.profile_events.first).to eq(event)
|
|
@@ -161,7 +161,7 @@ describe 'event jobs' do
|
|
|
161
161
|
expect(@gf.events.length).to eq(1)
|
|
162
162
|
expect(@gf.events.first).to eq(event)
|
|
163
163
|
end
|
|
164
|
-
it "
|
|
164
|
+
it "logs content delete events" do
|
|
165
165
|
# ContentDelete should log the event to the depositor's profile and followers' dashboards
|
|
166
166
|
@another_user.follow(@user)
|
|
167
167
|
@third_user.follow(@user)
|
|
@@ -169,7 +169,7 @@ describe 'event jobs' do
|
|
|
169
169
|
expect(@another_user.events.length).to eq(0)
|
|
170
170
|
expect(@third_user.events.length).to eq(0)
|
|
171
171
|
expect(Time).to receive(:now).at_least(:once).and_return(1)
|
|
172
|
-
event = {action: 'User <a href="/users/jilluser@example-dot-com">jilluser@example.com</a> has deleted file \'test-123\'', timestamp: '1' }
|
|
172
|
+
event = { action: 'User <a href="/users/jilluser@example-dot-com">jilluser@example.com</a> has deleted file \'test-123\'', timestamp: '1' }
|
|
173
173
|
ContentDeleteEventJob.new('test-123', @user.user_key).run
|
|
174
174
|
expect(@user.profile_events.length).to eq(1)
|
|
175
175
|
expect(@user.profile_events.first).to eq(event)
|
|
@@ -178,7 +178,7 @@ describe 'event jobs' do
|
|
|
178
178
|
expect(@third_user.events.length).to eq(1)
|
|
179
179
|
expect(@third_user.events.first).to eq(event)
|
|
180
180
|
end
|
|
181
|
-
it "
|
|
181
|
+
it "does not log content-related jobs to followers who lack access" do
|
|
182
182
|
# No Content-related eventjobs should log an event to a follower who does not have access to the GF
|
|
183
183
|
@another_user.follow(@user)
|
|
184
184
|
@third_user.follow(@user)
|
|
@@ -188,7 +188,7 @@ describe 'event jobs' do
|
|
|
188
188
|
expect(@gf.events.length).to eq(0)
|
|
189
189
|
@now = Time.now
|
|
190
190
|
expect(Time).to receive(:now).at_least(:once).and_return(@now)
|
|
191
|
-
event = {action: 'User <a href="/users/jilluser@example-dot-com">jilluser@example.com</a> has updated <a href="/files/test-123">Hamlet</a>', timestamp: @now.to_i.to_s }
|
|
191
|
+
event = { action: 'User <a href="/users/jilluser@example-dot-com">jilluser@example.com</a> has updated <a href="/files/test-123">Hamlet</a>', timestamp: @now.to_i.to_s }
|
|
192
192
|
ContentUpdateEventJob.new('test-123', @user.user_key).run
|
|
193
193
|
expect(@user.profile_events.length).to eq(1)
|
|
194
194
|
expect(@user.profile_events.first).to eq(event)
|