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
data/spec/models/user_spec.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
|
-
describe User do
|
|
3
|
+
describe User, :type => :model do
|
|
4
4
|
before(:all) do
|
|
5
5
|
@user = FactoryGirl.find_or_create(:jill)
|
|
6
6
|
@another_user = FactoryGirl.find_or_create(:archivist)
|
|
@@ -10,31 +10,31 @@ describe User do
|
|
|
10
10
|
@another_user.delete
|
|
11
11
|
end
|
|
12
12
|
it "should have an email" do
|
|
13
|
-
@user.user_key.
|
|
13
|
+
expect(@user.user_key).to eq("jilluser@example.com")
|
|
14
14
|
end
|
|
15
15
|
it "should have activity stream-related methods defined" do
|
|
16
|
-
@user.
|
|
17
|
-
@user.
|
|
18
|
-
@user.
|
|
19
|
-
@user.
|
|
20
|
-
@user.
|
|
21
|
-
@user.
|
|
16
|
+
expect(@user).to respond_to(:stream)
|
|
17
|
+
expect(@user).to respond_to(:events)
|
|
18
|
+
expect(@user).to respond_to(:profile_events)
|
|
19
|
+
expect(@user).to respond_to(:create_event)
|
|
20
|
+
expect(@user).to respond_to(:log_event)
|
|
21
|
+
expect(@user).to respond_to(:log_profile_event)
|
|
22
22
|
end
|
|
23
23
|
it "should have social attributes" do
|
|
24
|
-
@user.
|
|
25
|
-
@user.
|
|
26
|
-
@user.
|
|
27
|
-
@user.
|
|
24
|
+
expect(@user).to respond_to(:twitter_handle)
|
|
25
|
+
expect(@user).to respond_to(:facebook_handle)
|
|
26
|
+
expect(@user).to respond_to(:googleplus_handle)
|
|
27
|
+
expect(@user).to respond_to(:linkedin_handle)
|
|
28
28
|
end
|
|
29
29
|
it "should redefine to_param to make redis keys more recognizable (and useable within Rails URLs)" do
|
|
30
|
-
@user.to_param.
|
|
30
|
+
expect(@user.to_param).to eq("jilluser@example-dot-com")
|
|
31
31
|
end
|
|
32
32
|
it "should have a cancan ability defined" do
|
|
33
|
-
@user.
|
|
33
|
+
expect(@user).to respond_to(:can?)
|
|
34
34
|
end
|
|
35
35
|
it "should not have any followers" do
|
|
36
|
-
@user.followers_count.
|
|
37
|
-
@another_user.follow_count.
|
|
36
|
+
expect(@user.followers_count).to eq(0)
|
|
37
|
+
expect(@another_user.follow_count).to eq(0)
|
|
38
38
|
end
|
|
39
39
|
describe "follow/unfollow" do
|
|
40
40
|
before(:all) do
|
|
@@ -60,10 +60,10 @@ describe User do
|
|
|
60
60
|
end
|
|
61
61
|
|
|
62
62
|
describe "trophy_files" do
|
|
63
|
-
let(:user) { @user }
|
|
64
|
-
let(:file1) { GenericFile.new.tap { |f| f.apply_depositor_metadata(user); f.save! } }
|
|
65
|
-
let(:file2) { GenericFile.new.tap { |f| f.apply_depositor_metadata(user); f.save! } }
|
|
66
|
-
let(:file3) { GenericFile.new.tap { |f| f.apply_depositor_metadata(user); f.save! } }
|
|
63
|
+
let(:user) { @user }
|
|
64
|
+
let(:file1) { GenericFile.new.tap { |f| f.apply_depositor_metadata(user); f.save! } }
|
|
65
|
+
let(:file2) { GenericFile.new.tap { |f| f.apply_depositor_metadata(user); f.save! } }
|
|
66
|
+
let(:file3) { GenericFile.new.tap { |f| f.apply_depositor_metadata(user); f.save! } }
|
|
67
67
|
let!(:trophy1) { user.trophies.create!(generic_file_id: file1.noid) }
|
|
68
68
|
let!(:trophy2) { user.trophies.create!(generic_file_id: file2.noid) }
|
|
69
69
|
let!(:trophy3) { user.trophies.create!(generic_file_id: file3.noid) }
|
|
@@ -97,7 +97,23 @@ describe User do
|
|
|
97
97
|
it "gathers the user's recent activity within a given timestamp" do
|
|
98
98
|
expect(user.get_all_user_activity(now-60)).to eq(file_activities.concat([activities.first]))
|
|
99
99
|
end
|
|
100
|
-
|
|
101
100
|
end
|
|
102
|
-
|
|
101
|
+
describe "proxy_deposit_rights" do
|
|
102
|
+
before do
|
|
103
|
+
@subject = FactoryGirl.create :curator
|
|
104
|
+
@user1 = FactoryGirl.create :jill
|
|
105
|
+
@user2 = FactoryGirl.create :archivist
|
|
106
|
+
@subject.can_receive_deposits_from << @user1
|
|
107
|
+
@subject.can_make_deposits_for << @user2
|
|
108
|
+
@subject.save!
|
|
109
|
+
end
|
|
110
|
+
it "can_receive_deposits_from" do
|
|
111
|
+
expect(@subject.can_receive_deposits_from.to_a).to eq [@user1]
|
|
112
|
+
expect(@user1.can_make_deposits_for.to_a).to eq [@subject]
|
|
113
|
+
end
|
|
114
|
+
it "can_make_deposits_for" do
|
|
115
|
+
expect(@subject.can_make_deposits_for.to_a).to eq [@user2]
|
|
116
|
+
expect(@user2.can_receive_deposits_from.to_a).to eq [@subject]
|
|
117
|
+
end
|
|
118
|
+
end
|
|
103
119
|
end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
|
-
describe "file routes" do
|
|
3
|
+
describe "file routes", :type => :routing do
|
|
4
4
|
routes { Sufia::Engine.routes }
|
|
5
5
|
it 'should create a featured_work' do
|
|
6
6
|
expect(post: '/files/1/featured_work').to route_to(controller: 'featured_works', action: 'create', id: '1')
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe "proxy deposit and transfers routing", :type => :routing do
|
|
4
|
+
routes { Sufia::Engine.routes }
|
|
5
|
+
|
|
6
|
+
it "lists transfers" do
|
|
7
|
+
expect(transfers_path).to eq '/dashboard/transfers'
|
|
8
|
+
expect(get: '/dashboard/transfers').to route_to(controller: 'transfers', action: 'index')
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
it "creates a transfer" do
|
|
12
|
+
expect(generic_file_transfers_path('7')).to eq '/files/7/transfers'
|
|
13
|
+
expect(post: '/files/7/transfers').to route_to(controller: 'transfers', action: 'create', id: '7')
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
it "shows a form for a new transfer" do
|
|
17
|
+
expect(new_generic_file_transfer_path('7')).to eq '/files/7/transfers/new'
|
|
18
|
+
expect(get: '/files/7/transfers/new').to route_to(controller: 'transfers', action: 'new', id: '7')
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
it "cancels a transfer" do
|
|
22
|
+
expect(transfer_path('7')).to eq '/dashboard/transfers/7'
|
|
23
|
+
expect(delete: '/dashboard/transfers/7').to route_to(controller: 'transfers', action: 'destroy', id: '7')
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
it "accepts a transfers" do
|
|
27
|
+
expect(accept_transfer_path('7')).to eq '/dashboard/transfers/7/accept'
|
|
28
|
+
expect(put: '/dashboard/transfers/7/accept').to route_to(controller: 'transfers', action: 'accept', id: '7')
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
it "rejects a transfer" do
|
|
32
|
+
expect(reject_transfer_path('7')).to eq '/dashboard/transfers/7/reject'
|
|
33
|
+
expect(put: '/dashboard/transfers/7/reject').to route_to(controller: 'transfers', action: 'reject', id: '7')
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
it "adds a proxy depositor" do
|
|
37
|
+
expect(user_depositors_path('xxx666@example-dot-org')).to eq '/users/xxx666@example-dot-org/depositors'
|
|
38
|
+
expect(post: '/users/xxx666@example-dot-org/depositors').to route_to(controller: 'depositors', action: 'create', user_id: 'xxx666@example-dot-org')
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
it "removes a proxy depositor" do
|
|
42
|
+
expect(user_depositor_path('xxx666', '33')).to eq '/users/xxx666/depositors/33'
|
|
43
|
+
expect(delete: '/users/xxx666/depositors/33').to route_to(controller: 'depositors', action: 'destroy', user_id: 'xxx666', id: '33')
|
|
44
|
+
end
|
|
45
|
+
end
|
data/spec/routing/route_spec.rb
CHANGED
|
@@ -1,146 +1,146 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
|
-
describe 'Routes' do
|
|
3
|
+
describe 'Routes', :type => :routing do
|
|
4
4
|
routes { Sufia::Engine.routes }
|
|
5
5
|
|
|
6
6
|
describe 'Homepage' do
|
|
7
7
|
it 'should route the root url to the homepage controller' do
|
|
8
|
-
{ get: '/' }.
|
|
8
|
+
expect({ get: '/' }).to route_to(controller: 'homepage', action: 'index')
|
|
9
9
|
end
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
describe 'GenericFile' do
|
|
13
13
|
it 'should route to citation' do
|
|
14
|
-
{ get: '/files/1/citation' }.
|
|
14
|
+
expect({ get: '/files/1/citation' }).to route_to(controller: 'generic_files', action: 'citation', id: '1')
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
it 'should route to stats' do
|
|
18
|
-
{ get: '/files/1/stats' }.
|
|
18
|
+
expect({ get: '/files/1/stats' }).to route_to(controller: 'generic_files', action: 'stats', id: '1')
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
it 'should route to audit' do
|
|
22
|
-
{ post: '/files/7/audit' }.
|
|
22
|
+
expect({ post: '/files/7/audit' }).to route_to(controller: 'generic_files', action: 'audit', id: '7')
|
|
23
23
|
end
|
|
24
24
|
|
|
25
25
|
it 'should route to create' do
|
|
26
|
-
{ post: '/files' }.
|
|
26
|
+
expect({ post: '/files' }).to route_to(controller: 'generic_files', action: 'create')
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
it 'should route to new' do
|
|
30
|
-
{ get: '/files/new' }.
|
|
30
|
+
expect({ get: '/files/new' }).to route_to(controller: 'generic_files', action: 'new')
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
it 'should route to edit' do
|
|
34
|
-
{ get: '/files/3/edit' }.
|
|
34
|
+
expect({ get: '/files/3/edit' }).to route_to(controller: 'generic_files', action: 'edit', id: '3')
|
|
35
35
|
end
|
|
36
36
|
|
|
37
37
|
it "should route to show" do
|
|
38
|
-
{ get: '/files/4' }.
|
|
38
|
+
expect({ get: '/files/4' }).to route_to(controller: 'generic_files', action: 'show', id: '4')
|
|
39
39
|
end
|
|
40
40
|
|
|
41
41
|
it "should route to update" do
|
|
42
|
-
{ put: '/files/5' }.
|
|
42
|
+
expect({ put: '/files/5' }).to route_to(controller: 'generic_files', action: 'update', id: '5')
|
|
43
43
|
end
|
|
44
44
|
|
|
45
45
|
it "should route to destroy" do
|
|
46
|
-
{ delete: '/files/6' }.
|
|
46
|
+
expect({ delete: '/files/6' }).to route_to(controller: 'generic_files', action: 'destroy', id: '6')
|
|
47
47
|
end
|
|
48
48
|
|
|
49
49
|
it "should *not* route to index" do
|
|
50
|
-
{ get: '/files' }.
|
|
50
|
+
expect({ get: '/files' }).not_to route_to(controller: 'generic_files', action: 'index')
|
|
51
51
|
end
|
|
52
52
|
end
|
|
53
53
|
|
|
54
54
|
describe 'Batch' do
|
|
55
55
|
it "should route to edit" do
|
|
56
|
-
{ get: '/batches/1/edit' }.
|
|
56
|
+
expect({ get: '/batches/1/edit' }).to route_to(controller: 'batch', action: 'edit', id: '1')
|
|
57
57
|
end
|
|
58
58
|
|
|
59
59
|
it "should route to update" do
|
|
60
|
-
{ post: '/batches/2' }.
|
|
60
|
+
expect({ post: '/batches/2' }).to route_to(controller: 'batch', action: 'update', id: '2')
|
|
61
61
|
end
|
|
62
62
|
end
|
|
63
63
|
|
|
64
64
|
describe 'Download' do
|
|
65
65
|
it "should route to show" do
|
|
66
|
-
{ get: '/downloads/9' }.
|
|
66
|
+
expect({ get: '/downloads/9' }).to route_to(controller: 'downloads', action: 'show', id: '9')
|
|
67
67
|
end
|
|
68
68
|
end
|
|
69
69
|
|
|
70
70
|
describe 'Dashboard' do
|
|
71
71
|
it "should route to dashboard" do
|
|
72
|
-
{ get: '/dashboard' }.
|
|
72
|
+
expect({ get: '/dashboard' }).to route_to(controller: 'dashboard', action: 'index')
|
|
73
73
|
end
|
|
74
74
|
|
|
75
75
|
it "should route to dashboard activity" do
|
|
76
|
-
{ get: '/dashboard/activity' }.
|
|
76
|
+
expect({ get: '/dashboard/activity' }).to route_to(controller: 'dashboard', action: 'activity')
|
|
77
77
|
end
|
|
78
78
|
|
|
79
79
|
it "should route to my files tab" do
|
|
80
|
-
{ get: '/dashboard/files' }.
|
|
80
|
+
expect({ get: '/dashboard/files' }).to route_to(controller: 'my/files', action: 'index')
|
|
81
81
|
end
|
|
82
82
|
|
|
83
83
|
it "should route to my collections tab" do
|
|
84
|
-
{ get: '/dashboard/collections' }.
|
|
84
|
+
expect({ get: '/dashboard/collections' }).to route_to(controller: 'my/collections', action: 'index')
|
|
85
85
|
end
|
|
86
86
|
|
|
87
87
|
it "should route to my highlighted tab" do
|
|
88
|
-
{ get: '/dashboard/highlights' }.
|
|
88
|
+
expect({ get: '/dashboard/highlights' }).to route_to(controller: 'my/highlights', action: 'index')
|
|
89
89
|
end
|
|
90
90
|
|
|
91
91
|
it "should route to my shared tab" do
|
|
92
|
-
{ get: '/dashboard/shares' }.
|
|
92
|
+
expect({ get: '/dashboard/shares' }).to route_to(controller: 'my/shares', action: 'index')
|
|
93
93
|
end
|
|
94
94
|
end
|
|
95
95
|
|
|
96
96
|
describe 'Advanced Search' do
|
|
97
97
|
it "should route to search" do
|
|
98
|
-
{ get: '/search' }.
|
|
98
|
+
expect({ get: '/search' }).to route_to(controller: 'advanced', action: 'index')
|
|
99
99
|
end
|
|
100
100
|
end
|
|
101
101
|
|
|
102
102
|
describe 'Authorities' do
|
|
103
103
|
it "should route to query" do
|
|
104
|
-
{ get: '/authorities/subject/bio' }.
|
|
104
|
+
expect({ get: '/authorities/subject/bio' }).to route_to(controller: 'authorities', action: 'query', model: 'subject', term: 'bio')
|
|
105
105
|
end
|
|
106
106
|
end
|
|
107
107
|
|
|
108
108
|
describe 'Users' do
|
|
109
109
|
it 'should route to user trophies' do
|
|
110
|
-
{ post: '/users/bob135/trophy' }.
|
|
110
|
+
expect({ post: '/users/bob135/trophy' }).to route_to(controller: 'users', action: 'toggle_trophy', id: 'bob135')
|
|
111
111
|
end
|
|
112
112
|
it 'should route to user profile' do
|
|
113
|
-
{ get: '/users/bob135' }.
|
|
113
|
+
expect({ get: '/users/bob135' }).to route_to(controller: 'users', action: 'show', id: 'bob135')
|
|
114
114
|
end
|
|
115
115
|
|
|
116
116
|
it "should route to edit profile" do
|
|
117
|
-
{ get: '/users/bob135/edit' }.
|
|
117
|
+
expect({ get: '/users/bob135/edit' }).to route_to(controller: 'users', action: 'edit', id: 'bob135')
|
|
118
118
|
end
|
|
119
119
|
|
|
120
120
|
it "should route to update profile" do
|
|
121
|
-
{ put: '/users/bob135' }.
|
|
121
|
+
expect({ put: '/users/bob135' }).to route_to(controller: 'users', action: 'update', id: 'bob135')
|
|
122
122
|
end
|
|
123
123
|
|
|
124
124
|
it "should route to user follow" do
|
|
125
|
-
{ post: '/users/bob135/follow' }.
|
|
125
|
+
expect({ post: '/users/bob135/follow' }).to route_to(controller: 'users', action: 'follow', id: 'bob135')
|
|
126
126
|
end
|
|
127
127
|
|
|
128
128
|
it "should route to user unfollow" do
|
|
129
|
-
{ post: '/users/bob135/unfollow' }.
|
|
129
|
+
expect({ post: '/users/bob135/unfollow' }).to route_to(controller: 'users', action: 'unfollow', id: 'bob135')
|
|
130
130
|
end
|
|
131
131
|
end
|
|
132
132
|
|
|
133
133
|
describe "Directory" do
|
|
134
134
|
it "should route to user" do
|
|
135
|
-
{ get: '/directory/user/xxx666' }.
|
|
135
|
+
expect({ get: '/directory/user/xxx666' }).to route_to(controller: 'directory', action: 'user', uid: 'xxx666')
|
|
136
136
|
end
|
|
137
137
|
|
|
138
138
|
it "should route to user attribute" do
|
|
139
|
-
{ get: '/directory/user/zzz777/email' }.
|
|
139
|
+
expect({ get: '/directory/user/zzz777/email' }).to route_to(controller: 'directory', action: 'user_attribute', uid: 'zzz777', attribute: 'email')
|
|
140
140
|
end
|
|
141
141
|
|
|
142
142
|
it "should route to group and allow periods" do
|
|
143
|
-
{ get: '/directory/group/all.staff' }.
|
|
143
|
+
expect({ get: '/directory/group/all.staff' }).to route_to(controller: 'directory', action: 'group', cn: 'all.staff')
|
|
144
144
|
end
|
|
145
145
|
end
|
|
146
146
|
|
|
@@ -161,50 +161,50 @@ describe 'Routes' do
|
|
|
161
161
|
|
|
162
162
|
describe "Contact Form" do
|
|
163
163
|
it "should route to new" do
|
|
164
|
-
{ get: '/contact' }.
|
|
164
|
+
expect({ get: '/contact' }).to route_to(controller: 'contact_form', action: 'new')
|
|
165
165
|
end
|
|
166
166
|
|
|
167
167
|
it "should route to create" do
|
|
168
|
-
{ post: '/contact' }.
|
|
168
|
+
expect({ post: '/contact' }).to route_to(controller: 'contact_form', action: 'create')
|
|
169
169
|
end
|
|
170
170
|
end
|
|
171
171
|
|
|
172
172
|
describe "Dynamically edited pages" do
|
|
173
173
|
it "should route to about" do
|
|
174
|
-
{ get: '/about' }.
|
|
174
|
+
expect({ get: '/about' }).to route_to(controller: 'pages', action: 'show', id: 'about_page')
|
|
175
175
|
end
|
|
176
176
|
end
|
|
177
177
|
|
|
178
178
|
describe "Static Pages" do
|
|
179
179
|
it "should route to help" do
|
|
180
|
-
{ get: '/help' }.
|
|
180
|
+
expect({ get: '/help' }).to route_to(controller: 'static', action: 'help')
|
|
181
181
|
end
|
|
182
182
|
|
|
183
183
|
it "should route to terms" do
|
|
184
|
-
{ get: '/terms' }.
|
|
184
|
+
expect({ get: '/terms' }).to route_to(controller: 'static', action: 'terms')
|
|
185
185
|
end
|
|
186
186
|
|
|
187
187
|
it "should route to zotero" do
|
|
188
|
-
{ get: '/zotero' }.
|
|
188
|
+
expect({ get: '/zotero' }).to route_to(controller: 'static', action: 'zotero')
|
|
189
189
|
end
|
|
190
190
|
|
|
191
191
|
it "should route to mendeley" do
|
|
192
|
-
{ get: '/mendeley' }.
|
|
192
|
+
expect({ get: '/mendeley' }).to route_to(controller: 'static', action: 'mendeley')
|
|
193
193
|
end
|
|
194
194
|
|
|
195
195
|
it "should route to versions" do
|
|
196
|
-
{ get: '/versions' }.
|
|
196
|
+
expect({ get: '/versions' }).to route_to(controller: 'static', action: 'versions')
|
|
197
197
|
end
|
|
198
198
|
|
|
199
199
|
it "should *not* route a bogus static page" do
|
|
200
|
-
{ get: '/awesome' }.
|
|
200
|
+
expect({ get: '/awesome' }).not_to route_to(controller: 'static', action: 'awesome')
|
|
201
201
|
end
|
|
202
202
|
end
|
|
203
203
|
|
|
204
204
|
describe "Catch-all" do
|
|
205
205
|
it "should route non-existent routes to errors" do
|
|
206
206
|
pending "The default route is turned off in testing, so that errors are raised"
|
|
207
|
-
{ get: '/awesome' }.
|
|
207
|
+
expect({ get: '/awesome' }).to route_to(controller: 'errors', action: 'routing', error: 'awesome')
|
|
208
208
|
end
|
|
209
209
|
end
|
|
210
210
|
end
|
data/spec/services/noid_spec.rb
CHANGED
|
@@ -6,11 +6,11 @@ describe Sufia::Noid do
|
|
|
6
6
|
|
|
7
7
|
context "when the passed in pid doesn't have a namespace" do
|
|
8
8
|
let(:id) { 'abc123' }
|
|
9
|
-
it {
|
|
9
|
+
it { is_expected.to eq 'sufia:abc123' }
|
|
10
10
|
end
|
|
11
11
|
context "when the passed in pid has a namespace" do
|
|
12
12
|
let(:id) { 'ksl:abc123' }
|
|
13
|
-
it {
|
|
13
|
+
it { is_expected.to eq 'ksl:abc123' }
|
|
14
14
|
end
|
|
15
15
|
end
|
|
16
16
|
end
|
data/spec/spec_helper.rb
CHANGED
|
@@ -6,17 +6,16 @@ EngineCart.load_application!
|
|
|
6
6
|
require 'mida'
|
|
7
7
|
require 'rspec/rails'
|
|
8
8
|
require 'rspec/its'
|
|
9
|
+
require 'rspec/matchers'
|
|
9
10
|
require 'rspec/active_model/mocks'
|
|
10
11
|
require 'factory_girl_rails'
|
|
11
12
|
require 'capybara/poltergeist'
|
|
12
|
-
Capybara.javascript_driver = :poltergeist
|
|
13
|
-
Capybara.default_wait_time = ENV['TRAVIS'] ? 30 : 15
|
|
14
13
|
require 'capybara/rspec'
|
|
15
14
|
require 'capybara/rails'
|
|
15
|
+
require 'equivalent-xml'
|
|
16
16
|
require 'equivalent-xml/rspec_matchers'
|
|
17
17
|
require 'database_cleaner'
|
|
18
|
-
|
|
19
|
-
require File.expand_path('../support/features', __FILE__)
|
|
18
|
+
require 'support/features'
|
|
20
19
|
|
|
21
20
|
if ENV['COVERAGE']
|
|
22
21
|
require 'simplecov'
|
|
@@ -24,6 +23,9 @@ if ENV['COVERAGE']
|
|
|
24
23
|
SimpleCov.command_name "spec"
|
|
25
24
|
end
|
|
26
25
|
|
|
26
|
+
Capybara.javascript_driver = :poltergeist
|
|
27
|
+
Capybara.default_wait_time = ENV['TRAVIS'] ? 30 : 15
|
|
28
|
+
|
|
27
29
|
$in_travis = !ENV['TRAVIS'].nil? && ENV['TRAVIS'] == 'true'
|
|
28
30
|
|
|
29
31
|
if $in_travis
|
|
@@ -71,6 +73,10 @@ module EngineRoutes
|
|
|
71
73
|
end
|
|
72
74
|
|
|
73
75
|
RSpec.configure do |config|
|
|
76
|
+
config.expect_with :rspec do |c|
|
|
77
|
+
c.syntax = :expect
|
|
78
|
+
end
|
|
79
|
+
|
|
74
80
|
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
|
75
81
|
config.fixture_path = File.expand_path("../fixtures", __FILE__)
|
|
76
82
|
|
|
@@ -96,7 +102,6 @@ RSpec.configure do |config|
|
|
|
96
102
|
|
|
97
103
|
config.include Devise::TestHelpers, type: :controller
|
|
98
104
|
config.include EngineRoutes, type: :controller
|
|
99
|
-
config.include EquivalentXml::RSpecMatchers
|
|
100
105
|
|
|
101
106
|
config.include Warden::Test::Helpers, type: :feature
|
|
102
107
|
config.after(:each, type: :feature) { Warden.test_reset! }
|