sufia 0.0.1.pre2 → 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +2 -5
- data/README.md +44 -12
- data/app/assets/javascripts/{scholarsphere.js → sufia.js} +0 -0
- data/app/assets/stylesheets/{scholarsphere.css → sufia.css} +0 -0
- data/app/controllers/batch_controller.rb +2 -3
- data/app/controllers/batch_edits_controller.rb +4 -4
- data/app/controllers/dashboard_controller.rb +5 -3
- data/app/controllers/generic_files_controller.rb +77 -41
- data/app/controllers/users_controller.rb +9 -21
- data/app/helpers/blacklight/render_constraints_helper_behavior.rb +2 -2
- data/app/helpers/sufia_helper.rb +23 -2
- data/app/models/datastreams/file_content_datastream.rb +17 -9
- data/app/models/generic_file.rb +1 -809
- data/app/views/_add_assets_links.html.erb +1 -1
- data/app/views/_user_util_links.html.erb +2 -2
- data/app/views/batch/_metadata.html.erb +16 -16
- data/app/views/batch/edit.html.erb +16 -10
- data/app/views/batch_edits/_metadata.html.erb +16 -16
- data/app/views/catalog/_index_partials/_list_files.html.erb +2 -2
- data/app/views/catalog/index.html.erb +5 -0
- data/app/views/dashboard/_facet_limit.html.erb +1 -1
- data/app/views/dashboard/_facet_pagination.html.erb +4 -4
- data/app/views/dashboard/_facet_selected.html.erb +1 -1
- data/app/views/dashboard/_index_partials/_list_files.html.erb +8 -8
- data/app/views/dashboard/_search_form.html.erb +1 -1
- data/app/views/dashboard/_sort_and_per_page.html.erb +1 -1
- data/app/views/dashboard/index.html.erb +0 -1
- data/app/views/generic_files/_breadcrumbs.html.erb +1 -1
- data/app/views/generic_files/_descriptions.html.erb +3 -3
- data/app/views/generic_files/_field_form +3 -3
- data/app/views/generic_files/_media_display.html.erb +5 -4
- data/app/views/generic_files/_permission.html.erb +5 -5
- data/app/views/generic_files/_versioning.html.erb +1 -1
- data/app/views/generic_files/edit.html.erb +2 -2
- data/app/views/generic_files/show.html.erb +3 -3
- data/app/views/static/versions.html.erb +1 -1
- data/app/views/users/edit.html.erb +5 -3
- data/app/views/users/index.html.erb +3 -3
- data/app/views/users/show.html.erb +6 -6
- data/config/jetty.yml +6 -0
- data/config/routes.rb +8 -4
- data/features/browse_dashboard_files.feature +11 -1
- data/features/browse_files.feature +6 -5
- data/features/contact_form.feature +4 -0
- data/features/display_dashboard.feature +6 -3
- data/features/ingest_upload_files.feature +2 -2
- data/features/step_definitions/fixture_steps.rb +6 -5
- data/features/step_definitions/scholarsphere.rb +24 -1
- data/features/step_definitions/user_steps.rb +2 -2
- data/features/step_definitions/web_steps.rb +1 -1
- data/features/support/env.rb +26 -0
- data/features/users.feature +18 -0
- data/lib/active_support/core_ext/marshal.rb +22 -0
- data/lib/generators/sufia/sufia_generator.rb +18 -2
- data/lib/generators/sufia/templates/catalog_controller.rb +3 -4
- data/{spec/support → lib/generators/sufia/templates}/config/redis.yml +0 -0
- data/lib/generators/sufia/templates/config/sufia.rb +68 -0
- data/lib/generators/sufia/templates/migrations/add_ldap_attrs_to_user.rb +41 -0
- data/lib/kaminari/helpers/tag.rb +11 -0
- data/lib/sufia.rb +30 -7
- data/lib/sufia/controller.rb +1 -5
- data/lib/sufia/generic_file.rb +200 -0
- data/lib/sufia/generic_file/audit.rb +119 -0
- data/lib/sufia/generic_file/characterization.rb +82 -0
- data/lib/sufia/generic_file/export.rb +339 -0
- data/lib/sufia/generic_file/permissions.rb +64 -0
- data/lib/sufia/generic_file/thumbnail.rb +68 -0
- data/{app/models → lib/sufia/jobs}/audit_job.rb +13 -3
- data/lib/sufia/jobs/batch_update_job.rb +86 -0
- data/lib/sufia/jobs/characterize_job.rb +35 -0
- data/{app/models → lib/sufia/jobs}/content_delete_event_job.rb +3 -1
- data/{app/models → lib/sufia/jobs}/content_deposit_event_job.rb +1 -1
- data/{app/models → lib/sufia/jobs}/content_new_version_event_job.rb +1 -1
- data/{app/models → lib/sufia/jobs}/content_restored_version_event_job.rb +8 -0
- data/{app/models → lib/sufia/jobs}/content_update_event_job.rb +1 -1
- data/{app/models → lib/sufia/jobs}/event_job.rb +7 -3
- data/{app/models → lib/sufia/jobs}/resolrize_job.rb +4 -2
- data/lib/sufia/jobs/transcode_video_job.rb +79 -0
- data/{app/models → lib/sufia/jobs}/unzip_job.rb +11 -3
- data/{app/models → lib/sufia/jobs}/user_edit_profile_event_job.rb +6 -0
- data/{app/models → lib/sufia/jobs}/user_follow_event_job.rb +9 -4
- data/{app/models → lib/sufia/jobs}/user_unfollow_event_job.rb +6 -0
- data/lib/sufia/queue/resque.rb +30 -0
- data/lib/sufia/role_mapper.rb +0 -1
- data/{app/models/characterize_job.rb → lib/sufia/solr_document_behavior.rb} +6 -7
- data/lib/sufia/user.rb +3 -3
- data/lib/sufia/version.rb +1 -1
- data/lib/tasks/fixtures.rake +38 -38
- data/lib/tasks/resque.rake +1 -0
- data/solr_conf/conf/solrconfig.xml +32 -1615
- data/solr_conf/solr.xml +1 -1
- data/spec/active_fedora/unsaved_digital_object_spec.rb +4 -4
- data/spec/config/host_to_vhost_spec.rb +4 -4
- data/spec/controllers/authorities_controller_spec.rb +1 -1
- data/spec/controllers/batch_controller_spec.rb +12 -10
- data/spec/controllers/catalog_controller_spec.rb +13 -13
- data/spec/controllers/dashboard_controller_spec.rb +15 -15
- data/spec/controllers/downloads_controller_spec.rb +14 -14
- data/spec/controllers/generic_files_controller_spec.rb +88 -46
- data/spec/controllers/mailbox_controller_spec.rb +2 -2
- data/spec/controllers/sessions_controller_spec.rb +1 -1
- data/spec/controllers/single_use_link_controller_spec.rb +18 -18
- data/spec/controllers/users_controller_spec.rb +47 -31
- data/spec/fixtures/countdown.avi +0 -0
- data/spec/fixtures/sufia/.gitignore +1 -0
- data/spec/fixtures/{scholarsphere → sufia}/bg_header.jpg +0 -0
- data/spec/fixtures/sufia/sufia_test1.descMeta.txt +12 -0
- data/spec/fixtures/{scholarsphere → sufia}/sufia_test1.foxml.erb +2 -2
- data/spec/fixtures/{scholarsphere/scholarsphere_test1.txt → sufia/sufia_test1.txt} +0 -0
- data/spec/fixtures/sufia/sufia_test2.descMeta.txt +12 -0
- data/spec/fixtures/{scholarsphere/scholarsphere_test2.docx → sufia/sufia_test2.docx} +0 -0
- data/spec/fixtures/{scholarsphere/scholarsphere_test2.foxml.erb → sufia/sufia_test2.foxml.erb} +6 -6
- data/spec/fixtures/sufia/sufia_test3.descMeta.txt +12 -0
- data/spec/fixtures/{scholarsphere/scholarsphere_test3.foxml.erb → sufia/sufia_test3.foxml.erb} +6 -6
- data/spec/fixtures/{scholarsphere/scholarsphere_test3.xls → sufia/sufia_test3.xls} +0 -0
- data/spec/fixtures/sufia/sufia_test4.descMeta.txt +12 -0
- data/spec/fixtures/{scholarsphere/scholarsphere_test4.foxml.erb → sufia/sufia_test4.foxml.erb} +6 -6
- data/spec/fixtures/{scholarsphere/scholarsphere_test4.pdf → sufia/sufia_test4.pdf} +0 -0
- data/spec/fixtures/sufia/sufia_test5.descMeta.txt +19 -0
- data/spec/fixtures/{scholarsphere → sufia}/sufia_test5.foxml.erb +3 -3
- data/spec/fixtures/{scholarsphere/scholarsphere_test5.mp3 → sufia/sufia_test5.mp3} +0 -0
- data/spec/fixtures/sufia/sufia_test5.txt +1 -0
- data/spec/fixtures/sufia/sufia_test6.descMeta.txt +12 -0
- data/spec/fixtures/{scholarsphere/scholarsphere_test6.foxml.erb → sufia/sufia_test6.foxml.erb} +6 -6
- data/spec/fixtures/{scholarsphere/scholarsphere_test6.jp2 → sufia/sufia_test6.jp2} +0 -0
- data/spec/fixtures/sufia/sufia_test6.txt +1 -0
- data/spec/fixtures/sufia_generic_stub.descMeta.txt +12 -0
- data/spec/fixtures/{scholarsphere_generic_stub.foxml.erb → sufia_generic_stub.foxml.erb} +3 -3
- data/spec/fixtures/sufia_generic_stub.txt +1 -0
- data/spec/lib/sufia/role_mapper_spec.rb +1 -1
- data/spec/models/audit_job_spec.rb +8 -11
- data/spec/models/batch_spec.rb +5 -5
- data/spec/models/batch_update_job_spec.rb +18 -15
- data/spec/models/checksum_audit_log_spec.rb +6 -19
- data/spec/models/event_jobs_spec.rb +23 -23
- data/spec/models/file_content_datastream_spec.rb +14 -14
- data/spec/models/fits_datastream_spec.rb +1 -1
- data/spec/models/generic_file_spec.rb +88 -41
- data/spec/models/single_use_link_spec.rb +3 -3
- data/spec/models/transcode_video_job_spec.rb +30 -0
- data/spec/models/unzip_job_spec.rb +6 -4
- data/spec/rake/{scholarsphere_fixtures_spec.rb → sufia_fixtures_spec.rb} +16 -16
- data/spec/routing/route_spec.rb +4 -8
- data/spec/spec_helper.rb +0 -7
- data/spec/support/Gemfile +4 -2
- data/spec/support/fedora_conf/fedora.fcfg +953 -0
- data/spec/support/lib/generators/test_app_generator.rb +1 -11
- data/sufia.gemspec +5 -3
- data/tasks/{scholarsphere-db.rake → sufia-db.rake} +1 -1
- data/tasks/{scholarsphere-dev.rake → sufia-dev.rake} +7 -3
- data/tasks/{scholarsphere-fixtures.rake → sufia-fixtures.rake} +43 -43
- data/tasks/{scholarsphere.rake → sufia.rake} +2 -2
- metadata +126 -95
- data/app/models/batch_update_job.rb +0 -82
- data/app/models/solr_document.rb +0 -50
- data/lib/sufia/permissions.rb +0 -43
- data/spec/fixtures/scholarsphere/scholarsphere_test1.descMeta.txt +0 -12
- data/spec/fixtures/scholarsphere/scholarsphere_test2.descMeta.txt +0 -12
- data/spec/fixtures/scholarsphere/scholarsphere_test3.descMeta.txt +0 -12
- data/spec/fixtures/scholarsphere/scholarsphere_test4.descMeta.txt +0 -12
- data/spec/fixtures/scholarsphere/scholarsphere_test5.descMeta.txt +0 -19
- data/spec/fixtures/scholarsphere/scholarsphere_test5.txt +0 -1
- data/spec/fixtures/scholarsphere/scholarsphere_test6.descMeta.txt +0 -12
- data/spec/fixtures/scholarsphere/scholarsphere_test6.txt +0 -1
- data/spec/fixtures/scholarsphere/sufia_scholarsphere1.descMeta.txt +0 -12
- data/spec/fixtures/scholarsphere/sufia_scholarsphere1.foxml.erb +0 -79
- data/spec/fixtures/scholarsphere/sufia_scholarsphere1.txt +0 -1
- data/spec/fixtures/scholarsphere_generic_stub.descMeta.txt +0 -12
- data/spec/fixtures/scholarsphere_generic_stub.txt +0 -1
@@ -22,7 +22,7 @@ describe MailboxController do
|
|
22
22
|
@subject = "Test Subject"
|
23
23
|
@rec1 = @another_user.send_message(@user, @message, @subject)
|
24
24
|
@rec2 = @user.send_message(@another_user, @message, @subject)
|
25
|
-
MailboxController.any_instance.
|
25
|
+
MailboxController.any_instance.stub(:authenticate_user!).and_return(true)
|
26
26
|
sign_in @user
|
27
27
|
end
|
28
28
|
after(:each) do
|
@@ -31,7 +31,7 @@ describe MailboxController do
|
|
31
31
|
end
|
32
32
|
describe "#index" do
|
33
33
|
it "should show message" do
|
34
|
-
User.any_instance.
|
34
|
+
User.any_instance.should_receive(:mark_as_read)
|
35
35
|
get :index
|
36
36
|
response.should be_success
|
37
37
|
assigns[:messages].first.last_message.body.should == 'Test Message'
|
@@ -30,7 +30,7 @@ describe SessionsController do
|
|
30
30
|
describe "#destroy" do
|
31
31
|
it "should redirect to the central logout page and destroy the cookie" do
|
32
32
|
request.env['COSIGN_SERVICE'] = 'cosign-gamma-ci.dlt.psu.edu'
|
33
|
-
cookies.
|
33
|
+
cookies.should_receive(:delete).with('cosign-gamma-ci.dlt.psu.edu')
|
34
34
|
get :destroy
|
35
35
|
response.should redirect_to Sufia::Engine.config.logout_url
|
36
36
|
end
|
@@ -2,9 +2,9 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe SingleUseLinkController do
|
4
4
|
before(:all) do
|
5
|
-
User.any_instance.
|
5
|
+
User.any_instance.stub(:groups).and_return([])
|
6
6
|
|
7
|
-
GenericFile.any_instance.
|
7
|
+
GenericFile.any_instance.stub(:terms_of_service).and_return('1')
|
8
8
|
@user = FactoryGirl.find_or_create(:user)
|
9
9
|
@file = GenericFile.new
|
10
10
|
@file.set_title_and_label('world.png')
|
@@ -23,17 +23,17 @@ describe SingleUseLinkController do
|
|
23
23
|
@file2.delete
|
24
24
|
end
|
25
25
|
before do
|
26
|
-
controller.
|
27
|
-
controller.
|
26
|
+
controller.stub(:has_access?).and_return(true)
|
27
|
+
controller.stub(:clear_session_user) ## Don't clear out the authenticated session
|
28
28
|
end
|
29
29
|
describe "logged in user" do
|
30
30
|
before do
|
31
31
|
@user = FactoryGirl.find_or_create(:user)
|
32
32
|
sign_in @user
|
33
33
|
@now = DateTime.now
|
34
|
-
DateTime.
|
34
|
+
DateTime.stub(:now).and_return(@now)
|
35
35
|
@hash = "sha2hash"+@now.to_f.to_s
|
36
|
-
Digest::SHA2.
|
36
|
+
Digest::SHA2.should_receive(:new).and_return(@hash)
|
37
37
|
end
|
38
38
|
after do
|
39
39
|
sign_out @user
|
@@ -41,7 +41,7 @@ describe SingleUseLinkController do
|
|
41
41
|
@user.delete
|
42
42
|
end
|
43
43
|
describe "GET 'generate_download'" do
|
44
|
-
it "
|
44
|
+
it "and_return http success" do
|
45
45
|
get 'generate_download', id:@file.pid
|
46
46
|
response.should be_success
|
47
47
|
assigns[:link].should == @routes.url_helpers.download_single_use_link_path(@hash)
|
@@ -49,7 +49,7 @@ describe SingleUseLinkController do
|
|
49
49
|
end
|
50
50
|
|
51
51
|
describe "GET 'generate_show'" do
|
52
|
-
it "
|
52
|
+
it "and_return http success" do
|
53
53
|
get 'generate_show', id:@file.pid
|
54
54
|
response.should be_success
|
55
55
|
assigns[:link].should == @routes.url_helpers.show_single_use_link_path(@hash)
|
@@ -58,14 +58,14 @@ describe SingleUseLinkController do
|
|
58
58
|
end
|
59
59
|
describe "unkown user" do
|
60
60
|
describe "GET 'generate_download'" do
|
61
|
-
it "
|
61
|
+
it "and_return http failure" do
|
62
62
|
get 'generate_download', id:@file.pid
|
63
63
|
response.should_not be_success
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
67
67
|
describe "GET 'generate_show'" do
|
68
|
-
it "
|
68
|
+
it "and_return http failure" do
|
69
69
|
get 'generate_show', id:@file.pid
|
70
70
|
response.should_not be_success
|
71
71
|
end
|
@@ -85,35 +85,35 @@ describe SingleUseLinkController do
|
|
85
85
|
@user.delete
|
86
86
|
end
|
87
87
|
describe "GET 'download'" do
|
88
|
-
it "
|
89
|
-
controller.
|
88
|
+
it "and_return http success" do
|
89
|
+
controller.stub(:render)
|
90
90
|
expected_content = ActiveFedora::Base.find(@file.pid).content.content
|
91
|
-
controller.
|
91
|
+
controller.should_receive(:send_data).with(expected_content, {:filename => 'world.png', :disposition => 'inline', :type => 'image/png' })
|
92
92
|
get :download, id:@dhash
|
93
93
|
response.should be_success
|
94
94
|
end
|
95
|
-
it "
|
95
|
+
it "and_return 404 on second attempt" do
|
96
96
|
get :download, id:@dhash
|
97
97
|
response.should be_success
|
98
98
|
lambda {get :download, id:@dhash}.should raise_error ActionController::RoutingError
|
99
99
|
end
|
100
|
-
it "
|
100
|
+
it "and_return 404 on attempt to get download with show" do
|
101
101
|
lambda {get :download, id:@shash}.should raise_error ActionController::RoutingError
|
102
102
|
end
|
103
103
|
end
|
104
104
|
|
105
105
|
describe "GET 'show'" do
|
106
|
-
it "
|
106
|
+
it "and_return http success" do
|
107
107
|
get 'show', id:@shash
|
108
108
|
response.should be_success
|
109
109
|
assigns[:generic_file].pid.should == @file.pid
|
110
110
|
end
|
111
|
-
it "
|
111
|
+
it "and_return 404 on second attempt" do
|
112
112
|
get :show, id:@shash
|
113
113
|
response.should be_success
|
114
114
|
lambda {get :show, id:@shash}.should raise_error ActionController::RoutingError
|
115
115
|
end
|
116
|
-
it "
|
116
|
+
it "and_return 404 on attempt to get show with download" do
|
117
117
|
lambda {get :show, id:@dhash}.should raise_error ActionController::RoutingError
|
118
118
|
end
|
119
119
|
end
|
@@ -19,8 +19,8 @@ describe UsersController do
|
|
19
19
|
@user = FactoryGirl.find_or_create(:user)
|
20
20
|
@another_user = FactoryGirl.find_or_create(:archivist)
|
21
21
|
sign_in @user
|
22
|
-
User.any_instance.
|
23
|
-
controller.
|
22
|
+
User.any_instance.stub(:groups).and_return([])
|
23
|
+
controller.stub(:clear_session_user) ## Don't clear out the authenticated session
|
24
24
|
end
|
25
25
|
after(:all) do
|
26
26
|
@user = FactoryGirl.find(:user) rescue
|
@@ -50,51 +50,59 @@ describe UsersController do
|
|
50
50
|
end
|
51
51
|
it "redirects to show profile when user attempts to edit another profile" do
|
52
52
|
get :edit, uid: @another_user.user_key
|
53
|
-
response.should redirect_to(@routes.url_helpers.profile_path(@another_user.user_key))
|
53
|
+
response.should redirect_to(@routes.url_helpers.profile_path(URI.escape(@another_user.user_key,'@.')))
|
54
54
|
flash[:alert].should include("You cannot edit archivist1@example.com's profile")
|
55
55
|
end
|
56
56
|
end
|
57
57
|
describe "#update" do
|
58
58
|
it "should not allow other users to update" do
|
59
59
|
post :update, uid: @another_user.user_key, user: { avatar: nil }
|
60
|
-
response.should redirect_to(@routes.url_helpers.profile_path(@another_user.user_key))
|
60
|
+
response.should redirect_to(@routes.url_helpers.profile_path(URI.escape(@another_user.user_key,'@.')))
|
61
61
|
flash[:alert].should include("You cannot edit archivist1@example.com's profile")
|
62
62
|
end
|
63
63
|
it "should set an avatar and redirect to profile" do
|
64
64
|
@user.avatar.file?.should be_false
|
65
|
-
|
65
|
+
s1 = stub('one')
|
66
|
+
UserEditProfileEventJob.should_receive(:new).with(@user.user_key).and_return(s1)
|
67
|
+
Sufia.queue.should_receive(:push).with(s1).once
|
66
68
|
f = fixture_file_upload('/world.png', 'image/png')
|
67
69
|
post :update, uid: @user.user_key, user: { avatar: f }
|
68
|
-
response.should redirect_to(@routes.url_helpers.profile_path(@user.user_key))
|
70
|
+
response.should redirect_to(@routes.url_helpers.profile_path(URI.escape(@user.user_key,'@.')))
|
69
71
|
flash[:notice].should include("Your profile has been updated")
|
70
72
|
User.find_by_user_key(@user.user_key).avatar.file?.should be_true
|
71
73
|
end
|
72
74
|
it "should validate the content type of an avatar" do
|
73
|
-
Resque.
|
75
|
+
#Resque.should_receive(:enqueue).with(UserEditProfileEventJob, @user.user_key).never
|
76
|
+
Sufia.queue.should_receive(:push).never
|
74
77
|
f = fixture_file_upload('/image.jp2', 'image/jp2')
|
75
78
|
post :update, uid: @user.user_key, user: { avatar: f }
|
76
|
-
response.should redirect_to(@routes.url_helpers.edit_profile_path(@user.user_key))
|
79
|
+
response.should redirect_to(@routes.url_helpers.edit_profile_path(URI.escape(@user.user_key,'@.')))
|
77
80
|
flash[:alert].should include("Avatar content type is invalid")
|
78
81
|
end
|
79
82
|
it "should validate the size of an avatar" do
|
80
83
|
f = fixture_file_upload('/4-20.png', 'image/png')
|
81
|
-
Resque.
|
84
|
+
#Resque.should_receive(:enqueue).with(UserEditProfileEventJob, @user.user_key).never
|
85
|
+
Sufia.queue.should_receive(:push).never
|
82
86
|
post :update, uid: @user.user_key, user: { avatar: f }
|
83
|
-
response.should redirect_to(@routes.url_helpers.edit_profile_path(@user.user_key))
|
87
|
+
response.should redirect_to(@routes.url_helpers.edit_profile_path(URI.escape(@user.user_key,'@.')))
|
84
88
|
flash[:alert].should include("Avatar file size must be less than 2097152 Bytes")
|
85
89
|
end
|
86
90
|
it "should delete an avatar" do
|
87
|
-
|
91
|
+
s1 = stub('one')
|
92
|
+
UserEditProfileEventJob.should_receive(:new).with(@user.user_key).and_return(s1)
|
93
|
+
Sufia.queue.should_receive(:push).with(s1).once
|
88
94
|
post :update, uid: @user.user_key, delete_avatar: true
|
89
|
-
response.should redirect_to(@routes.url_helpers.profile_path(@user.user_key))
|
95
|
+
response.should redirect_to(@routes.url_helpers.profile_path(URI.escape(@user.user_key,'@.')))
|
90
96
|
flash[:notice].should include("Your profile has been updated")
|
91
97
|
@user.avatar.file?.should be_false
|
92
98
|
end
|
93
99
|
it "should refresh directory attributes" do
|
94
|
-
|
95
|
-
|
100
|
+
s1 = stub('one')
|
101
|
+
UserEditProfileEventJob.should_receive(:new).with(@user.user_key).and_return(s1)
|
102
|
+
Sufia.queue.should_receive(:push).with(s1).once
|
103
|
+
User.any_instance.should_receive(:populate_attributes).once
|
96
104
|
post :update, uid: @user.user_key, update_directory: true
|
97
|
-
response.should redirect_to(@routes.url_helpers.profile_path(@user.user_key))
|
105
|
+
response.should redirect_to(@routes.url_helpers.profile_path(URI.escape(@user.user_key,'@.')))
|
98
106
|
flash[:notice].should include("Your profile has been updated")
|
99
107
|
end
|
100
108
|
it "should set an social handles" do
|
@@ -102,7 +110,7 @@ describe UsersController do
|
|
102
110
|
@user.facebook_handle.blank?.should be_true
|
103
111
|
@user.googleplus_handle.blank?.should be_true
|
104
112
|
post :update, uid: @user.user_key, user: { twitter_handle: 'twit', facebook_handle: 'face', googleplus_handle: 'goo' }
|
105
|
-
response.should redirect_to(@routes.url_helpers.profile_path(@user.user_key))
|
113
|
+
response.should redirect_to(@routes.url_helpers.profile_path(URI.escape(@user.user_key,'@.')))
|
106
114
|
flash[:notice].should include("Your profile has been updated")
|
107
115
|
u = User.find_by_user_key(@user.user_key)
|
108
116
|
u.twitter_handle.should == 'twit'
|
@@ -116,44 +124,52 @@ describe UsersController do
|
|
116
124
|
end
|
117
125
|
it "should follow another user if not already following, and log an event" do
|
118
126
|
@user.following?(@another_user).should be_false
|
119
|
-
|
127
|
+
s1 = stub('one')
|
128
|
+
UserFollowEventJob.should_receive(:new).with(@user.user_key, @another_user.user_key).and_return(s1)
|
129
|
+
Sufia.queue.should_receive(:push).with(s1).once
|
120
130
|
post :follow, uid: @another_user.user_key
|
121
|
-
response.should redirect_to(@routes.url_helpers.profile_path(@another_user.user_key))
|
131
|
+
response.should redirect_to(@routes.url_helpers.profile_path(URI.escape(@another_user.user_key,'@.')))
|
122
132
|
flash[:notice].should include("You are following #{@another_user.user_key}")
|
123
133
|
end
|
124
134
|
it "should redirect to profile if already following and not log an event" do
|
125
|
-
User.any_instance.
|
126
|
-
Resque.
|
135
|
+
User.any_instance.stub(:following?).with(@another_user).and_return(true)
|
136
|
+
#Resque.should_receive(:enqueue).with(UserFollowEventJob, @user.user_key, @another_user.user_key).never
|
137
|
+
Sufia.queue.should_receive(:push).never
|
127
138
|
post :follow, uid: @another_user.user_key
|
128
|
-
response.should redirect_to(@routes.url_helpers.profile_path(@another_user.user_key))
|
139
|
+
response.should redirect_to(@routes.url_helpers.profile_path(URI.escape(@another_user.user_key,'@.')))
|
129
140
|
flash[:notice].should include("You are following #{@another_user.user_key}")
|
130
141
|
end
|
131
142
|
it "should redirect to profile if user attempts to self-follow and not log an event" do
|
132
|
-
Resque.
|
143
|
+
#Resque.should_receive(:enqueue).with(UserFollowEventJob, @user.user_key, @user.user_key).never
|
144
|
+
Sufia.queue.should_receive(:push).never
|
133
145
|
post :follow, uid: @user.user_key
|
134
|
-
response.should redirect_to(@routes.url_helpers.profile_path(@user.user_key))
|
146
|
+
response.should redirect_to(@routes.url_helpers.profile_path(URI.escape(@user.user_key,'@.')))
|
135
147
|
flash[:alert].should include("You cannot follow or unfollow yourself")
|
136
148
|
end
|
137
149
|
end
|
138
150
|
describe "#unfollow" do
|
139
151
|
it "should unfollow another user if already following, and log an event" do
|
140
|
-
User.any_instance.
|
141
|
-
|
152
|
+
User.any_instance.stub(:following?).with(@another_user).and_return(true)
|
153
|
+
s1 = stub('one')
|
154
|
+
UserUnfollowEventJob.should_receive(:new).with(@user.user_key, @another_user.user_key).and_return(s1)
|
155
|
+
Sufia.queue.should_receive(:push).with(s1).once
|
142
156
|
post :unfollow, uid: @another_user.user_key
|
143
|
-
response.should redirect_to(@routes.url_helpers.profile_path(@another_user.user_key))
|
157
|
+
response.should redirect_to(@routes.url_helpers.profile_path(URI.escape(@another_user.user_key,'@.')))
|
144
158
|
flash[:notice].should include("You are no longer following #{@another_user.user_key}")
|
145
159
|
end
|
146
160
|
it "should redirect to profile if not following and not log an event" do
|
147
|
-
@user.
|
148
|
-
Resque.
|
161
|
+
@user.stub(:following?).with(@another_user).and_return(false)
|
162
|
+
#Resque.should_receive(:enqueue).with(UserUnfollowEventJob, @user.user_key, @another_user.user_key).never
|
163
|
+
Sufia.queue.should_receive(:push).never
|
149
164
|
post :unfollow, uid: @another_user.user_key
|
150
|
-
response.should redirect_to(@routes.url_helpers.profile_path(@another_user.user_key))
|
165
|
+
response.should redirect_to(@routes.url_helpers.profile_path(URI.escape(@another_user.user_key,'@.')))
|
151
166
|
flash[:notice].should include("You are no longer following #{@another_user.user_key}")
|
152
167
|
end
|
153
168
|
it "should redirect to profile if user attempts to self-follow and not log an event" do
|
154
|
-
Resque.
|
169
|
+
#Resque.should_receive(:enqueue).with(UserUnfollowEventJob, @user.user_key, @user.user_key).never
|
170
|
+
Sufia.queue.should_receive(:push).never
|
155
171
|
post :unfollow, uid: @user.user_key
|
156
|
-
response.should redirect_to(@routes.url_helpers.profile_path(@user.user_key))
|
172
|
+
response.should redirect_to(@routes.url_helpers.profile_path(URI.escape(@user.user_key,'@.')))
|
157
173
|
flash[:alert].should include("You cannot follow or unfollow yourself")
|
158
174
|
end
|
159
175
|
end
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
sufia_test?.foxml.xml
|
File without changes
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<info:fedora/sufia:test1> <http://purl.org/dc/terms/publisher> "archivist1" .
|
2
|
+
<info:fedora/sufia:test1> <http://purl.org/dc/terms/description> "Test Document Text Description" .
|
3
|
+
<info:fedora/sufia:test1> <http://purl.org/dc/terms/created> "4/11/2012" .
|
4
|
+
<info:fedora/sufia:test1> <http://purl.org/dc/terms/contributor> "archivist1" .
|
5
|
+
<info:fedora/sufia:test1> <http://purl.org/dc/terms/title> "Test Document Text" .
|
6
|
+
<info:fedora/sufia:test1> <http://purl.org/dc/terms/relation> "test" .
|
7
|
+
<info:fedora/sufia:test1> <http://purl.org/dc/terms/subject> "Plain Text Test" .
|
8
|
+
<info:fedora/sufia:test1> <http://purl.org/dc/terms/language> "En" .
|
9
|
+
<info:fedora/sufia:test1> <http://xmlns.com/foaf/0.1/based_near> "State College" .
|
10
|
+
<info:fedora/sufia:test1> <http://purl.org/dc/terms/rights> "archivist1@example.com" .
|
11
|
+
<info:fedora/sufia:test1> <http://purl.org/dc/terms/creator> "archivist1@example.com" .
|
12
|
+
<info:fedora/sufia:test1> <http://purl.org/dc/terms/identifier> "Test" .
|
@@ -21,7 +21,7 @@
|
|
21
21
|
</foxml:datastream>
|
22
22
|
<foxml:datastream CONTROL_GROUP="M" ID="descMetadata" STATE="A" VERSIONABLE="true">
|
23
23
|
<foxml:datastreamVersion ID="descMetadata.0" LABEL="" MIMETYPE="text/plain">
|
24
|
-
<foxml:contentLocation REF="file:<%=@localDir%>/
|
24
|
+
<foxml:contentLocation REF="file:<%=@localDir%>/sufia/sufia_test1.descMeta.txt" TYPE="URL"/>
|
25
25
|
</foxml:datastreamVersion>
|
26
26
|
</foxml:datastream>
|
27
27
|
<foxml:datastream ID="properties" STATE="A" CONTROL_GROUP="X" VERSIONABLE="true">
|
@@ -50,7 +50,7 @@
|
|
50
50
|
<foxml:datastream CONTROL_GROUP="M" ID="content" STATE="A" VERSIONABLE="true">
|
51
51
|
<foxml:datastreamVersion ID="content.0" LABEL="Test Data 1"
|
52
52
|
MIMETYPE="text/plain" SIZE="25">
|
53
|
-
<foxml:contentLocation REF="file:<%=@localDir%>/
|
53
|
+
<foxml:contentLocation REF="file:<%=@localDir%>/sufia/sufia_test1.txt" TYPE="URL"/>
|
54
54
|
</foxml:datastreamVersion>
|
55
55
|
</foxml:datastream>
|
56
56
|
<foxml:datastream CONTROL_GROUP="X" ID="rightsMetadata" STATE="A" VERSIONABLE="true">
|
File without changes
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<info:fedora/sufia:test2> <http://purl.org/dc/terms/publisher> "archivist1" .
|
2
|
+
<info:fedora/sufia:test2> <http://purl.org/dc/terms/description> "Test Document Word DocX Description" .
|
3
|
+
<info:fedora/sufia:test2> <http://purl.org/dc/terms/created> "4/11/2012" .
|
4
|
+
<info:fedora/sufia:test2> <http://purl.org/dc/terms/contributor> "archivist1" .
|
5
|
+
<info:fedora/sufia:test2> <http://purl.org/dc/terms/title> "Test Document Word DocX" .
|
6
|
+
<info:fedora/sufia:test2> <http://purl.org/dc/terms/relation> "test" .
|
7
|
+
<info:fedora/sufia:test2> <http://purl.org/dc/terms/subject> "Word DocX Test" .
|
8
|
+
<info:fedora/sufia:test2> <http://purl.org/dc/terms/language> "En" .
|
9
|
+
<info:fedora/sufia:test2> <http://xmlns.com/foaf/0.1/based_near> "State College" .
|
10
|
+
<info:fedora/sufia:test2> <http://purl.org/dc/terms/rights> "archivist1@example.com" .
|
11
|
+
<info:fedora/sufia:test2> <http://purl.org/dc/terms/creator> "archivist1@example.com" .
|
12
|
+
<info:fedora/sufia:test2> <http://purl.org/dc/terms/identifier> "Test" .
|
File without changes
|
data/spec/fixtures/{scholarsphere/scholarsphere_test2.foxml.erb → sufia/sufia_test2.foxml.erb}
RENAMED
@@ -1,5 +1,5 @@
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<foxml:digitalObject PID="
|
2
|
+
<foxml:digitalObject PID="sufia:test2" VERSION="1.1" xmlns:foxml="info:fedora/fedora-system:def/foxml#"
|
3
3
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="info:fedora/fedora-system:def/foxml# http://www.fedora.info/definitions/1/0/foxml1-1.xsd">
|
4
4
|
<foxml:objectProperties>
|
5
5
|
<foxml:property NAME="info:fedora/fedora-system:def/model#state" VALUE="Active"/>
|
@@ -14,14 +14,14 @@
|
|
14
14
|
xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/"
|
15
15
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd">
|
16
16
|
<dc:title>Test Document Word DocX</dc:title>
|
17
|
-
<dc:identifier>
|
17
|
+
<dc:identifier>sufia:test2</dc:identifier>
|
18
18
|
</oai_dc:dc>
|
19
19
|
</foxml:xmlContent>
|
20
20
|
</foxml:datastreamVersion>
|
21
21
|
</foxml:datastream>
|
22
22
|
<foxml:datastream CONTROL_GROUP="M" ID="descMetadata" STATE="A" VERSIONABLE="true">
|
23
23
|
<foxml:datastreamVersion ID="descMetadata.0" LABEL="" MIMETYPE="text/plain">
|
24
|
-
<foxml:contentLocation REF="file:<%=@localDir%>/
|
24
|
+
<foxml:contentLocation REF="file:<%=@localDir%>/sufia/sufia_test2.descMeta.txt" TYPE="URL"/>
|
25
25
|
</foxml:datastreamVersion>
|
26
26
|
</foxml:datastream>
|
27
27
|
<foxml:datastream CONTROL_GROUP="X" ID="RELS-EXT" STATE="A" VERSIONABLE="true">
|
@@ -29,7 +29,7 @@
|
|
29
29
|
LABEL="Fedora Object-to-Object Relationship Metadata" MIMETYPE="application/rdf+xml" SIZE="286">
|
30
30
|
<foxml:xmlContent>
|
31
31
|
<rdf:RDF xmlns:ns0="info:fedora/fedora-system:def/model#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
|
32
|
-
<rdf:Description rdf:about="info:fedora/
|
32
|
+
<rdf:Description rdf:about="info:fedora/sufia:test2">
|
33
33
|
<ns0:hasModel rdf:resource="info:fedora/afmodel:GenericFile"/>
|
34
34
|
</rdf:Description>
|
35
35
|
</rdf:RDF>
|
@@ -49,7 +49,7 @@
|
|
49
49
|
<foxml:datastream CONTROL_GROUP="M" ID="content" STATE="A" VERSIONABLE="true">
|
50
50
|
<foxml:datastreamVersion ID="content.0" LABEL="Test Data 1"
|
51
51
|
MIMETYPE="text/plain" SIZE="25">
|
52
|
-
<foxml:contentLocation REF="file:<%=@localDir%>/
|
52
|
+
<foxml:contentLocation REF="file:<%=@localDir%>/sufia/sufia_test2.docx" TYPE="URL"/>
|
53
53
|
</foxml:datastreamVersion>
|
54
54
|
</foxml:datastream>
|
55
55
|
<foxml:datastream CONTROL_GROUP="X" ID="rightsMetadata" STATE="A" VERSIONABLE="true">
|
@@ -74,7 +74,7 @@
|
|
74
74
|
<access type="edit">
|
75
75
|
<human/>
|
76
76
|
<machine>
|
77
|
-
<person>archivist1</person>
|
77
|
+
<person>archivist1@example.com</person>
|
78
78
|
</machine>
|
79
79
|
</access>
|
80
80
|
<embargo>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<info:fedora/sufia:test3> <http://purl.org/dc/terms/publisher> "archivist1" .
|
2
|
+
<info:fedora/sufia:test3> <http://purl.org/dc/terms/description> "Test Document Text Description" .
|
3
|
+
<info:fedora/sufia:test3> <http://purl.org/dc/terms/created> "4/11/2012" .
|
4
|
+
<info:fedora/sufia:test3> <http://purl.org/dc/terms/contributor> "archivist1" .
|
5
|
+
<info:fedora/sufia:test3> <http://purl.org/dc/terms/title> "Test Document Text" .
|
6
|
+
<info:fedora/sufia:test3> <http://purl.org/dc/terms/relation> "test" .
|
7
|
+
<info:fedora/sufia:test3> <http://purl.org/dc/terms/subject> "Plain Text Test" .
|
8
|
+
<info:fedora/sufia:test3> <http://purl.org/dc/terms/language> "En" .
|
9
|
+
<info:fedora/sufia:test3> <http://xmlns.com/foaf/0.1/based_near> "State College" .
|
10
|
+
<info:fedora/sufia:test3> <http://purl.org/dc/terms/rights> "archivist1@example.com" .
|
11
|
+
<info:fedora/sufia:test3> <http://purl.org/dc/terms/creator> "archivist1@example.com" .
|
12
|
+
<info:fedora/sufia:test3> <http://purl.org/dc/terms/identifier> "Test" .
|
data/spec/fixtures/{scholarsphere/scholarsphere_test3.foxml.erb → sufia/sufia_test3.foxml.erb}
RENAMED
@@ -1,5 +1,5 @@
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<foxml:digitalObject PID="
|
2
|
+
<foxml:digitalObject PID="sufia:test3" VERSION="1.1" xmlns:foxml="info:fedora/fedora-system:def/foxml#"
|
3
3
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="info:fedora/fedora-system:def/foxml# http://www.fedora.info/definitions/1/0/foxml1-1.xsd">
|
4
4
|
<foxml:objectProperties>
|
5
5
|
<foxml:property NAME="info:fedora/fedora-system:def/model#state" VALUE="Active"/>
|
@@ -14,14 +14,14 @@
|
|
14
14
|
xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/"
|
15
15
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd">
|
16
16
|
<dc:title>Test Data Excel</dc:title>
|
17
|
-
<dc:identifier>
|
17
|
+
<dc:identifier>sufia:test3</dc:identifier>
|
18
18
|
</oai_dc:dc>
|
19
19
|
</foxml:xmlContent>
|
20
20
|
</foxml:datastreamVersion>
|
21
21
|
</foxml:datastream>
|
22
22
|
<foxml:datastream CONTROL_GROUP="M" ID="descMetadata" STATE="A" VERSIONABLE="true">
|
23
23
|
<foxml:datastreamVersion ID="descMetadata.0" LABEL="" MIMETYPE="text/plain">
|
24
|
-
<foxml:contentLocation REF="file:<%=@localDir%>/
|
24
|
+
<foxml:contentLocation REF="file:<%=@localDir%>/sufia/sufia_test3.descMeta.txt" TYPE="URL"/>
|
25
25
|
</foxml:datastreamVersion>
|
26
26
|
</foxml:datastream>
|
27
27
|
<foxml:datastream CONTROL_GROUP="X" ID="RELS-EXT" STATE="A" VERSIONABLE="true">
|
@@ -29,7 +29,7 @@
|
|
29
29
|
LABEL="Fedora Object-to-Object Relationship Metadata" MIMETYPE="application/rdf+xml" SIZE="286">
|
30
30
|
<foxml:xmlContent>
|
31
31
|
<rdf:RDF xmlns:ns0="info:fedora/fedora-system:def/model#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
|
32
|
-
<rdf:Description rdf:about="info:fedora/
|
32
|
+
<rdf:Description rdf:about="info:fedora/sufia:test3">
|
33
33
|
<ns0:hasModel rdf:resource="info:fedora/afmodel:GenericFile"/>
|
34
34
|
</rdf:Description>
|
35
35
|
</rdf:RDF>
|
@@ -50,7 +50,7 @@
|
|
50
50
|
<foxml:datastream CONTROL_GROUP="M" ID="content" STATE="A" VERSIONABLE="true">
|
51
51
|
<foxml:datastreamVersion ID="content.0" LABEL="Test Data 1"
|
52
52
|
MIMETYPE="application/excel">
|
53
|
-
<foxml:contentLocation REF="file:<%=@localDir%>/
|
53
|
+
<foxml:contentLocation REF="file:<%=@localDir%>/sufia/sufia_test3.xls" TYPE="URL"/>
|
54
54
|
</foxml:datastreamVersion>
|
55
55
|
</foxml:datastream>
|
56
56
|
<foxml:datastream CONTROL_GROUP="X" ID="rightsMetadata" STATE="A" VERSIONABLE="true">
|
@@ -77,7 +77,7 @@
|
|
77
77
|
<human/>
|
78
78
|
<machine>
|
79
79
|
|
80
|
-
<person>archivist1</person>
|
80
|
+
<person>archivist1@example.com</person>
|
81
81
|
</machine>
|
82
82
|
</access>
|
83
83
|
<embargo>
|