sufia 0.0.1.pre1 → 0.0.1.pre2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -2
- data/Gemfile +2 -1
- data/README.md +19 -15
- data/Rakefile +2 -0
- data/app/controllers/batch_controller.rb +2 -3
- data/app/controllers/contact_form_controller.rb +1 -0
- data/app/controllers/dashboard_controller.rb +2 -2
- data/app/controllers/generic_files_controller.rb +24 -12
- data/app/controllers/mailbox_controller.rb +2 -2
- data/app/controllers/single_use_link_controller.rb +5 -5
- data/app/controllers/users_controller.rb +10 -10
- data/app/helpers/{application_helper.rb → sufia_helper.rb} +5 -13
- data/app/models/audit_job.rb +3 -4
- data/app/models/batch.rb +2 -0
- data/app/models/batch_update_job.rb +4 -6
- data/app/models/checksum_audit_log.rb +2 -0
- data/app/models/contact_form.rb +2 -0
- data/app/models/content_delete_event_job.rb +1 -1
- data/app/models/content_deposit_event_job.rb +2 -2
- data/app/models/content_new_version_event_job.rb +2 -2
- data/app/models/content_restored_version_event_job.rb +2 -2
- data/app/models/content_update_event_job.rb +2 -2
- data/app/models/datastreams/properties_datastream.rb +1 -1
- data/app/models/domain_term.rb +1 -0
- data/app/models/event_job.rb +1 -1
- data/app/models/generic_file.rb +5 -4
- data/app/models/local_authority.rb +1 -0
- data/app/models/local_authority_entry.rb +1 -0
- data/app/models/single_use_link.rb +2 -2
- data/app/models/user_edit_profile_event_job.rb +1 -1
- data/app/models/user_follow_event_job.rb +2 -2
- data/app/models/user_unfollow_event_job.rb +2 -2
- data/app/models/version_committer.rb +1 -0
- data/app/views/_footer.html.erb +21 -0
- data/app/views/_logo.html.erb +3 -0
- data/app/views/_masthead.html.erb +38 -0
- data/app/views/_user_util_links.html.erb +14 -43
- data/app/views/catalog/_document_list.html.erb +0 -7
- data/app/views/catalog/_home_text.html.erb +4 -4
- data/app/views/catalog/_recent_document.html.erb +5 -5
- data/app/views/contact_form/_directions.html.erb +4 -0
- data/app/views/contact_form/new.html.erb +2 -4
- data/app/views/dashboard/_document_list.html.erb +1 -8
- data/app/views/dashboard/_facets.html.erb +1 -1
- data/app/views/dashboard/_index_partials/_list_files.html.erb +1 -1
- data/app/views/dashboard/_index_partials/_thumbnail_display.html.erb +6 -6
- data/app/views/dashboard/_search_form.html.erb +1 -1
- data/app/views/dashboard/index.html.erb +26 -25
- data/app/views/generic_files/_media_display.html.erb +5 -5
- data/app/views/generic_files/_permission.html.erb +11 -11
- data/app/views/generic_files/edit.html.erb +10 -8
- data/app/views/generic_files/show.html.erb +16 -12
- data/app/views/layouts/error.html.erb +2 -53
- data/app/views/layouts/hydra-head.html.erb +2 -21
- data/app/views/mailbox/index.html.erb +1 -1
- data/app/views/static/about.html.erb +2 -65
- data/app/views/static/help.html.erb +1 -721
- data/app/views/users/_search_form.html.erb +1 -1
- data/app/views/users/edit.html.erb +6 -3
- data/config/locales/sufia.en.yml +6 -0
- data/config/routes.rb +1 -3
- data/features/browse_dashboard_files.feature +1 -1
- data/features/display_dashboard.feature +1 -1
- data/features/step_definitions/fixture_steps.rb +2 -2
- data/features/step_definitions/user_steps.rb +12 -8
- data/features/support/env.rb +9 -0
- data/features/support/paths.rb +21 -21
- data/lib/generators/sufia/sufia_generator.rb +46 -4
- data/lib/generators/sufia/templates/catalog_controller.rb +2 -2
- data/lib/generators/sufia/templates/config/redis_config.rb +20 -0
- data/lib/generators/sufia/templates/config/sufia.rb +29 -0
- data/lib/generators/sufia/templates/migrations/add_groups_to_users.rb +0 -4
- data/lib/sufia.rb +22 -15
- data/lib/sufia/active_fedora/redis.rb +49 -0
- data/lib/{generators/sufia/templates/config/active_record_base_redis.rb → sufia/active_record/redis.rb} +1 -16
- data/lib/sufia/controller.rb +1 -2
- data/lib/sufia/http_header_auth.rb +9 -0
- data/lib/sufia/role_mapper.rb +1 -0
- data/lib/sufia/user.rb +24 -6
- data/lib/sufia/version.rb +1 -1
- data/lib/tasks/fixtures.rake +245 -0
- data/spec/.gitignore +1 -0
- data/spec/active_fedora/unsaved_digital_object_spec.rb +2 -2
- data/spec/config/host_to_vhost_spec.rb +8 -8
- data/spec/controllers/batch_controller_spec.rb +6 -6
- data/spec/controllers/catalog_controller_spec.rb +2 -0
- data/spec/controllers/dashboard_controller_spec.rb +13 -10
- data/spec/controllers/downloads_controller_spec.rb +8 -8
- data/spec/controllers/generic_files_controller_spec.rb +46 -44
- data/spec/controllers/mailbox_controller_spec.rb +6 -12
- data/spec/controllers/sessions_controller_spec.rb +8 -6
- data/spec/controllers/single_use_link_controller_spec.rb +9 -14
- data/spec/controllers/users_controller_spec.rb +49 -49
- data/spec/{factories.rb → factories/users.rb} +6 -3
- data/spec/fixtures/scholarsphere/scholarsphere_test2.foxml.erb +2 -2
- data/spec/fixtures/scholarsphere/scholarsphere_test3.foxml.erb +2 -2
- data/spec/fixtures/scholarsphere/scholarsphere_test4.foxml.erb +2 -2
- data/spec/fixtures/scholarsphere/scholarsphere_test6.foxml.erb +2 -2
- data/spec/fixtures/scholarsphere/sufia_scholarsphere1.descMeta.txt +12 -0
- data/spec/fixtures/scholarsphere/sufia_scholarsphere1.foxml.erb +79 -0
- data/spec/fixtures/scholarsphere/sufia_scholarsphere1.txt +1 -0
- data/spec/fixtures/scholarsphere/{scholarsphere_test1.foxml.erb → sufia_test1.foxml.erb} +6 -6
- data/spec/fixtures/scholarsphere/{scholarsphere_test5.foxml.erb → sufia_test5.foxml.erb} +5 -5
- data/spec/fixtures/scholarsphere_generic_stub.foxml.erb +5 -5
- data/spec/lib/{scholarsphere → sufia}/id_service_spec.rb +5 -5
- data/spec/lib/{scholarsphere → sufia}/role_mapper_spec.rb +5 -2
- data/spec/models/audit_job_spec.rb +1 -1
- data/spec/models/batch_spec.rb +2 -2
- data/spec/models/batch_update_job_spec.rb +5 -5
- data/spec/models/checksum_audit_log_spec.rb +1 -1
- data/spec/models/event_jobs_spec.rb +19 -19
- data/spec/models/file_content_datastream_spec.rb +6 -6
- data/spec/models/fits_datastream_spec.rb +1 -1
- data/spec/models/generic_file_spec.rb +8 -9
- data/spec/models/local_authority_spec.rb +3 -3
- data/spec/models/single_use_link_spec.rb +5 -5
- data/spec/models/unzip_job_spec.rb +1 -1
- data/spec/models/user_spec.rb +5 -26
- data/spec/rake/scholarsphere_fixtures_spec.rb +13 -12
- data/spec/routing/route_spec.rb +4 -41
- data/spec/spec_helper.rb +14 -4
- data/spec/support/Gemfile +21 -0
- data/spec/support/config/redis.yml +6 -0
- data/spec/support/lib/generators/test_app_generator.rb +40 -0
- data/sufia.gemspec +4 -2
- data/tasks/cucumber.rake +0 -6
- data/tasks/jetty.rake +40 -0
- data/tasks/scholarsphere-dev.rake +57 -17
- data/tasks/scholarsphere-fixtures.rake +16 -63
- metadata +74 -55
- data/.rvmrc +0 -59
- data/LICENSE +0 -22
- data/app/assets/images/site_images/logo_psuss_logotype.png +0 -0
- data/app/assets/images/site_images/logo_psuss_shield.png +0 -0
- data/lib/generators/sufia/templates/config/active_fedora_base_redis.rb +0 -54
- data/lib/sufia/ldap.rb +0 -123
- data/spec/fixtures/hydra_test_default_partials.foxml.xml +0 -80
- data/spec/fixtures/hydra_test_generic_content.foxml.xml +0 -138
- data/spec/fixtures/hydra_test_generic_image.foxml.xml +0 -395
- data/spec/fixtures/hydra_test_no_model.foxml.xml +0 -79
- data/spec/fixtures/hydrangea_fixture_archivist_only_mods_article.foxml.xml +0 -1212
- data/spec/fixtures/hydrangea_fixture_file_asset1.foxml.xml +0 -4946
- data/spec/fixtures/hydrangea_fixture_mods_article1.foxml.xml +0 -234
- data/spec/fixtures/hydrangea_fixture_mods_article2.foxml.xml +0 -177
- data/spec/fixtures/hydrangea_fixture_mods_article3.foxml.xml +0 -170
- data/spec/fixtures/hydrangea_fixture_mods_dataset1.foxml.xml +0 -187
- data/spec/fixtures/hydrangea_fixture_uploaded_svg1.foxml.xml +0 -676
- data/spec/fixtures/hydrus_admin_class1.foxml.xml +0 -176
- data/spec/fixtures/libra-oa_1.foxml.xml +0 -2324
- data/spec/fixtures/libra-oa_2.foxml.xml +0 -2422
- data/spec/fixtures/libra-oa_7.foxml.xml +0 -1735
@@ -22,35 +22,30 @@ 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
|
-
User.stubs(:current).returns( @user)
|
26
25
|
MailboxController.any_instance.stubs(:authenticate_user!).returns(true)
|
27
26
|
sign_in @user
|
28
|
-
User.current = @user
|
29
27
|
end
|
30
28
|
after(:each) do
|
31
29
|
@rec1.delete
|
32
30
|
@rec2.delete
|
33
31
|
end
|
34
32
|
describe "#index" do
|
35
|
-
render_views
|
36
33
|
it "should show message" do
|
37
|
-
User.
|
34
|
+
User.any_instance.expects(:mark_as_read)
|
38
35
|
get :index
|
39
36
|
response.should be_success
|
40
|
-
|
41
|
-
|
42
|
-
response.body.should include('Test Subject')
|
37
|
+
assigns[:messages].first.last_message.body.should == 'Test Message'
|
38
|
+
assigns[:messages].first.last_message.subject.should == 'Test Subject'
|
43
39
|
end
|
44
40
|
end
|
45
41
|
describe "#delete" do
|
46
|
-
render_views
|
47
42
|
it "should delete message" do
|
48
43
|
rec = @another_user.send_message(@user, 'message 2', 'subject 2')
|
49
44
|
@user.mailbox.inbox.count.should == 2
|
50
45
|
get :index
|
51
|
-
|
46
|
+
assigns[:messages].first.last_message.body.should == 'message 2'
|
52
47
|
get :delete, :uid=> rec.conversation.id
|
53
|
-
response.should redirect_to(mailbox_path)
|
48
|
+
response.should redirect_to(@routes.url_helpers.mailbox_path)
|
54
49
|
@user.mailbox.inbox.count.should ==1
|
55
50
|
end
|
56
51
|
it "should not delete message" do
|
@@ -58,14 +53,13 @@ describe MailboxController do
|
|
58
53
|
rec = @another_user.send_message(@curator, 'message 3', 'subject 3')
|
59
54
|
@curator.mailbox.inbox.count.should == 1
|
60
55
|
get :delete, :uid=> rec.conversation.id
|
61
|
-
response.should redirect_to(mailbox_path)
|
56
|
+
response.should redirect_to(@routes.url_helpers.mailbox_path)
|
62
57
|
@curator.mailbox.inbox.count.should ==1
|
63
58
|
rec.delete
|
64
59
|
@curator.delete
|
65
60
|
end
|
66
61
|
end
|
67
62
|
describe "#delete_all" do
|
68
|
-
render_views
|
69
63
|
it "should delete message" do
|
70
64
|
rec1 = @another_user.send_message(@user, 'message 2', 'subject 2')
|
71
65
|
rec2 = @another_user.send_message(@user, 'message 3', 'subject 3')
|
@@ -17,12 +17,14 @@ require 'spec_helper'
|
|
17
17
|
describe SessionsController do
|
18
18
|
describe "routing" do
|
19
19
|
it "should send /logout to sessions#destroy" do
|
20
|
-
|
21
|
-
|
20
|
+
#pending "This is a customization that PSU did in their own routes file, not default devise"
|
21
|
+
{ get: '/logout' }.should route_to( controller: 'sessions', action: 'destroy')
|
22
|
+
@routes.url_helpers.destroy_user_session_path.should == '/logout'
|
22
23
|
end
|
23
24
|
it "should send /login to sessions#new" do
|
24
|
-
|
25
|
-
|
25
|
+
#pending "This is a customization that PSU did in their own routes file, not default devise"
|
26
|
+
{ get: '/login' }.should route_to( controller: 'sessions', action: 'new')
|
27
|
+
@routes.url_helpers.new_user_session_path.should == '/login'
|
26
28
|
end
|
27
29
|
end
|
28
30
|
describe "#destroy" do
|
@@ -30,13 +32,13 @@ describe SessionsController do
|
|
30
32
|
request.env['COSIGN_SERVICE'] = 'cosign-gamma-ci.dlt.psu.edu'
|
31
33
|
cookies.expects(:delete).with('cosign-gamma-ci.dlt.psu.edu')
|
32
34
|
get :destroy
|
33
|
-
response.should redirect_to
|
35
|
+
response.should redirect_to Sufia::Engine.config.logout_url
|
34
36
|
end
|
35
37
|
end
|
36
38
|
describe "#new" do
|
37
39
|
it "should redirect to the central login page" do
|
38
40
|
get :new
|
39
|
-
response.should redirect_to
|
41
|
+
response.should redirect_to Sufia::Engine.config.login_url
|
40
42
|
end
|
41
43
|
end
|
42
44
|
end
|
@@ -2,19 +2,17 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe SingleUseLinkController do
|
4
4
|
before(:all) do
|
5
|
-
Hydra::LDAP.connection.stubs(:get_operation_result).returns(OpenStruct.new({code:0, message:"Success"}))
|
6
|
-
Hydra::LDAP.stubs(:does_user_exist?).returns(true)
|
7
5
|
User.any_instance.stubs(:groups).returns([])
|
8
6
|
|
9
7
|
GenericFile.any_instance.stubs(:terms_of_service).returns('1')
|
10
8
|
@user = FactoryGirl.find_or_create(:user)
|
11
9
|
@file = GenericFile.new
|
12
10
|
@file.set_title_and_label('world.png')
|
13
|
-
@file.add_file_datastream(File.new(
|
11
|
+
@file.add_file_datastream(File.new(fixture_path + '/world.png'), :dsid=>'content', :mimeType => 'image/png')
|
14
12
|
@file.apply_depositor_metadata(@user.user_key)
|
15
13
|
@file.save
|
16
14
|
@file2 = GenericFile.new
|
17
|
-
@file2.add_file_datastream(File.new(
|
15
|
+
@file2.add_file_datastream(File.new(fixture_path + '/world.png'), :dsid=>'content', :mimeType => 'image/png')
|
18
16
|
@file2.apply_depositor_metadata('mjg36')
|
19
17
|
@file2.save
|
20
18
|
end
|
@@ -25,6 +23,7 @@ describe SingleUseLinkController do
|
|
25
23
|
@file2.delete
|
26
24
|
end
|
27
25
|
before do
|
26
|
+
controller.stubs(:has_access?).returns(true)
|
28
27
|
controller.stubs(:clear_session_user) ## Don't clear out the authenticated session
|
29
28
|
end
|
30
29
|
describe "logged in user" do
|
@@ -45,7 +44,7 @@ describe SingleUseLinkController do
|
|
45
44
|
it "returns http success" do
|
46
45
|
get 'generate_download', id:@file.pid
|
47
46
|
response.should be_success
|
48
|
-
assigns[:link].should ==
|
47
|
+
assigns[:link].should == @routes.url_helpers.download_single_use_link_path(@hash)
|
49
48
|
end
|
50
49
|
end
|
51
50
|
|
@@ -53,7 +52,7 @@ describe SingleUseLinkController do
|
|
53
52
|
it "returns http success" do
|
54
53
|
get 'generate_show', id:@file.pid
|
55
54
|
response.should be_success
|
56
|
-
assigns[:link].should ==
|
55
|
+
assigns[:link].should == @routes.url_helpers.show_single_use_link_path(@hash)
|
57
56
|
end
|
58
57
|
end
|
59
58
|
end
|
@@ -96,12 +95,10 @@ describe SingleUseLinkController do
|
|
96
95
|
it "returns 404 on second attempt" do
|
97
96
|
get :download, id:@dhash
|
98
97
|
response.should be_success
|
99
|
-
get :download, id:@dhash
|
100
|
-
response.should_not be_success
|
98
|
+
lambda {get :download, id:@dhash}.should raise_error ActionController::RoutingError
|
101
99
|
end
|
102
100
|
it "returns 404 on attempt to get download with show" do
|
103
|
-
get :download, id:@shash
|
104
|
-
response.should_not be_success
|
101
|
+
lambda {get :download, id:@shash}.should raise_error ActionController::RoutingError
|
105
102
|
end
|
106
103
|
end
|
107
104
|
|
@@ -114,12 +111,10 @@ describe SingleUseLinkController do
|
|
114
111
|
it "returns 404 on second attempt" do
|
115
112
|
get :show, id:@shash
|
116
113
|
response.should be_success
|
117
|
-
get :show, id:@shash
|
118
|
-
response.should_not be_success
|
114
|
+
lambda {get :show, id:@shash}.should raise_error ActionController::RoutingError
|
119
115
|
end
|
120
116
|
it "returns 404 on attempt to get show with download" do
|
121
|
-
get :show, id:@dhash
|
122
|
-
response.should_not be_success
|
117
|
+
lambda {get :show, id:@dhash}.should raise_error ActionController::RoutingError
|
123
118
|
end
|
124
119
|
end
|
125
120
|
end
|
@@ -30,7 +30,7 @@ describe UsersController do
|
|
30
30
|
end
|
31
31
|
describe "#show" do
|
32
32
|
it "show the user profile if user exists" do
|
33
|
-
get :show, uid: @user.
|
33
|
+
get :show, uid: @user.user_key
|
34
34
|
response.should be_success
|
35
35
|
response.should_not redirect_to(root_path)
|
36
36
|
flash[:alert].should be_nil
|
@@ -43,68 +43,68 @@ describe UsersController do
|
|
43
43
|
end
|
44
44
|
describe "#edit" do
|
45
45
|
it "show edit form when user edits own profile" do
|
46
|
-
get :edit, uid: @user.
|
46
|
+
get :edit, uid: @user.user_key
|
47
47
|
response.should be_success
|
48
48
|
response.should render_template('users/edit')
|
49
49
|
flash[:alert].should be_nil
|
50
50
|
end
|
51
51
|
it "redirects to show profile when user attempts to edit another profile" do
|
52
|
-
get :edit, uid: @another_user.
|
53
|
-
response.should redirect_to(profile_path(@another_user.
|
54
|
-
flash[:alert].should include("You cannot edit archivist1's profile")
|
52
|
+
get :edit, uid: @another_user.user_key
|
53
|
+
response.should redirect_to(@routes.url_helpers.profile_path(@another_user.user_key))
|
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
|
-
post :update, uid: @another_user.
|
60
|
-
response.should redirect_to(profile_path(@another_user.
|
61
|
-
flash[:alert].should include("You cannot edit archivist1's profile")
|
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))
|
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
|
-
Resque.expects(:enqueue).with(UserEditProfileEventJob, @user.
|
65
|
+
Resque.expects(:enqueue).with(UserEditProfileEventJob, @user.user_key).once
|
66
66
|
f = fixture_file_upload('/world.png', 'image/png')
|
67
|
-
post :update, uid: @user.
|
68
|
-
response.should redirect_to(profile_path(@user.
|
67
|
+
post :update, uid: @user.user_key, user: { avatar: f }
|
68
|
+
response.should redirect_to(@routes.url_helpers.profile_path(@user.user_key))
|
69
69
|
flash[:notice].should include("Your profile has been updated")
|
70
|
-
User.
|
70
|
+
User.find_by_user_key(@user.user_key).avatar.file?.should be_true
|
71
71
|
end
|
72
72
|
it "should validate the content type of an avatar" do
|
73
|
-
Resque.expects(:enqueue).with(UserEditProfileEventJob, @user.
|
73
|
+
Resque.expects(:enqueue).with(UserEditProfileEventJob, @user.user_key).never
|
74
74
|
f = fixture_file_upload('/image.jp2', 'image/jp2')
|
75
|
-
post :update, uid: @user.
|
76
|
-
response.should redirect_to(edit_profile_path(@user.
|
75
|
+
post :update, uid: @user.user_key, user: { avatar: f }
|
76
|
+
response.should redirect_to(@routes.url_helpers.edit_profile_path(@user.user_key))
|
77
77
|
flash[:alert].should include("Avatar content type is invalid")
|
78
78
|
end
|
79
79
|
it "should validate the size of an avatar" do
|
80
80
|
f = fixture_file_upload('/4-20.png', 'image/png')
|
81
|
-
Resque.expects(:enqueue).with(UserEditProfileEventJob, @user.
|
82
|
-
post :update, uid: @user.
|
83
|
-
response.should redirect_to(edit_profile_path(@user.
|
81
|
+
Resque.expects(:enqueue).with(UserEditProfileEventJob, @user.user_key).never
|
82
|
+
post :update, uid: @user.user_key, user: { avatar: f }
|
83
|
+
response.should redirect_to(@routes.url_helpers.edit_profile_path(@user.user_key))
|
84
84
|
flash[:alert].should include("Avatar file size must be less than 2097152 Bytes")
|
85
85
|
end
|
86
86
|
it "should delete an avatar" do
|
87
|
-
Resque.expects(:enqueue).with(UserEditProfileEventJob, @user.
|
88
|
-
post :update, uid: @user.
|
89
|
-
response.should redirect_to(profile_path(@user.
|
87
|
+
Resque.expects(:enqueue).with(UserEditProfileEventJob, @user.user_key).once
|
88
|
+
post :update, uid: @user.user_key, delete_avatar: true
|
89
|
+
response.should redirect_to(@routes.url_helpers.profile_path(@user.user_key))
|
90
90
|
flash[:notice].should include("Your profile has been updated")
|
91
91
|
@user.avatar.file?.should be_false
|
92
92
|
end
|
93
93
|
it "should refresh directory attributes" do
|
94
|
-
Resque.expects(:enqueue).with(UserEditProfileEventJob, @user.
|
94
|
+
Resque.expects(:enqueue).with(UserEditProfileEventJob, @user.user_key).once
|
95
95
|
User.any_instance.expects(:populate_attributes).once
|
96
|
-
post :update, uid: @user.
|
97
|
-
response.should redirect_to(profile_path(@user.
|
96
|
+
post :update, uid: @user.user_key, update_directory: true
|
97
|
+
response.should redirect_to(@routes.url_helpers.profile_path(@user.user_key))
|
98
98
|
flash[:notice].should include("Your profile has been updated")
|
99
99
|
end
|
100
100
|
it "should set an social handles" do
|
101
101
|
@user.twitter_handle.blank?.should be_true
|
102
102
|
@user.facebook_handle.blank?.should be_true
|
103
103
|
@user.googleplus_handle.blank?.should be_true
|
104
|
-
post :update, uid: @user.
|
105
|
-
response.should redirect_to(profile_path(@user.
|
104
|
+
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))
|
106
106
|
flash[:notice].should include("Your profile has been updated")
|
107
|
-
u = User.
|
107
|
+
u = User.find_by_user_key(@user.user_key)
|
108
108
|
u.twitter_handle.should == 'twit'
|
109
109
|
u.facebook_handle.should == 'face'
|
110
110
|
u.googleplus_handle.should == 'goo'
|
@@ -116,44 +116,44 @@ describe UsersController do
|
|
116
116
|
end
|
117
117
|
it "should follow another user if not already following, and log an event" do
|
118
118
|
@user.following?(@another_user).should be_false
|
119
|
-
Resque.expects(:enqueue).with(UserFollowEventJob, @user.
|
120
|
-
post :follow, uid: @another_user.
|
121
|
-
response.should redirect_to(profile_path(@another_user.
|
122
|
-
flash[:notice].should include("You are following #{@another_user.
|
119
|
+
Resque.expects(:enqueue).with(UserFollowEventJob, @user.user_key, @another_user.user_key).once
|
120
|
+
post :follow, uid: @another_user.user_key
|
121
|
+
response.should redirect_to(@routes.url_helpers.profile_path(@another_user.user_key))
|
122
|
+
flash[:notice].should include("You are following #{@another_user.user_key}")
|
123
123
|
end
|
124
124
|
it "should redirect to profile if already following and not log an event" do
|
125
125
|
User.any_instance.stubs(:following?).with(@another_user).returns(true)
|
126
|
-
Resque.expects(:enqueue).with(UserFollowEventJob, @user.
|
127
|
-
post :follow, uid: @another_user.
|
128
|
-
response.should redirect_to(profile_path(@another_user.
|
129
|
-
flash[:notice].should include("You are following #{@another_user.
|
126
|
+
Resque.expects(:enqueue).with(UserFollowEventJob, @user.user_key, @another_user.user_key).never
|
127
|
+
post :follow, uid: @another_user.user_key
|
128
|
+
response.should redirect_to(@routes.url_helpers.profile_path(@another_user.user_key))
|
129
|
+
flash[:notice].should include("You are following #{@another_user.user_key}")
|
130
130
|
end
|
131
131
|
it "should redirect to profile if user attempts to self-follow and not log an event" do
|
132
|
-
Resque.expects(:enqueue).with(UserFollowEventJob, @user.
|
133
|
-
post :follow, uid: @user.
|
134
|
-
response.should redirect_to(profile_path(@user.
|
132
|
+
Resque.expects(:enqueue).with(UserFollowEventJob, @user.user_key, @user.user_key).never
|
133
|
+
post :follow, uid: @user.user_key
|
134
|
+
response.should redirect_to(@routes.url_helpers.profile_path(@user.user_key))
|
135
135
|
flash[:alert].should include("You cannot follow or unfollow yourself")
|
136
136
|
end
|
137
137
|
end
|
138
138
|
describe "#unfollow" do
|
139
139
|
it "should unfollow another user if already following, and log an event" do
|
140
140
|
User.any_instance.stubs(:following?).with(@another_user).returns(true)
|
141
|
-
Resque.expects(:enqueue).with(UserUnfollowEventJob, @user.
|
142
|
-
post :unfollow, uid: @another_user.
|
143
|
-
response.should redirect_to(profile_path(@another_user.
|
144
|
-
flash[:notice].should include("You are no longer following #{@another_user.
|
141
|
+
Resque.expects(:enqueue).with(UserUnfollowEventJob, @user.user_key, @another_user.user_key).once
|
142
|
+
post :unfollow, uid: @another_user.user_key
|
143
|
+
response.should redirect_to(@routes.url_helpers.profile_path(@another_user.user_key))
|
144
|
+
flash[:notice].should include("You are no longer following #{@another_user.user_key}")
|
145
145
|
end
|
146
146
|
it "should redirect to profile if not following and not log an event" do
|
147
147
|
@user.stubs(:following?).with(@another_user).returns(false)
|
148
|
-
Resque.expects(:enqueue).with(UserUnfollowEventJob, @user.
|
149
|
-
post :unfollow, uid: @another_user.
|
150
|
-
response.should redirect_to(profile_path(@another_user.
|
151
|
-
flash[:notice].should include("You are no longer following #{@another_user.
|
148
|
+
Resque.expects(:enqueue).with(UserUnfollowEventJob, @user.user_key, @another_user.user_key).never
|
149
|
+
post :unfollow, uid: @another_user.user_key
|
150
|
+
response.should redirect_to(@routes.url_helpers.profile_path(@another_user.user_key))
|
151
|
+
flash[:notice].should include("You are no longer following #{@another_user.user_key}")
|
152
152
|
end
|
153
153
|
it "should redirect to profile if user attempts to self-follow and not log an event" do
|
154
|
-
Resque.expects(:enqueue).with(UserUnfollowEventJob, @user.
|
155
|
-
post :unfollow, uid: @user.
|
156
|
-
response.should redirect_to(profile_path(@user.
|
154
|
+
Resque.expects(:enqueue).with(UserUnfollowEventJob, @user.user_key, @user.user_key).never
|
155
|
+
post :unfollow, uid: @user.user_key
|
156
|
+
response.should redirect_to(@routes.url_helpers.profile_path(@user.user_key))
|
157
157
|
flash[:alert].should include("You cannot follow or unfollow yourself")
|
158
158
|
end
|
159
159
|
end
|
@@ -14,15 +14,18 @@
|
|
14
14
|
|
15
15
|
FactoryGirl.define do
|
16
16
|
factory :user, :class => User do |u|
|
17
|
-
|
17
|
+
email 'jilluser@example.com'
|
18
|
+
password 'password'
|
18
19
|
end
|
19
20
|
|
20
21
|
factory :archivist, :class => User do |u|
|
21
|
-
|
22
|
+
email 'archivist1@example.com'
|
23
|
+
password 'password'
|
22
24
|
end
|
23
25
|
|
24
26
|
factory :curator, :class => User do |u|
|
25
|
-
|
27
|
+
email 'curator1@example.com'
|
28
|
+
password 'password'
|
26
29
|
end
|
27
30
|
end
|
28
31
|
|
@@ -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
|
24
|
+
<foxml:contentLocation REF="file:<%=@localDir%>/scholarsphere/scholarsphere_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">
|
@@ -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
|
52
|
+
<foxml:contentLocation REF="file:<%=@localDir%>/scholarsphere/scholarsphere_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">
|
@@ -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
|
24
|
+
<foxml:contentLocation REF="file:<%=@localDir%>/scholarsphere/scholarsphere_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">
|
@@ -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
|
53
|
+
<foxml:contentLocation REF="file:<%=@localDir%>/scholarsphere/scholarsphere_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">
|
@@ -32,7 +32,7 @@
|
|
32
32
|
|
33
33
|
<foxml:datastream CONTROL_GROUP="M" ID="descMetadata" STATE="A" VERSIONABLE="true">
|
34
34
|
<foxml:datastreamVersion ID="descMetadata.0" LABEL="" MIMETYPE="text/plain">
|
35
|
-
<foxml:contentLocation REF="file
|
35
|
+
<foxml:contentLocation REF="file:<%=@localDir%>/scholarsphere/scholarsphere_test4.descMeta.txt" TYPE="URL"/>
|
36
36
|
</foxml:datastreamVersion>
|
37
37
|
</foxml:datastream>
|
38
38
|
<foxml:datastream CONTROL_GROUP="X" ID="RELS-EXT" STATE="A" 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 PDF"
|
52
52
|
MIMETYPE="application/pdf" SIZE="25">
|
53
|
-
<foxml:contentLocation REF="file
|
53
|
+
<foxml:contentLocation REF="file:<%=@localDir%>/scholarsphere/scholarsphere_test4.pdf" TYPE="URL"/>
|
54
54
|
</foxml:datastreamVersion>
|
55
55
|
</foxml:datastream>
|
56
56
|
<foxml:datastream CONTROL_GROUP="X" ID="rightsMetadata" STATE="A" VERSIONABLE="true">
|
@@ -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
|
24
|
+
<foxml:contentLocation REF="file:<%=@localDir%>/scholarsphere/scholarsphere_test6.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">
|
@@ -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="image/jpeg">
|
52
|
-
<foxml:contentLocation REF="file
|
52
|
+
<foxml:contentLocation REF="file:<%=@localDir%>/scholarsphere/scholarsphere_test6.jp2" TYPE="URL"/>
|
53
53
|
</foxml:datastreamVersion>
|
54
54
|
</foxml:datastream>
|
55
55
|
<foxml:datastream CONTROL_GROUP="X" ID="rightsMetadata" STATE="A" VERSIONABLE="true">
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<info:fedora/scholarsphere:scholarsphere1> <http://purl.org/dc/terms/publisher> "archivist1" .
|
2
|
+
<info:fedora/scholarsphere:scholarsphere1> <http://purl.org/dc/terms/description> "scholarsphere test Description" .
|
3
|
+
<info:fedora/scholarsphere:scholarsphere1> <http://purl.org/dc/terms/created> "11/16/2012" .
|
4
|
+
<info:fedora/scholarsphere:scholarsphere1> <http://purl.org/dc/terms/contributor> "archivist1" .
|
5
|
+
<info:fedora/scholarsphere:scholarsphere1> <http://purl.org/dc/terms/title> "scholarsphere test" .
|
6
|
+
<info:fedora/scholarsphere:scholarsphere1> <http://purl.org/dc/terms/relation> "test" .
|
7
|
+
<info:fedora/scholarsphere:scholarsphere1> <http://purl.org/dc/terms/subject> "scholarsphere test Test" .
|
8
|
+
<info:fedora/scholarsphere:scholarsphere1> <http://purl.org/dc/terms/language> "En" .
|
9
|
+
<info:fedora/scholarsphere:scholarsphere1> <http://xmlns.com/foaf/0.1/based_near> "State College" .
|
10
|
+
<info:fedora/scholarsphere:scholarsphere1> <http://purl.org/dc/terms/rights> "archivist1" .
|
11
|
+
<info:fedora/scholarsphere:scholarsphere1> <http://purl.org/dc/terms/creator> "archivist1" .
|
12
|
+
<info:fedora/scholarsphere:scholarsphere1> <http://purl.org/dc/terms/identifier> "Test" .
|
@@ -0,0 +1,79 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<foxml:digitalObject PID="sufia:scholarsphere1" VERSION="1.1" xmlns:foxml="info:fedora/fedora-system:def/foxml#"
|
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
|
+
<foxml:objectProperties>
|
5
|
+
<foxml:property NAME="info:fedora/fedora-system:def/model#state" VALUE="Active"/>
|
6
|
+
<foxml:property NAME="info:fedora/fedora-system:def/model#label" VALUE="scholarsphere test"/>
|
7
|
+
<foxml:property NAME="info:fedora/fedora-system:def/model#ownerId" VALUE="fedoraAdmin"/>
|
8
|
+
</foxml:objectProperties>
|
9
|
+
<foxml:datastream CONTROL_GROUP="X" ID="DC" STATE="A" VERSIONABLE="true">
|
10
|
+
<foxml:datastreamVersion FORMAT_URI="http://www.openarchives.org/OAI/2.0/oai_dc/"
|
11
|
+
ID="DC1.0" LABEL="Dublin Core Record for this object" MIMETYPE="text/xml">
|
12
|
+
<foxml:xmlContent>
|
13
|
+
<oai_dc:dc xmlns:dc="http://purl.org/dc/elements/1.1/"
|
14
|
+
xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/"
|
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
|
+
<dc:title>scholarsphere test</dc:title>
|
17
|
+
<dc:identifier>sufia:scholarsphere1</dc:identifier>
|
18
|
+
</oai_dc:dc>
|
19
|
+
</foxml:xmlContent>
|
20
|
+
</foxml:datastreamVersion>
|
21
|
+
</foxml:datastream>
|
22
|
+
<foxml:datastream CONTROL_GROUP="M" ID="descMetadata" STATE="A" VERSIONABLE="true">
|
23
|
+
<foxml:datastreamVersion ID="descMetadata.0" LABEL="" MIMETYPE="text/plain">
|
24
|
+
<foxml:contentLocation REF="file:<%=@localDir%>/scholarsphere/sufia_scholarsphere1.descMeta.txt" TYPE="URL"/>
|
25
|
+
</foxml:datastreamVersion>
|
26
|
+
</foxml:datastream>
|
27
|
+
<foxml:datastream CONTROL_GROUP="X" ID="RELS-EXT" STATE="A" VERSIONABLE="true">
|
28
|
+
<foxml:datastreamVersion ID="RELS-EXT.0"
|
29
|
+
LABEL="Fedora Object-to-Object Relationship Metadata" MIMETYPE="application/rdf+xml">
|
30
|
+
<foxml:xmlContent>
|
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/sufia:scholarsphere1">
|
33
|
+
<ns0:hasModel rdf:resource="info:fedora/afmodel:GenericFile"/>
|
34
|
+
</rdf:Description>
|
35
|
+
</rdf:RDF>
|
36
|
+
</foxml:xmlContent>
|
37
|
+
</foxml:datastreamVersion>
|
38
|
+
</foxml:datastream>
|
39
|
+
<foxml:datastream CONTROL_GROUP="M" ID="content" STATE="A" VERSIONABLE="true">
|
40
|
+
<foxml:datastreamVersion ID="content.0" LABEL="Test Data 1"
|
41
|
+
MIMETYPE="text/plain" >
|
42
|
+
<foxml:contentLocation REF="file:<%=@localDir%>/scholarsphere/sufia_scholarsphere1.txt" TYPE="URL"/>
|
43
|
+
</foxml:datastreamVersion>
|
44
|
+
</foxml:datastream>
|
45
|
+
<foxml:datastream CONTROL_GROUP="X" ID="rightsMetadata" STATE="A" VERSIONABLE="true">
|
46
|
+
<foxml:datastreamVersion CREATED="2012-04-06T13:41:37.093Z" ID="rightsMetadata.0" LABEL="" MIMETYPE="text/xml">
|
47
|
+
<foxml:xmlContent>
|
48
|
+
<rightsMetadata version="0.1" xmlns="http://hydra-collab.stanford.edu/schemas/rightsMetadata/v1">
|
49
|
+
<copyright>
|
50
|
+
<human/>
|
51
|
+
<machine>
|
52
|
+
<uvalicense>no</uvalicense>
|
53
|
+
</machine>
|
54
|
+
</copyright>
|
55
|
+
<access type="discover">
|
56
|
+
<human/>
|
57
|
+
<machine>
|
58
|
+
<group>public</group>
|
59
|
+
</machine>
|
60
|
+
</access>
|
61
|
+
<access type="read">
|
62
|
+
<human/>
|
63
|
+
<machine/>
|
64
|
+
</access>
|
65
|
+
<access type="edit">
|
66
|
+
<human/>
|
67
|
+
<machine>
|
68
|
+
<person>cam156@psu.edu</person>
|
69
|
+
</machine>
|
70
|
+
</access>
|
71
|
+
<embargo>
|
72
|
+
<human/>
|
73
|
+
<machine/>
|
74
|
+
</embargo>
|
75
|
+
</rightsMetadata>
|
76
|
+
</foxml:xmlContent>
|
77
|
+
</foxml:datastreamVersion>
|
78
|
+
</foxml:datastream>
|
79
|
+
</foxml:digitalObject>
|