sufia 4.0.1 → 4.1.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/History.md +247 -215
- data/README.md +7 -3
- data/SUFIA_VERSION +1 -1
- data/app/assets/javascripts/sufia.js +5 -2
- data/app/assets/javascripts/sufia/proxy_rights.js +68 -0
- data/app/assets/javascripts/sufia/transfers.js +3 -0
- data/app/assets/javascripts/sufia/user_search.js +31 -0
- data/app/assets/stylesheets/jquery-ui.css +17 -17
- data/app/assets/stylesheets/sufia.css.scss +3 -2
- data/app/assets/stylesheets/sufia/_proxy-rights.scss +10 -0
- data/app/controllers/concerns/sufia/contact_form_controller_behavior.rb +22 -23
- data/app/controllers/concerns/sufia/depositors_controller_behavior.rb +41 -0
- data/app/controllers/concerns/sufia/files_controller_behavior.rb +1 -0
- data/app/controllers/concerns/sufia/transfers_controller_behavior.rb +76 -0
- data/app/controllers/concerns/sufia/users_controller_behavior.rb +9 -11
- data/app/controllers/depositors_controller.rb +3 -0
- data/app/controllers/transfers_controller.rb +3 -0
- data/app/helpers/sufia/dashboard_helper_behavior.rb +15 -0
- data/app/helpers/sufia/sufia_helper_behavior.rb +24 -2
- data/app/jobs/content_depositor_change_event_job.rb +50 -0
- data/app/views/dashboard/_index_partials/_contents.html.erb +18 -0
- data/app/views/dashboard/_index_partials/_proxy_rights.html.erb +23 -0
- data/app/views/dashboard/_index_partials/_transfers.html.erb +14 -0
- data/app/views/generic_files/proxy.html.erb +5 -0
- data/app/views/generic_files/upload/_form.html.erb +7 -2
- data/app/views/my/_action_menu.html.erb +3 -1
- data/app/views/records/edit_fields/_default.html.erb +1 -1
- data/app/views/transfers/_received.html.erb +58 -0
- data/app/views/transfers/_sent.html.erb +38 -0
- data/app/views/transfers/index.html.erb +7 -0
- data/app/views/transfers/new.html.erb +23 -0
- data/app/views/users/_proxies.html.erb +8 -0
- data/app/views/users/_user_util_links_extra.html.erb +1 -0
- data/app/views/users/edit.html.erb +6 -1
- data/config/locales/sufia.en.yml +9 -4
- data/config/routes.rb +14 -3
- data/lib/sufia.rb +7 -5
- data/lib/sufia/version.rb +1 -1
- data/spec/controllers/authorities_controller_spec.rb +6 -6
- data/spec/controllers/batch_controller_spec.rb +29 -29
- data/spec/controllers/batch_edits_controller_spec.rb +7 -7
- data/spec/controllers/catalog_controller_spec.rb +9 -9
- data/spec/controllers/collections_controller_spec.rb +28 -28
- data/spec/controllers/content_blocks_controller_spec.rb +3 -3
- data/spec/controllers/dashboard_controller_spec.rb +1 -1
- data/spec/controllers/depositors_controller_spec.rb +50 -0
- data/spec/controllers/downloads_controller_spec.rb +22 -22
- data/spec/controllers/featured_work_lists_controller_spec.rb +1 -1
- data/spec/controllers/featured_works_controller_spec.rb +1 -1
- data/spec/controllers/generic_files_controller_spec.rb +98 -90
- data/spec/controllers/homepage_controller_spec.rb +1 -1
- data/spec/controllers/mailbox_controller_spec.rb +10 -10
- data/spec/controllers/my/collections_controller_spec.rb +1 -1
- data/spec/controllers/my/files_controller_spec.rb +1 -1
- data/spec/controllers/my/highlights_controller_spec.rb +1 -1
- data/spec/controllers/my/shares_controller_spec.rb +1 -1
- data/spec/controllers/my_controller_spec.rb +1 -1
- data/spec/controllers/pages_controller_spec.rb +1 -1
- data/spec/controllers/single_use_links_controller_spec.rb +46 -50
- data/spec/controllers/single_use_links_viewer_controller_spec.rb +16 -16
- data/spec/controllers/static_controller_spec.rb +9 -9
- data/spec/controllers/tinymce_assets_controller_spec.rb +1 -1
- data/spec/controllers/transfers_controller_spec.rb +212 -0
- data/spec/controllers/users_controller_spec.rb +1 -1
- data/spec/factories/generic_files.rb +4 -4
- data/spec/factories/proxy_deposit_requests.rb +6 -0
- data/spec/features/browse_dashboard_files_spec.rb +25 -36
- data/spec/features/browse_files_spec.rb +18 -13
- data/spec/features/catalog_search_spec.rb +3 -6
- data/spec/features/cloud_upload_spec.rb +5 -7
- data/spec/features/collection_spec.rb +28 -35
- data/spec/features/contact_form_spec.rb +24 -24
- data/spec/features/display_dashboard_spec.rb +11 -11
- data/spec/features/ingest_upload_files_spec.rb +10 -10
- data/spec/features/notifications_spec.rb +11 -11
- data/spec/features/ownership_transfer_spec.rb +111 -0
- data/spec/features/proxy_spec.rb +52 -0
- data/spec/features/search_spec.rb +1 -1
- data/spec/features/single_use_links_spec.rb +28 -18
- data/spec/features/users_spec.rb +3 -3
- data/spec/helpers/batch_edits_helper_spec.rb +1 -1
- data/spec/helpers/content_block_helper_spec.rb +1 -1
- data/spec/helpers/dashboard_helper_spec.rb +1 -1
- data/spec/helpers/generic_file_helper_spec.rb +1 -1
- data/spec/helpers/records_helper_spec.rb +1 -1
- data/spec/helpers/sufia_helper_spec.rb +8 -8
- data/spec/helpers/trophy_helper_spec.rb +1 -1
- data/spec/jobs/audit_job_spec.rb +5 -5
- data/spec/jobs/batch_update_job_spec.rb +14 -14
- data/spec/jobs/content_depositor_change_event_job_spec.rb +22 -0
- data/spec/jobs/event_jobs_spec.rb +104 -104
- data/spec/jobs/import_url_job_spec.rb +2 -2
- data/spec/jobs/ingest_local_file_job_spec.rb +1 -1
- data/spec/lib/sufia/breadcrumbs_spec.rb +3 -3
- data/spec/lib/sufia/id_service_spec.rb +1 -1
- data/spec/lib/sufia/upload_complete_behavior_spec.rb +4 -4
- data/spec/models/ability_spec.rb +59 -15
- data/spec/models/batch_spec.rb +16 -16
- data/spec/models/characterization_spec.rb +1 -1
- data/spec/models/checksum_audit_log_spec.rb +34 -26
- data/spec/models/collection_spec.rb +1 -1
- data/spec/models/download_spec.rb +1 -1
- data/spec/models/featured_work_list_spec.rb +1 -1
- data/spec/models/featured_work_spec.rb +15 -4
- data/spec/models/file_content_datastream_spec.rb +14 -14
- data/spec/models/file_usage_spec.rb +1 -1
- data/spec/models/fits_datastream_spec.rb +1 -1
- data/spec/models/generic_file/reload_on_save_spec.rb +4 -4
- data/spec/models/generic_file/visibility_spec.rb +1 -1
- data/spec/models/generic_file/web_form_spec.rb +6 -5
- data/spec/models/generic_file_rdf_datastream_spec.rb +1 -1
- data/spec/models/generic_file_spec.rb +254 -220
- data/spec/models/geo_names_resource_spec.rb +2 -2
- data/spec/models/local_authority_spec.rb +60 -59
- data/spec/models/pageview_spec.rb +1 -1
- data/spec/models/properties_datastream_spec.rb +29 -10
- data/spec/models/proxy_deposit_request_spec.rb +107 -0
- data/spec/models/single_use_link_spec.rb +13 -13
- data/spec/models/solr_document_spec.rb +1 -1
- data/spec/models/trophy_spec.rb +6 -6
- data/spec/models/user_spec.rb +38 -22
- data/spec/routing/featured_works_route_spec.rb +1 -1
- data/spec/routing/ownership_transfers_route_spec.rb +45 -0
- data/spec/routing/route_spec.rb +42 -42
- data/spec/services/noid_spec.rb +2 -2
- data/spec/spec_helper.rb +10 -5
- data/spec/support/cleaner.rb +12 -0
- data/spec/support/features.rb +5 -0
- data/spec/support/features/session_helpers.rb +3 -17
- data/spec/support/locations.rb +36 -0
- data/spec/support/poltergeist.rb +11 -0
- data/spec/support/proxies.rb +14 -0
- data/spec/support/selectors.rb +122 -0
- data/spec/views/batch/edit.html.erb_spec.rb +1 -1
- data/spec/views/batch_edits/check_all_spec.rb +4 -4
- data/spec/views/catalog/index.html.erb_spec.rb +1 -1
- data/spec/views/catalog/sort_and_per_page.html.erb_spec.rb +1 -1
- data/spec/views/collections/_form.html.erb_spec.rb +3 -1
- data/spec/views/collections/_show_descriptions.html.erb_spec.rb +1 -1
- data/spec/views/dashboard/index_spec.rb +3 -6
- data/spec/views/generic_file/edit.html.erb_spec.rb +1 -1
- data/spec/views/generic_file/show.html.erb_spec.rb +1 -1
- data/spec/views/generic_file/stats.html.erb_spec.rb +1 -1
- data/spec/views/my/facet.html.erb_spec.rb +2 -2
- data/spec/views/users/_follower_modal.html.erb_spec.rb +1 -1
- data/spec/views/users/_following_modal.html.erb_spec.rb +1 -1
- data/spec/views/users/_notify_number.html.erb_spec.rb +1 -1
- data/spec/views/users/_user_util_links.html.erb_spec.rb +1 -1
- data/spec/views/users/index.html.erb_spec.rb +2 -2
- data/spec/views/users/show.html.erb_spec.rb +2 -2
- data/sufia-models/app/models/concerns/sufia/ability.rb +22 -0
- data/sufia-models/app/models/concerns/sufia/generic_file.rb +1 -0
- data/sufia-models/app/models/concerns/sufia/generic_file/proxy_deposit.rb +22 -0
- data/sufia-models/app/models/concerns/sufia/properties_datastream_behavior.rb +3 -0
- data/sufia-models/app/models/concerns/sufia/user.rb +9 -0
- data/sufia-models/app/models/proxy_deposit_request.rb +85 -0
- data/sufia-models/app/models/proxy_deposit_rights.rb +4 -0
- data/sufia-models/app/models/sufia/avatar_uploader.rb +2 -3
- data/sufia-models/lib/generators/sufia/models/install_generator.rb +9 -1
- data/sufia-models/lib/generators/sufia/models/proxies_generator.rb +53 -0
- data/sufia-models/lib/generators/sufia/models/templates/migrations/create_proxy_deposit_requests.rb +16 -0
- data/sufia-models/lib/generators/sufia/models/templates/migrations/create_proxy_deposit_rights.rb +11 -0
- data/sufia-models/lib/sufia/models/engine.rb +1 -1
- data/sufia-models/lib/sufia/models/version.rb +1 -1
- data/sufia.gemspec +2 -1
- data/tasks/sufia-dev.rake +5 -0
- metadata +82 -6
- data/tasks/sufia-db.rake +0 -21
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
|
-
describe "The Dashboard" do
|
|
3
|
+
describe "The Dashboard", :type => :feature do
|
|
4
4
|
|
|
5
5
|
before do
|
|
6
6
|
sign_in :user_with_fixtures
|
|
@@ -9,28 +9,28 @@ describe "The Dashboard" do
|
|
|
9
9
|
context "upon sign-in" do
|
|
10
10
|
|
|
11
11
|
it "should show the user's information" do
|
|
12
|
-
page.
|
|
13
|
-
page.
|
|
14
|
-
page.
|
|
15
|
-
page.
|
|
12
|
+
expect(page).to have_content "My Dashboard"
|
|
13
|
+
expect(page).to have_content "User Activity"
|
|
14
|
+
expect(page).to have_content "User Notifications"
|
|
15
|
+
expect(page).to have_content "Your Statistics"
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
it "should let the user upload files" do
|
|
19
19
|
click_link "Upload"
|
|
20
|
-
page.
|
|
20
|
+
expect(page).to have_content "Upload"
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
it "should let the user create collections" do
|
|
24
24
|
click_link "Create Collection"
|
|
25
|
-
page.
|
|
25
|
+
expect(page).to have_content "Create New Collection"
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
it "should let the user view files" do
|
|
29
29
|
click_link "View Files"
|
|
30
|
-
page.
|
|
31
|
-
page.
|
|
32
|
-
page.
|
|
33
|
-
page.
|
|
30
|
+
expect(page).to have_content "My Files"
|
|
31
|
+
expect(page).to have_content "My Collections"
|
|
32
|
+
expect(page).to have_content "My Highlights"
|
|
33
|
+
expect(page).to have_content "Files Shared with Me"
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
end
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
|
-
describe "Uploading files via web form" do
|
|
4
|
-
|
|
3
|
+
describe "Uploading files via web form", :type => :feature do
|
|
5
4
|
before do
|
|
6
5
|
sign_in :user
|
|
6
|
+
click_link "Upload"
|
|
7
7
|
end
|
|
8
8
|
|
|
9
9
|
it "should have an ingest screen" do
|
|
10
|
-
|
|
11
|
-
page.
|
|
12
|
-
page.
|
|
13
|
-
page.
|
|
14
|
-
page.should have_xpath '//input[@type="file"]'
|
|
10
|
+
expect(page).to have_content "Select files"
|
|
11
|
+
expect(page).to have_content "Start upload"
|
|
12
|
+
expect(page).to have_content "Cancel upload"
|
|
13
|
+
expect(page).to have_xpath '//input[@type="file"]'
|
|
15
14
|
end
|
|
16
15
|
|
|
17
16
|
it "should require checking the terms of service" do
|
|
18
|
-
click_link "upload"
|
|
19
17
|
attach_file("files[]", File.dirname(__FILE__)+"/../../spec/fixtures/image.jp2")
|
|
20
18
|
attach_file("files[]", File.dirname(__FILE__)+"/../../spec/fixtures/jp2_fits.xml")
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
expect(page).to have_css("button#main_upload_start[disabled]")
|
|
20
|
+
find('#main_upload_start_span').hover do
|
|
21
|
+
expect(page).to have_content "Please accept Deposit Agreement before you can upload."
|
|
22
|
+
end
|
|
23
23
|
end
|
|
24
24
|
end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
|
-
describe "Notifications page" do
|
|
3
|
+
describe "Notifications page", :type => :feature do
|
|
4
4
|
|
|
5
5
|
before do
|
|
6
6
|
sign_in FactoryGirl.create(:user_with_mail)
|
|
@@ -8,16 +8,16 @@ describe "Notifications page" do
|
|
|
8
8
|
end
|
|
9
9
|
|
|
10
10
|
it "should list notifications with date, subject and message" do
|
|
11
|
-
page.
|
|
12
|
-
page.find(:xpath, '//thead/tr').
|
|
13
|
-
page.find(:xpath, '//thead/tr').
|
|
14
|
-
page.find(:xpath, '//thead/tr').
|
|
15
|
-
page.
|
|
16
|
-
page.
|
|
17
|
-
page.
|
|
18
|
-
page.
|
|
19
|
-
page.
|
|
20
|
-
page.
|
|
11
|
+
expect(page).to have_content "User Notifications"
|
|
12
|
+
expect(page.find(:xpath, '//thead/tr')).to have_content "Date"
|
|
13
|
+
expect(page.find(:xpath, '//thead/tr')).to have_content "Subject"
|
|
14
|
+
expect(page.find(:xpath, '//thead/tr')).to have_content "Message"
|
|
15
|
+
expect(page).to have_content "These files could not be updated. You do not have sufficient privileges to edit them. "
|
|
16
|
+
expect(page).to have_content "These files have been saved"
|
|
17
|
+
expect(page).to have_content "File 1 could not be updated. You do not have sufficient privileges to edit it."
|
|
18
|
+
expect(page).to have_content "File 1 has been saved"
|
|
19
|
+
expect(page).to have_content "Batch upload permission denied "
|
|
20
|
+
expect(page).to have_content "Batch upload complete"
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
include Selectors::Header
|
|
4
|
+
include Selectors::Dashboard
|
|
5
|
+
include Selectors::NewTransfers
|
|
6
|
+
include Selectors::Transfers
|
|
7
|
+
|
|
8
|
+
describe 'Transferring file ownership:', :type => :feature do
|
|
9
|
+
let(:original_owner) { FactoryGirl.create(:archivist, display_name: 'Original Owner') }
|
|
10
|
+
let(:new_owner) { FactoryGirl.create(:jill, display_name: 'New Owner') }
|
|
11
|
+
let!(:file) do
|
|
12
|
+
GenericFile.new.tap do |f|
|
|
13
|
+
f.title = ['little_file.txt']
|
|
14
|
+
f.creator = ['little_file.txt_creator']
|
|
15
|
+
f.resource_type = ["stuff" ]
|
|
16
|
+
f.read_groups = ['public']
|
|
17
|
+
f.apply_depositor_metadata(original_owner.user_key)
|
|
18
|
+
f.save!
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
before do
|
|
23
|
+
sign_in original_owner
|
|
24
|
+
go_to_dashboard_files
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
after do
|
|
28
|
+
ActiveFedora::Base.destroy_all
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
describe 'When I request a file transfer:' do
|
|
32
|
+
context 'For a file I do not own' do
|
|
33
|
+
pending 'The transfer option is not available' do
|
|
34
|
+
fail
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
context 'To myself' do
|
|
39
|
+
before { transfer_ownership_of_file file, original_owner }
|
|
40
|
+
it 'Displays an appropriate error message' do
|
|
41
|
+
expect(page).to have_content 'Sending user must specify another user to receive the file'
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
context 'To someone else' do
|
|
46
|
+
before { transfer_ownership_of_file file, new_owner }
|
|
47
|
+
it 'Creates a transfer request' do
|
|
48
|
+
expect(page).to have_content 'Transfer request created'
|
|
49
|
+
end
|
|
50
|
+
context 'If the new owner accepts it' do
|
|
51
|
+
before do
|
|
52
|
+
new_owner.proxy_deposit_requests.last.transfer!
|
|
53
|
+
user_utility_toggle.click
|
|
54
|
+
click_link 'transfer requests'
|
|
55
|
+
end
|
|
56
|
+
specify 'I should see it was accepted' do
|
|
57
|
+
expect(page.find('#outgoing-transfers')).to have_content 'Accepted'
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
context 'If I cancel it' do
|
|
61
|
+
before do
|
|
62
|
+
user_utility_toggle.click
|
|
63
|
+
click_link 'transfer requests'
|
|
64
|
+
first_sent_cancel_button.click
|
|
65
|
+
end
|
|
66
|
+
specify 'I should see it was cancelled' do
|
|
67
|
+
expect(page).to have_content 'Transfer canceled'
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
describe 'When someone requests a file transfer to me' do
|
|
74
|
+
before do
|
|
75
|
+
# As the original_owner, transfer a file to the new_owner
|
|
76
|
+
transfer_ownership_of_file file, new_owner
|
|
77
|
+
# Become the new_owner so we can manage transfers sent to us
|
|
78
|
+
sign_in new_owner
|
|
79
|
+
visit '/dashboard'
|
|
80
|
+
user_utility_toggle.click
|
|
81
|
+
within '#user_utility_links' do
|
|
82
|
+
click_link 'transfer requests'
|
|
83
|
+
end
|
|
84
|
+
expect(page).to have_content 'Transfer of Ownership'
|
|
85
|
+
end
|
|
86
|
+
specify 'I should receive a notification' do
|
|
87
|
+
user_notifications_link.click
|
|
88
|
+
expect(page).to have_content "#{original_owner.name} wants to transfer a file to you"
|
|
89
|
+
end
|
|
90
|
+
specify 'I should be able to accept it' do
|
|
91
|
+
first_received_accept_dropdown.click
|
|
92
|
+
click_link 'Allow depositor to retain edit access'
|
|
93
|
+
expect(page).to have_content 'Transfer complete'
|
|
94
|
+
end
|
|
95
|
+
specify 'I should be able to reject it' do
|
|
96
|
+
first_received_reject_button.click
|
|
97
|
+
expect(page).to have_content 'Transfer rejected'
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
def transfer_ownership_of_file(file, new_owner)
|
|
102
|
+
db_item_actions_toggle(file).click
|
|
103
|
+
click_link 'Transfer Ownership of File'
|
|
104
|
+
expect(page).to have_content "Select a user to transfer #{file.title.first} to, add optional comments and then press transfer."
|
|
105
|
+
new_owner_dropdown.click
|
|
106
|
+
new_owner_search_field.set new_owner.user_key
|
|
107
|
+
new_owner_search_result.click
|
|
108
|
+
fill_in 'proxy_deposit_request[sender_comment]', with: 'File transfer comments'
|
|
109
|
+
submit_button.click
|
|
110
|
+
end
|
|
111
|
+
end
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe 'proxy', :type => :feature do
|
|
4
|
+
let(:user) { FactoryGirl.find_or_create(:archivist) }
|
|
5
|
+
let(:second_user) { FactoryGirl.find_or_create(:jill) }
|
|
6
|
+
|
|
7
|
+
describe 'add proxy in profile' do
|
|
8
|
+
it "creates a proxy" do
|
|
9
|
+
sign_in user
|
|
10
|
+
visit "/"
|
|
11
|
+
go_to_user_profile
|
|
12
|
+
click_link "Edit Your Profile"
|
|
13
|
+
expect(first("td.depositor-name")).to be_nil
|
|
14
|
+
create_proxy_using_partial(second_user)
|
|
15
|
+
expect(page).to have_css('td.depositor-name', text: second_user.user_key)
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
describe 'use a proxy' do
|
|
20
|
+
before do
|
|
21
|
+
ProxyDepositRights.create!(grantor: second_user, grantee: user)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# TODO: Finish this spec
|
|
25
|
+
xit "allows on-behalf-of deposit" do
|
|
26
|
+
sign_in user
|
|
27
|
+
visit '/'
|
|
28
|
+
first('a.dropdown-toggle').click
|
|
29
|
+
click_link('upload')
|
|
30
|
+
within('#fileupload') do
|
|
31
|
+
expect(page).to have_content('I have read')
|
|
32
|
+
check("terms_of_service")
|
|
33
|
+
end
|
|
34
|
+
select(second_user.user_key, from: 'on_behalf_of')
|
|
35
|
+
test_file_path = File.expand_path('../../fixtures/small_file.txt', __FILE__)
|
|
36
|
+
page.execute_script(%Q{$("input[type=file]").first().css("opacity", "1").css("-moz-transform", "none");$("input[type=file]").first().attr('id',"fileselect");})
|
|
37
|
+
attach_file("fileselect", test_file_path)
|
|
38
|
+
redirect_url = find("#redirect-loc", visible: false).text
|
|
39
|
+
click_button('Start upload')
|
|
40
|
+
expect(page).to have_content('Apply Metadata')
|
|
41
|
+
fill_in('generic_file_title', with: 'MY Title for the World')
|
|
42
|
+
fill_in('generic_file_tag', with: 'test')
|
|
43
|
+
fill_in('generic_file_creator', with: 'me')
|
|
44
|
+
click_button('upload_submit')
|
|
45
|
+
click_link('Files Shared with Me')
|
|
46
|
+
expect(page).to have_content "MY Title for the World"
|
|
47
|
+
first('i.glyphicon-chevron-right').click
|
|
48
|
+
# TODO: need to remove all files prior to this test. Fedora it stil retaining leftovers
|
|
49
|
+
first('.expanded-details').click_link(second_user.email)
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
@@ -1,37 +1,47 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
|
-
describe "Create and use single-use links" do
|
|
3
|
+
describe "Create and use single-use links", :type => :feature do
|
|
4
4
|
include Warden::Test::Helpers
|
|
5
5
|
Warden.test_mode!
|
|
6
6
|
include Sufia::Engine.routes.url_helpers
|
|
7
7
|
|
|
8
|
+
let(:user) { FactoryGirl.find_or_create(:jill) }
|
|
9
|
+
let(:file) do
|
|
10
|
+
GenericFile.new.tap do |f|
|
|
11
|
+
f.add_file(File.open(fixture_path + '/world.png'), 'content', 'world.png')
|
|
12
|
+
f.apply_depositor_metadata(user)
|
|
13
|
+
f.save
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
8
17
|
before do
|
|
9
|
-
user
|
|
10
|
-
|
|
11
|
-
login_as(user)
|
|
12
|
-
|
|
13
|
-
@file = GenericFile.new
|
|
14
|
-
@file.add_file(File.open(fixture_path + '/world.png'), 'content', 'world.png')
|
|
15
|
-
@file.apply_depositor_metadata(user)
|
|
16
|
-
@file.save
|
|
18
|
+
login_as user
|
|
17
19
|
end
|
|
18
20
|
|
|
19
|
-
it "
|
|
20
|
-
visit generate_show_single_use_link_path(id:
|
|
21
|
-
|
|
21
|
+
it "generates a single-use link to show the record" do
|
|
22
|
+
visit generate_show_single_use_link_path(id: file)
|
|
22
23
|
expect(page).to have_css '.single-use-link a'
|
|
23
24
|
find('.single-use-link a').click
|
|
24
25
|
expect(page).to have_content 'world.png'
|
|
25
26
|
expect(page).to have_content "Download (can only be used once)"
|
|
26
27
|
end
|
|
27
28
|
|
|
28
|
-
|
|
29
|
+
describe "download link" do
|
|
30
|
+
before do
|
|
31
|
+
@old_driver = Capybara.current_driver
|
|
32
|
+
Capybara.current_driver = :rack_test
|
|
33
|
+
end
|
|
29
34
|
|
|
30
|
-
|
|
35
|
+
after do
|
|
36
|
+
Capybara.current_driver = @old_driver
|
|
37
|
+
end
|
|
31
38
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
39
|
+
it "downloads the file contents" do
|
|
40
|
+
visit generate_download_single_use_link_path(id: file)
|
|
41
|
+
expect(page).to have_css '.download-link'
|
|
42
|
+
find('.download-link').click
|
|
43
|
+
expected_content = ActiveFedora::Base.find(file.pid, cast: true).content.content
|
|
44
|
+
expect(page.source).to eq expected_content
|
|
45
|
+
end
|
|
36
46
|
end
|
|
37
47
|
end
|
data/spec/features/users_spec.rb
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
describe "User Profile" do
|
|
3
|
+
describe "User Profile", :type => :feature do
|
|
5
4
|
|
|
6
5
|
before do
|
|
7
6
|
sign_in FactoryGirl.create(:curator)
|
|
@@ -30,7 +29,8 @@ describe "User Profile" do
|
|
|
30
29
|
fill_in 'user_twitter_handle', with: 'curatorOfData'
|
|
31
30
|
click_button 'Save Profile'
|
|
32
31
|
expect(page).to have_content 'Your profile has been updated'
|
|
33
|
-
|
|
32
|
+
click_link 'Profile'
|
|
33
|
+
expect(page).to have_content 'http://twitter.com/curatorOfData'
|
|
34
34
|
end
|
|
35
35
|
end
|
|
36
36
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
|
-
describe RecordsHelper do
|
|
3
|
+
describe RecordsHelper, :type => :helper do
|
|
4
4
|
let(:adder) {
|
|
5
5
|
"<button class=\"adder btn\" id=\"additional_test_submit\" name=\"additional_test\"><span aria-hidden=\"true\"><i class=\"glyphicon glyphicon-plus\"></i></span><span class=\"sr-only\">add another test</span></button>"
|
|
6
6
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
|
-
describe SufiaHelper do
|
|
3
|
+
describe SufiaHelper, :type => :helper do
|
|
4
4
|
|
|
5
5
|
describe "#link_to_facet_list" do
|
|
6
6
|
before do
|
|
@@ -31,12 +31,12 @@ describe SufiaHelper do
|
|
|
31
31
|
subject { helper }
|
|
32
32
|
context "when cq is set" do
|
|
33
33
|
before { allow(helper).to receive(:params).and_return({ cq: 'foo'}) }
|
|
34
|
-
it {
|
|
34
|
+
it { is_expected.to have_collection_search_parameters }
|
|
35
35
|
end
|
|
36
36
|
|
|
37
37
|
context "when cq is not set" do
|
|
38
38
|
before { allow(helper).to receive(:params).and_return({ cq: ''}) }
|
|
39
|
-
it {
|
|
39
|
+
it { is_expected.not_to have_collection_search_parameters }
|
|
40
40
|
end
|
|
41
41
|
end
|
|
42
42
|
|
|
@@ -45,23 +45,23 @@ describe SufiaHelper do
|
|
|
45
45
|
let(:document) { SolrDocument.new( mime_type_tesim: 'image/jpeg', noid_tsi: '1234') }
|
|
46
46
|
it "should show the audio thumbnail" do
|
|
47
47
|
rendered = helper.sufia_thumbnail_tag(document, { width: 90 })
|
|
48
|
-
rendered.
|
|
49
|
-
rendered.
|
|
48
|
+
expect(rendered).to match /src="\/downloads\/1234\?datastream_id=thumbnail"/
|
|
49
|
+
expect(rendered).to match /width="90"/
|
|
50
50
|
end
|
|
51
51
|
end
|
|
52
52
|
context "for an audio object" do
|
|
53
53
|
let(:document) { SolrDocument.new( mime_type_tesim: 'audio/x-wave') }
|
|
54
54
|
it "should show the audio thumbnail" do
|
|
55
55
|
rendered = helper.sufia_thumbnail_tag(document, {})
|
|
56
|
-
rendered.
|
|
56
|
+
expect(rendered).to match /src="\/assets\/audio.png"/
|
|
57
57
|
end
|
|
58
58
|
end
|
|
59
59
|
context "for an document object" do
|
|
60
60
|
let(:document) { SolrDocument.new( mime_type_tesim: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', noid_tsi: '1234') }
|
|
61
61
|
it "should show the default thumbnail" do
|
|
62
62
|
rendered = helper.sufia_thumbnail_tag(document, { width: 90 })
|
|
63
|
-
rendered.
|
|
64
|
-
rendered.
|
|
63
|
+
expect(rendered).to match /src="\/downloads\/1234\?datastream_id=thumbnail"/
|
|
64
|
+
expect(rendered).to match /width="90"/
|
|
65
65
|
end
|
|
66
66
|
end
|
|
67
67
|
end
|