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,14 +1,14 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe HomepageController, :
|
3
|
+
describe HomepageController, type: :controller do
|
4
4
|
routes { Rails.application.class.routes }
|
5
5
|
|
6
6
|
describe "#index" do
|
7
7
|
before do
|
8
|
-
@gf1 = GenericFile.new(title:['Test Document PDF'], filename:['test.pdf'], tag:['rocks'], read_groups:['public'])
|
8
|
+
@gf1 = GenericFile.new(title: ['Test Document PDF'], filename: ['test.pdf'], tag: ['rocks'], read_groups: ['public'])
|
9
9
|
@gf1.apply_depositor_metadata('mjg36')
|
10
10
|
@gf1.save
|
11
|
-
@gf2 = GenericFile.new(title:['Test Private Document'], filename:['test2.doc'], tag:['clouds'], contributor:['Contrib1'], read_groups:['private'])
|
11
|
+
@gf2 = GenericFile.new(title: ['Test Private Document'], filename: ['test2.doc'], tag: ['clouds'], contributor: ['Contrib1'], read_groups: ['private'])
|
12
12
|
@gf2.apply_depositor_metadata('mjg36')
|
13
13
|
@gf2.save
|
14
14
|
end
|
@@ -30,7 +30,7 @@ describe HomepageController, :type => :controller do
|
|
30
30
|
end
|
31
31
|
|
32
32
|
context 'with no featured researcher' do
|
33
|
-
it "
|
33
|
+
it "sets featured researcher" do
|
34
34
|
get :index
|
35
35
|
expect(response).to be_success
|
36
36
|
assigns(:featured_researcher).tap do |researcher|
|
@@ -40,7 +40,7 @@ describe HomepageController, :type => :controller do
|
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
|
-
it "
|
43
|
+
it "sets marketing text" do
|
44
44
|
get :index
|
45
45
|
expect(response).to be_success
|
46
46
|
assigns(:marketing_text).tap do |marketing|
|
@@ -49,23 +49,23 @@ describe HomepageController, :type => :controller do
|
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
|
-
it "
|
52
|
+
it "does not include other user's private documents in recent documents" do
|
53
53
|
get :index
|
54
54
|
expect(response).to be_success
|
55
|
-
titles = assigns(:recent_documents).map {|d| d['title_tesim'][0]}
|
55
|
+
titles = assigns(:recent_documents).map { |d| d['title_tesim'][0] }
|
56
56
|
expect(titles).to_not include('Test Private Document')
|
57
57
|
end
|
58
58
|
|
59
|
-
it "
|
59
|
+
it "includes only GenericFile objects in recent documents" do
|
60
60
|
get :index
|
61
61
|
assigns(:recent_documents).each do |doc|
|
62
62
|
expect(doc[Solrizer.solr_name("has_model", :symbol)]).to eql ["GenericFile"]
|
63
63
|
end
|
64
|
-
end
|
64
|
+
end
|
65
65
|
|
66
66
|
context "with a document not created this second" do
|
67
67
|
before do
|
68
|
-
gf3 = GenericFile.new(title:['Test 3 Document'], read_groups:['public'])
|
68
|
+
gf3 = GenericFile.new(title: ['Test 3 Document'], read_groups: ['public'])
|
69
69
|
gf3.apply_depositor_metadata('mjg36')
|
70
70
|
# stubbing to_solr so we know we have something that didn't create in the current second
|
71
71
|
old_to_solr = gf3.method(:to_solr)
|
@@ -77,15 +77,13 @@ describe HomepageController, :type => :controller do
|
|
77
77
|
gf3.save
|
78
78
|
end
|
79
79
|
|
80
|
-
it "
|
80
|
+
it "sets recent documents in the right order" do
|
81
81
|
get :index
|
82
82
|
expect(response).to be_success
|
83
83
|
expect(assigns(:recent_documents).length).to be <= 4
|
84
|
-
create_times = assigns(:recent_documents).map{|d| d['system_create_dtsi']}
|
84
|
+
create_times = assigns(:recent_documents).map { |d| d['system_create_dtsi'] }
|
85
85
|
expect(create_times).to eq create_times.sort.reverse
|
86
86
|
end
|
87
|
-
|
88
|
-
|
89
87
|
end
|
90
88
|
|
91
89
|
context "with featured works" do
|
@@ -93,11 +91,20 @@ describe HomepageController, :type => :controller do
|
|
93
91
|
FeaturedWork.create!(generic_file_id: @gf1.id)
|
94
92
|
end
|
95
93
|
|
96
|
-
it "
|
94
|
+
it "sets featured works" do
|
97
95
|
get :index
|
98
96
|
expect(response).to be_success
|
99
97
|
expect(assigns(:featured_work_list)).to be_kind_of FeaturedWorkList
|
100
98
|
end
|
101
99
|
end
|
100
|
+
|
101
|
+
it "sets announcement content block" do
|
102
|
+
get :index
|
103
|
+
expect(response).to be_success
|
104
|
+
assigns(:announcement_text).tap do |announcement|
|
105
|
+
expect(announcement).to be_kind_of ContentBlock
|
106
|
+
expect(announcement.name).to eq 'announcement_text'
|
107
|
+
end
|
108
|
+
end
|
102
109
|
end
|
103
110
|
end
|
@@ -1,50 +1,34 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe MailboxController, :
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
@rec1 = @another_user.send_message(@user, @message, @subject)
|
10
|
-
@rec2 = @user.send_message(@another_user, @message, @subject)
|
11
|
-
allow_any_instance_of(MailboxController).to receive(:authenticate_user!).and_return(true)
|
12
|
-
sign_in @user
|
3
|
+
describe MailboxController, type: :controller do
|
4
|
+
let(:mock_box) { {} }
|
5
|
+
|
6
|
+
before do
|
7
|
+
allow_any_instance_of(described_class).to receive(:authenticate_user!).and_return(true)
|
8
|
+
allow(UserMailbox).to receive(:new).and_return(mock_box)
|
13
9
|
end
|
14
10
|
|
15
11
|
describe "#index" do
|
16
|
-
it "
|
12
|
+
it "shows message" do
|
13
|
+
expect(mock_box).to receive(:inbox).and_return(["test"])
|
17
14
|
get :index
|
18
15
|
expect(response).to be_success
|
19
|
-
expect(assigns[:messages]
|
20
|
-
expect(assigns[:messages].first.last_message.subject).to eq('Test Subject')
|
21
|
-
expect(@user.mailbox.inbox(unread: true).count).to eq(0)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
describe "#delete" do
|
25
|
-
it "should delete message" do
|
26
|
-
rec = @another_user.send_message(@user, 'message 2', 'subject 2')
|
27
|
-
expect {
|
28
|
-
delete :destroy, id: rec.conversation.id
|
29
|
-
expect(response).to redirect_to(@routes.url_helpers.notifications_path)
|
30
|
-
}.to change {@user.mailbox.inbox.count}.by(-1)
|
31
|
-
end
|
32
|
-
it "should not delete message" do
|
33
|
-
@curator = FactoryGirl.find_or_create(:curator)
|
34
|
-
rec = @another_user.send_message(@curator, 'message 3', 'subject 3')
|
35
|
-
expect {
|
36
|
-
delete :destroy, id: rec.conversation.id
|
37
|
-
expect(response).to redirect_to(@routes.url_helpers.notifications_path)
|
38
|
-
}.to_not change { @curator.mailbox.inbox.count}
|
16
|
+
expect(assigns[:messages]).to eq(["test"])
|
39
17
|
end
|
40
18
|
end
|
19
|
+
|
41
20
|
describe "#delete_all" do
|
42
|
-
it "
|
43
|
-
|
44
|
-
@another_user.send_message(@user, 'message 3', 'subject 3')
|
45
|
-
expect(@user.mailbox.inbox.count).to eq(3)
|
21
|
+
it "deletes all messages" do
|
22
|
+
expect(mock_box).to receive(:delete_all)
|
46
23
|
get :delete_all
|
47
|
-
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe "#delete" do
|
28
|
+
it "deletes message" do
|
29
|
+
expect(mock_box).to receive(:destroy).with("4")
|
30
|
+
delete :destroy, id: "4"
|
31
|
+
expect(response).to redirect_to(@routes.url_helpers.notifications_path)
|
48
32
|
end
|
49
33
|
end
|
50
34
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe My::CollectionsController, :
|
3
|
+
describe My::CollectionsController, type: :controller do
|
4
4
|
describe "logged in user" do
|
5
|
-
before
|
5
|
+
before do
|
6
6
|
@user = FactoryGirl.find_or_create(:archivist)
|
7
7
|
sign_in @user
|
8
8
|
end
|
@@ -21,12 +21,12 @@ describe My::CollectionsController, :type => :controller do
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
-
it "
|
24
|
+
it "responds with success" do
|
25
25
|
get :index
|
26
26
|
expect(response).to be_successful
|
27
27
|
end
|
28
28
|
|
29
|
-
it "
|
29
|
+
it "paginates" do
|
30
30
|
Collection.new(title: "test collection").tap do |c|
|
31
31
|
c.apply_depositor_metadata(@user.user_key)
|
32
32
|
c.save!
|
@@ -52,5 +52,4 @@ describe My::CollectionsController, :type => :controller do
|
|
52
52
|
end
|
53
53
|
end
|
54
54
|
end
|
55
|
-
|
56
55
|
end
|
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe My::FilesController, :
|
4
|
-
|
3
|
+
describe My::FilesController, type: :controller do
|
5
4
|
let(:my_collection) do
|
6
5
|
Collection.create(title: 'test collection') do |c|
|
7
6
|
c.apply_depositor_metadata(user.user_key)
|
@@ -36,12 +35,12 @@ describe My::FilesController, :type => :controller do
|
|
36
35
|
@wrong_type = Batch.create
|
37
36
|
end
|
38
37
|
|
39
|
-
it "
|
38
|
+
it "responds with success" do
|
40
39
|
get :index
|
41
40
|
expect(response).to be_successful
|
42
41
|
end
|
43
42
|
|
44
|
-
it "
|
43
|
+
it "paginates" do
|
45
44
|
FactoryGirl.create(:generic_file)
|
46
45
|
FactoryGirl.create(:generic_file)
|
47
46
|
get :index, per_page: 2
|
@@ -72,20 +71,20 @@ describe My::FilesController, :type => :controller do
|
|
72
71
|
|
73
72
|
describe "batch processing" do
|
74
73
|
include Sufia::Messages
|
75
|
-
let(:batch_id) {"batch_id"}
|
76
|
-
let(:batch_id2) {"batch_id2"}
|
77
|
-
let(:batch) {double}
|
74
|
+
let(:batch_id) { "batch_id" }
|
75
|
+
let(:batch_id2) { "batch_id2" }
|
76
|
+
let(:batch) { double }
|
78
77
|
|
79
78
|
before do
|
80
79
|
allow(batch).to receive(:id).and_return(batch_id)
|
81
|
-
User.batchuser
|
82
|
-
User.batchuser
|
80
|
+
User.batchuser.send_message(user, single_success(batch_id, batch), success_subject, false)
|
81
|
+
User.batchuser.send_message(user, multiple_success(batch_id2, [batch]), success_subject, false)
|
83
82
|
get :index
|
84
83
|
end
|
85
84
|
it "gets batches that are complete" do
|
86
85
|
expect(assigns(:batches).count).to eq(2)
|
87
|
-
expect(assigns(:batches)).to include("ss-"+batch_id)
|
88
|
-
expect(assigns(:batches)).to include("ss-"+batch_id2)
|
86
|
+
expect(assigns(:batches)).to include("ss-" + batch_id)
|
87
|
+
expect(assigns(:batches)).to include("ss-" + batch_id2)
|
89
88
|
end
|
90
89
|
end
|
91
90
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe My::HighlightsController, :
|
3
|
+
describe My::HighlightsController, type: :controller do
|
4
4
|
describe "logged in user" do
|
5
|
-
before
|
5
|
+
before do
|
6
6
|
@user = FactoryGirl.find_or_create(:archivist)
|
7
7
|
sign_in @user
|
8
8
|
end
|
@@ -23,12 +23,12 @@ describe My::HighlightsController, :type => :controller do
|
|
23
23
|
other_user.trophies.create(generic_file_id: @unrelated_highlighted_file.id)
|
24
24
|
end
|
25
25
|
|
26
|
-
it "
|
26
|
+
it "responds with success" do
|
27
27
|
get :index
|
28
28
|
expect(response).to be_successful
|
29
29
|
end
|
30
30
|
|
31
|
-
it "
|
31
|
+
it "paginates" do
|
32
32
|
@user.trophies.create(generic_file_id: FactoryGirl.create(:generic_file, depositor: @user).id)
|
33
33
|
@user.trophies.create(generic_file_id: FactoryGirl.create(:generic_file, depositor: @user).id)
|
34
34
|
get :index, per_page: 2
|
@@ -48,5 +48,4 @@ describe My::HighlightsController, :type => :controller do
|
|
48
48
|
end
|
49
49
|
end
|
50
50
|
end
|
51
|
-
|
52
51
|
end
|
@@ -1,10 +1,10 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe My::SharesController, :
|
3
|
+
describe My::SharesController, type: :controller do
|
4
4
|
describe "logged in user" do
|
5
5
|
let(:user) { FactoryGirl.find_or_create(:archivist) }
|
6
6
|
|
7
|
-
before
|
7
|
+
before do
|
8
8
|
sign_in user
|
9
9
|
end
|
10
10
|
|
@@ -14,43 +14,42 @@ describe My::SharesController, :type => :controller do
|
|
14
14
|
let!(:my_file) { FactoryGirl.create(:generic_file, depositor: user) }
|
15
15
|
let!(:unshared_file) { FactoryGirl.create(:generic_file, depositor: other_user) }
|
16
16
|
|
17
|
-
let!(:shared_with_me)
|
17
|
+
let!(:shared_with_me) do
|
18
18
|
FactoryGirl.create(:generic_file).tap do |r|
|
19
19
|
r.apply_depositor_metadata other_user
|
20
20
|
r.edit_users += [user.user_key]
|
21
21
|
r.save!
|
22
22
|
end
|
23
|
-
|
23
|
+
end
|
24
24
|
|
25
|
-
let!(:read_shared_with_me)
|
25
|
+
let!(:read_shared_with_me) do
|
26
26
|
FactoryGirl.create(:generic_file, depositor: other_user).tap do |r|
|
27
27
|
r.read_users += [user.user_key]
|
28
28
|
r.save!
|
29
29
|
end
|
30
|
-
|
30
|
+
end
|
31
31
|
|
32
|
-
let!(:shared_with_someone_else)
|
32
|
+
let!(:shared_with_someone_else) do
|
33
33
|
FactoryGirl.create(:generic_file).tap do |r|
|
34
34
|
r.apply_depositor_metadata user
|
35
35
|
r.edit_users += [other_user.user_key]
|
36
36
|
r.save!
|
37
37
|
end
|
38
|
-
|
38
|
+
end
|
39
39
|
|
40
|
-
let!(:my_collection)
|
40
|
+
let!(:my_collection) do
|
41
41
|
Collection.new(title: "My collection").tap do |c|
|
42
42
|
c.apply_depositor_metadata(user.user_key)
|
43
43
|
c.save!
|
44
44
|
end
|
45
|
-
|
46
|
-
|
45
|
+
end
|
47
46
|
|
48
|
-
it "
|
47
|
+
it "responds with success" do
|
49
48
|
get :index
|
50
49
|
expect(response).to be_successful
|
51
50
|
end
|
52
51
|
|
53
|
-
it "
|
52
|
+
it "paginates" do
|
54
53
|
FactoryGirl.create(:generic_file).tap do |r|
|
55
54
|
r.apply_depositor_metadata other_user
|
56
55
|
r.edit_users += [user.user_key]
|
@@ -83,5 +82,4 @@ describe My::SharesController, :type => :controller do
|
|
83
82
|
end
|
84
83
|
end
|
85
84
|
end
|
86
|
-
|
87
85
|
end
|
@@ -1,12 +1,12 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe PagesController, :
|
4
|
-
let(:page_name) {"about_page"}
|
3
|
+
describe PagesController, type: :controller do
|
4
|
+
let(:page_name) { "about_page" }
|
5
5
|
context "content exists" do
|
6
6
|
describe "GET #show" do
|
7
7
|
let(:page) { ContentBlock.create!(name: page_name, value: "foo bar") }
|
8
8
|
|
9
|
-
it "
|
9
|
+
it "updates the node" do
|
10
10
|
get :show, id: page.name
|
11
11
|
expect(response).to be_successful
|
12
12
|
expect(assigns[:page]).to eq page
|
@@ -15,7 +15,7 @@ describe PagesController, :type => :controller do
|
|
15
15
|
end
|
16
16
|
context "content does not exist" do
|
17
17
|
describe "GET #show" do
|
18
|
-
it "
|
18
|
+
it "creates the node" do
|
19
19
|
get :show, id: "about_page"
|
20
20
|
expect(response).to be_successful
|
21
21
|
expect(assigns[:page]).not_to be_nil
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe SingleUseLinksController, :
|
3
|
+
describe SingleUseLinksController, type: :controller do
|
4
4
|
let(:user) { FactoryGirl.find_or_create(:jill) }
|
5
5
|
|
6
6
|
let(:file) do
|
@@ -51,7 +51,6 @@ describe SingleUseLinksController, :type => :controller do
|
|
51
51
|
get 'new_download', id: file
|
52
52
|
expect(response).not_to be_success
|
53
53
|
end
|
54
|
-
|
55
54
|
end
|
56
55
|
|
57
56
|
describe "GET 'show'" do
|
@@ -59,7 +58,6 @@ describe SingleUseLinksController, :type => :controller do
|
|
59
58
|
get 'new_show', id: file
|
60
59
|
expect(response).not_to be_success
|
61
60
|
end
|
62
|
-
|
63
61
|
end
|
64
62
|
end
|
65
63
|
|
@@ -30,7 +30,7 @@ describe SingleUseLinksViewerController do
|
|
30
30
|
let(:expected_content) { ActiveFedora::Base.find(file.id).content.content }
|
31
31
|
|
32
32
|
it "and_return http success" do
|
33
|
-
expect(controller).to receive(:send_file_headers!).with(filename: 'world.png', disposition: '
|
33
|
+
expect(controller).to receive(:send_file_headers!).with(filename: 'world.png', disposition: 'attachment', type: 'image/png')
|
34
34
|
get :download, id: download_link_hash
|
35
35
|
expect(response.body).to eq expected_content
|
36
36
|
expect(response).to be_success
|
@@ -69,5 +69,4 @@ describe SingleUseLinksViewerController do
|
|
69
69
|
end
|
70
70
|
end
|
71
71
|
end
|
72
|
-
|
73
72
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe TinymceAssetsController, :
|
4
|
-
let(:file) { fixture_file_upload('/world.png','image/png') }
|
3
|
+
describe TinymceAssetsController, type: :controller do
|
4
|
+
let(:file) { fixture_file_upload('/world.png', 'image/png') }
|
5
5
|
|
6
6
|
context "when logged in" do
|
7
7
|
let(:user) { FactoryGirl.create(:user) }
|
@@ -10,19 +10,19 @@ describe TinymceAssetsController, :type => :controller do
|
|
10
10
|
context "as a user who can upload" do
|
11
11
|
before { expect(controller).to receive(:authorize!).with(:create, TinymceAsset).and_return(true) }
|
12
12
|
|
13
|
-
it "
|
14
|
-
expect
|
13
|
+
it "uploads the file" do
|
14
|
+
expect do
|
15
15
|
post :create, file: file
|
16
16
|
expect(response).to be_successful
|
17
|
-
|
17
|
+
end.to change { TinymceAsset.count }.by(1)
|
18
18
|
|
19
19
|
json = JSON.parse(response.body)
|
20
|
-
expect(json).to eq(
|
20
|
+
expect(json).to eq("image" => { "url" => "/uploads/tinymce_asset/file/1/world.png" })
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
24
|
context "as a user who can't upload" do
|
25
|
-
it "
|
25
|
+
it "redirects to root path" do
|
26
26
|
post :create, file: file
|
27
27
|
expect(response).to redirect_to root_path
|
28
28
|
end
|
@@ -30,10 +30,9 @@ describe TinymceAssetsController, :type => :controller do
|
|
30
30
|
end
|
31
31
|
|
32
32
|
context "when not logged in" do
|
33
|
-
it "
|
33
|
+
it "redirects to root path" do
|
34
34
|
post :create, file: file
|
35
35
|
expect(response).to redirect_to main_app.new_user_session_path
|
36
|
-
|
37
36
|
end
|
38
37
|
end
|
39
38
|
end
|