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.
Files changed (169) hide show
  1. data/Gemfile +2 -5
  2. data/README.md +44 -12
  3. data/app/assets/javascripts/{scholarsphere.js → sufia.js} +0 -0
  4. data/app/assets/stylesheets/{scholarsphere.css → sufia.css} +0 -0
  5. data/app/controllers/batch_controller.rb +2 -3
  6. data/app/controllers/batch_edits_controller.rb +4 -4
  7. data/app/controllers/dashboard_controller.rb +5 -3
  8. data/app/controllers/generic_files_controller.rb +77 -41
  9. data/app/controllers/users_controller.rb +9 -21
  10. data/app/helpers/blacklight/render_constraints_helper_behavior.rb +2 -2
  11. data/app/helpers/sufia_helper.rb +23 -2
  12. data/app/models/datastreams/file_content_datastream.rb +17 -9
  13. data/app/models/generic_file.rb +1 -809
  14. data/app/views/_add_assets_links.html.erb +1 -1
  15. data/app/views/_user_util_links.html.erb +2 -2
  16. data/app/views/batch/_metadata.html.erb +16 -16
  17. data/app/views/batch/edit.html.erb +16 -10
  18. data/app/views/batch_edits/_metadata.html.erb +16 -16
  19. data/app/views/catalog/_index_partials/_list_files.html.erb +2 -2
  20. data/app/views/catalog/index.html.erb +5 -0
  21. data/app/views/dashboard/_facet_limit.html.erb +1 -1
  22. data/app/views/dashboard/_facet_pagination.html.erb +4 -4
  23. data/app/views/dashboard/_facet_selected.html.erb +1 -1
  24. data/app/views/dashboard/_index_partials/_list_files.html.erb +8 -8
  25. data/app/views/dashboard/_search_form.html.erb +1 -1
  26. data/app/views/dashboard/_sort_and_per_page.html.erb +1 -1
  27. data/app/views/dashboard/index.html.erb +0 -1
  28. data/app/views/generic_files/_breadcrumbs.html.erb +1 -1
  29. data/app/views/generic_files/_descriptions.html.erb +3 -3
  30. data/app/views/generic_files/_field_form +3 -3
  31. data/app/views/generic_files/_media_display.html.erb +5 -4
  32. data/app/views/generic_files/_permission.html.erb +5 -5
  33. data/app/views/generic_files/_versioning.html.erb +1 -1
  34. data/app/views/generic_files/edit.html.erb +2 -2
  35. data/app/views/generic_files/show.html.erb +3 -3
  36. data/app/views/static/versions.html.erb +1 -1
  37. data/app/views/users/edit.html.erb +5 -3
  38. data/app/views/users/index.html.erb +3 -3
  39. data/app/views/users/show.html.erb +6 -6
  40. data/config/jetty.yml +6 -0
  41. data/config/routes.rb +8 -4
  42. data/features/browse_dashboard_files.feature +11 -1
  43. data/features/browse_files.feature +6 -5
  44. data/features/contact_form.feature +4 -0
  45. data/features/display_dashboard.feature +6 -3
  46. data/features/ingest_upload_files.feature +2 -2
  47. data/features/step_definitions/fixture_steps.rb +6 -5
  48. data/features/step_definitions/scholarsphere.rb +24 -1
  49. data/features/step_definitions/user_steps.rb +2 -2
  50. data/features/step_definitions/web_steps.rb +1 -1
  51. data/features/support/env.rb +26 -0
  52. data/features/users.feature +18 -0
  53. data/lib/active_support/core_ext/marshal.rb +22 -0
  54. data/lib/generators/sufia/sufia_generator.rb +18 -2
  55. data/lib/generators/sufia/templates/catalog_controller.rb +3 -4
  56. data/{spec/support → lib/generators/sufia/templates}/config/redis.yml +0 -0
  57. data/lib/generators/sufia/templates/config/sufia.rb +68 -0
  58. data/lib/generators/sufia/templates/migrations/add_ldap_attrs_to_user.rb +41 -0
  59. data/lib/kaminari/helpers/tag.rb +11 -0
  60. data/lib/sufia.rb +30 -7
  61. data/lib/sufia/controller.rb +1 -5
  62. data/lib/sufia/generic_file.rb +200 -0
  63. data/lib/sufia/generic_file/audit.rb +119 -0
  64. data/lib/sufia/generic_file/characterization.rb +82 -0
  65. data/lib/sufia/generic_file/export.rb +339 -0
  66. data/lib/sufia/generic_file/permissions.rb +64 -0
  67. data/lib/sufia/generic_file/thumbnail.rb +68 -0
  68. data/{app/models → lib/sufia/jobs}/audit_job.rb +13 -3
  69. data/lib/sufia/jobs/batch_update_job.rb +86 -0
  70. data/lib/sufia/jobs/characterize_job.rb +35 -0
  71. data/{app/models → lib/sufia/jobs}/content_delete_event_job.rb +3 -1
  72. data/{app/models → lib/sufia/jobs}/content_deposit_event_job.rb +1 -1
  73. data/{app/models → lib/sufia/jobs}/content_new_version_event_job.rb +1 -1
  74. data/{app/models → lib/sufia/jobs}/content_restored_version_event_job.rb +8 -0
  75. data/{app/models → lib/sufia/jobs}/content_update_event_job.rb +1 -1
  76. data/{app/models → lib/sufia/jobs}/event_job.rb +7 -3
  77. data/{app/models → lib/sufia/jobs}/resolrize_job.rb +4 -2
  78. data/lib/sufia/jobs/transcode_video_job.rb +79 -0
  79. data/{app/models → lib/sufia/jobs}/unzip_job.rb +11 -3
  80. data/{app/models → lib/sufia/jobs}/user_edit_profile_event_job.rb +6 -0
  81. data/{app/models → lib/sufia/jobs}/user_follow_event_job.rb +9 -4
  82. data/{app/models → lib/sufia/jobs}/user_unfollow_event_job.rb +6 -0
  83. data/lib/sufia/queue/resque.rb +30 -0
  84. data/lib/sufia/role_mapper.rb +0 -1
  85. data/{app/models/characterize_job.rb → lib/sufia/solr_document_behavior.rb} +6 -7
  86. data/lib/sufia/user.rb +3 -3
  87. data/lib/sufia/version.rb +1 -1
  88. data/lib/tasks/fixtures.rake +38 -38
  89. data/lib/tasks/resque.rake +1 -0
  90. data/solr_conf/conf/solrconfig.xml +32 -1615
  91. data/solr_conf/solr.xml +1 -1
  92. data/spec/active_fedora/unsaved_digital_object_spec.rb +4 -4
  93. data/spec/config/host_to_vhost_spec.rb +4 -4
  94. data/spec/controllers/authorities_controller_spec.rb +1 -1
  95. data/spec/controllers/batch_controller_spec.rb +12 -10
  96. data/spec/controllers/catalog_controller_spec.rb +13 -13
  97. data/spec/controllers/dashboard_controller_spec.rb +15 -15
  98. data/spec/controllers/downloads_controller_spec.rb +14 -14
  99. data/spec/controllers/generic_files_controller_spec.rb +88 -46
  100. data/spec/controllers/mailbox_controller_spec.rb +2 -2
  101. data/spec/controllers/sessions_controller_spec.rb +1 -1
  102. data/spec/controllers/single_use_link_controller_spec.rb +18 -18
  103. data/spec/controllers/users_controller_spec.rb +47 -31
  104. data/spec/fixtures/countdown.avi +0 -0
  105. data/spec/fixtures/sufia/.gitignore +1 -0
  106. data/spec/fixtures/{scholarsphere → sufia}/bg_header.jpg +0 -0
  107. data/spec/fixtures/sufia/sufia_test1.descMeta.txt +12 -0
  108. data/spec/fixtures/{scholarsphere → sufia}/sufia_test1.foxml.erb +2 -2
  109. data/spec/fixtures/{scholarsphere/scholarsphere_test1.txt → sufia/sufia_test1.txt} +0 -0
  110. data/spec/fixtures/sufia/sufia_test2.descMeta.txt +12 -0
  111. data/spec/fixtures/{scholarsphere/scholarsphere_test2.docx → sufia/sufia_test2.docx} +0 -0
  112. data/spec/fixtures/{scholarsphere/scholarsphere_test2.foxml.erb → sufia/sufia_test2.foxml.erb} +6 -6
  113. data/spec/fixtures/sufia/sufia_test3.descMeta.txt +12 -0
  114. data/spec/fixtures/{scholarsphere/scholarsphere_test3.foxml.erb → sufia/sufia_test3.foxml.erb} +6 -6
  115. data/spec/fixtures/{scholarsphere/scholarsphere_test3.xls → sufia/sufia_test3.xls} +0 -0
  116. data/spec/fixtures/sufia/sufia_test4.descMeta.txt +12 -0
  117. data/spec/fixtures/{scholarsphere/scholarsphere_test4.foxml.erb → sufia/sufia_test4.foxml.erb} +6 -6
  118. data/spec/fixtures/{scholarsphere/scholarsphere_test4.pdf → sufia/sufia_test4.pdf} +0 -0
  119. data/spec/fixtures/sufia/sufia_test5.descMeta.txt +19 -0
  120. data/spec/fixtures/{scholarsphere → sufia}/sufia_test5.foxml.erb +3 -3
  121. data/spec/fixtures/{scholarsphere/scholarsphere_test5.mp3 → sufia/sufia_test5.mp3} +0 -0
  122. data/spec/fixtures/sufia/sufia_test5.txt +1 -0
  123. data/spec/fixtures/sufia/sufia_test6.descMeta.txt +12 -0
  124. data/spec/fixtures/{scholarsphere/scholarsphere_test6.foxml.erb → sufia/sufia_test6.foxml.erb} +6 -6
  125. data/spec/fixtures/{scholarsphere/scholarsphere_test6.jp2 → sufia/sufia_test6.jp2} +0 -0
  126. data/spec/fixtures/sufia/sufia_test6.txt +1 -0
  127. data/spec/fixtures/sufia_generic_stub.descMeta.txt +12 -0
  128. data/spec/fixtures/{scholarsphere_generic_stub.foxml.erb → sufia_generic_stub.foxml.erb} +3 -3
  129. data/spec/fixtures/sufia_generic_stub.txt +1 -0
  130. data/spec/lib/sufia/role_mapper_spec.rb +1 -1
  131. data/spec/models/audit_job_spec.rb +8 -11
  132. data/spec/models/batch_spec.rb +5 -5
  133. data/spec/models/batch_update_job_spec.rb +18 -15
  134. data/spec/models/checksum_audit_log_spec.rb +6 -19
  135. data/spec/models/event_jobs_spec.rb +23 -23
  136. data/spec/models/file_content_datastream_spec.rb +14 -14
  137. data/spec/models/fits_datastream_spec.rb +1 -1
  138. data/spec/models/generic_file_spec.rb +88 -41
  139. data/spec/models/single_use_link_spec.rb +3 -3
  140. data/spec/models/transcode_video_job_spec.rb +30 -0
  141. data/spec/models/unzip_job_spec.rb +6 -4
  142. data/spec/rake/{scholarsphere_fixtures_spec.rb → sufia_fixtures_spec.rb} +16 -16
  143. data/spec/routing/route_spec.rb +4 -8
  144. data/spec/spec_helper.rb +0 -7
  145. data/spec/support/Gemfile +4 -2
  146. data/spec/support/fedora_conf/fedora.fcfg +953 -0
  147. data/spec/support/lib/generators/test_app_generator.rb +1 -11
  148. data/sufia.gemspec +5 -3
  149. data/tasks/{scholarsphere-db.rake → sufia-db.rake} +1 -1
  150. data/tasks/{scholarsphere-dev.rake → sufia-dev.rake} +7 -3
  151. data/tasks/{scholarsphere-fixtures.rake → sufia-fixtures.rake} +43 -43
  152. data/tasks/{scholarsphere.rake → sufia.rake} +2 -2
  153. metadata +126 -95
  154. data/app/models/batch_update_job.rb +0 -82
  155. data/app/models/solr_document.rb +0 -50
  156. data/lib/sufia/permissions.rb +0 -43
  157. data/spec/fixtures/scholarsphere/scholarsphere_test1.descMeta.txt +0 -12
  158. data/spec/fixtures/scholarsphere/scholarsphere_test2.descMeta.txt +0 -12
  159. data/spec/fixtures/scholarsphere/scholarsphere_test3.descMeta.txt +0 -12
  160. data/spec/fixtures/scholarsphere/scholarsphere_test4.descMeta.txt +0 -12
  161. data/spec/fixtures/scholarsphere/scholarsphere_test5.descMeta.txt +0 -19
  162. data/spec/fixtures/scholarsphere/scholarsphere_test5.txt +0 -1
  163. data/spec/fixtures/scholarsphere/scholarsphere_test6.descMeta.txt +0 -12
  164. data/spec/fixtures/scholarsphere/scholarsphere_test6.txt +0 -1
  165. data/spec/fixtures/scholarsphere/sufia_scholarsphere1.descMeta.txt +0 -12
  166. data/spec/fixtures/scholarsphere/sufia_scholarsphere1.foxml.erb +0 -79
  167. data/spec/fixtures/scholarsphere/sufia_scholarsphere1.txt +0 -1
  168. data/spec/fixtures/scholarsphere_generic_stub.descMeta.txt +0 -12
  169. data/spec/fixtures/scholarsphere_generic_stub.txt +0 -1
@@ -0,0 +1,12 @@
1
+ <info:fedora/sufia:test4> <http://purl.org/dc/terms/publisher> "archivist1" .
2
+ <info:fedora/sufia:test4> <http://purl.org/dc/terms/description> "Test Document PDF Description" .
3
+ <info:fedora/sufia:test4> <http://purl.org/dc/terms/created> "4/11/2012" .
4
+ <info:fedora/sufia:test4> <http://purl.org/dc/terms/contributor> "archivist1" .
5
+ <info:fedora/sufia:test4> <http://purl.org/dc/terms/title> "Test Document PDF" .
6
+ <info:fedora/sufia:test4> <http://purl.org/dc/terms/relation> "test" .
7
+ <info:fedora/sufia:test4> <http://purl.org/dc/terms/subject> "PDF Test" .
8
+ <info:fedora/sufia:test4> <http://purl.org/dc/terms/language> "En" .
9
+ <info:fedora/sufia:test4> <http://xmlns.com/foaf/0.1/based_near> "State College" .
10
+ <info:fedora/sufia:test4> <http://purl.org/dc/terms/rights> "archivist1@example.com" .
11
+ <info:fedora/sufia:test4> <http://purl.org/dc/terms/creator> "archivist1@example.com" .
12
+ <info:fedora/sufia:test4> <http://purl.org/dc/terms/identifier> "Test" .
@@ -1,5 +1,5 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
- <foxml:digitalObject PID="scholarsphere:test4" VERSION="1.1" xmlns:foxml="info:fedora/fedora-system:def/foxml#"
2
+ <foxml:digitalObject PID="sufia:test4" 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,7 +14,7 @@
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 PDF</dc:title>
17
- <dc:identifier>scholarsphere:test4</dc:identifier>
17
+ <dc:identifier>sufia:test4</dc:identifier>
18
18
  </oai_dc:dc>
19
19
  </foxml:xmlContent>
20
20
  </foxml:datastreamVersion>
@@ -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:<%=@localDir%>/scholarsphere/scholarsphere_test4.descMeta.txt" TYPE="URL"/>
35
+ <foxml:contentLocation REF="file:<%=@localDir%>/sufia/sufia_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">
@@ -40,7 +40,7 @@
40
40
  LABEL="Fedora Object-to-Object Relationship Metadata" MIMETYPE="application/rdf+xml" SIZE="286">
41
41
  <foxml:xmlContent>
42
42
  <rdf:RDF xmlns:ns0="info:fedora/fedora-system:def/model#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
43
- <rdf:Description rdf:about="info:fedora/scholarsphere:test4">
43
+ <rdf:Description rdf:about="info:fedora/sufia:test4">
44
44
  <ns0:hasModel rdf:resource="info:fedora/afmodel:GenericFile"/>
45
45
  </rdf:Description>
46
46
  </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 PDF"
52
52
  MIMETYPE="application/pdf" SIZE="25">
53
- <foxml:contentLocation REF="file:<%=@localDir%>/scholarsphere/scholarsphere_test4.pdf" TYPE="URL"/>
53
+ <foxml:contentLocation REF="file:<%=@localDir%>/sufia/sufia_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">
@@ -77,7 +77,7 @@
77
77
  <access type="edit">
78
78
  <human/>
79
79
  <machine>
80
- <person>archivist1</person>
80
+ <person>archivist1@example.com</person>
81
81
  </machine>
82
82
  </access>
83
83
  <embargo>
@@ -0,0 +1,19 @@
1
+ <info:fedora/sufia:test5> <http://purl.org/dc/terms/publisher> "archivist1" .
2
+ <info:fedora/sufia:test5> <http://purl.org/dc/terms/description> "Test mp3 Description" .
3
+ <info:fedora/sufia:test5> <http://purl.org/dc/terms/created> "04/11/2012" .
4
+ <info:fedora/sufia:test5> <http://purl.org/dc/terms/contributor> "archivist1" .
5
+ <info:fedora/sufia:test5> <http://purl.org/dc/terms/title> "Test mp3" .
6
+ <info:fedora/sufia:test5> <http://purl.org/dc/terms/relation> "test" .
7
+ <info:fedora/sufia:test5> <http://purl.org/dc/terms/relation> "keya" .
8
+ <info:fedora/sufia:test5> <http://purl.org/dc/terms/relation> "keyb" .
9
+ <info:fedora/sufia:test5> <http://purl.org/dc/terms/relation> "keyc" .
10
+ <info:fedora/sufia:test5> <http://purl.org/dc/terms/relation> "keyd" .
11
+ <info:fedora/sufia:test5> <http://purl.org/dc/terms/relation> "keye" .
12
+ <info:fedora/sufia:test5> <http://purl.org/dc/terms/relation> "keyf" .
13
+ <info:fedora/sufia:test5> <http://purl.org/dc/terms/relation> "keyg" .
14
+ <info:fedora/sufia:test5> <http://purl.org/dc/terms/subject> "Test mp3 Test" .
15
+ <info:fedora/sufia:test5> <http://purl.org/dc/terms/language> "En" .
16
+ <info:fedora/sufia:test5> <http://xmlns.com/foaf/0.1/based_near> "State College" .
17
+ <info:fedora/sufia:test5> <http://purl.org/dc/terms/rights> "archivist2@example.com" .
18
+ <info:fedora/sufia:test5> <http://purl.org/dc/terms/creator> "archivist1@example.com" .
19
+ <info:fedora/sufia:test5> <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%>/scholarsphere/scholarsphere_test5.descMeta.txt" TYPE="URL"/>
24
+ <foxml:contentLocation REF="file:<%=@localDir%>/sufia/sufia_test5.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="audio/mpeg3" SIZE="25">
53
- <foxml:contentLocation REF="file:<%=@localDir%>/scholarsphere/scholarsphere_test5.mp3" TYPE="URL"/>
53
+ <foxml:contentLocation REF="file:<%=@localDir%>/sufia/sufia_test5.mp3" TYPE="URL"/>
54
54
  </foxml:datastreamVersion>
55
55
  </foxml:datastream>
56
56
  <foxml:datastream CONTROL_GROUP="X" ID="rightsMetadata" STATE="A" VERSIONABLE="true">
@@ -76,7 +76,7 @@
76
76
  <access type="edit">
77
77
  <human/>
78
78
  <machine>
79
- <person>archivist2</person>
79
+ <person>archivist2@example.com</person>
80
80
  </machine>
81
81
  </access>
82
82
  <embargo>
@@ -0,0 +1 @@
1
+ This is a test fixture for sufia: test5.
@@ -0,0 +1,12 @@
1
+ <info:fedora/sufia:test6> <http://purl.org/dc/terms/publisher> "archivist1" .
2
+ <info:fedora/sufia:test6> <http://purl.org/dc/terms/description> "Test Image Description" .
3
+ <info:fedora/sufia:test6> <http://purl.org/dc/terms/created> "06/11/2012" .
4
+ <info:fedora/sufia:test6> <http://purl.org/dc/terms/contributor> "archivist1" .
5
+ <info:fedora/sufia:test6> <http://purl.org/dc/terms/title> "Test Image" .
6
+ <info:fedora/sufia:test6> <http://purl.org/dc/terms/relation> "test" .
7
+ <info:fedora/sufia:test6> <http://purl.org/dc/terms/subject> "Test Image Test" .
8
+ <info:fedora/sufia:test6> <http://purl.org/dc/terms/language> "En" .
9
+ <info:fedora/sufia:test6> <http://xmlns.com/foaf/0.1/based_near> "State College" .
10
+ <info:fedora/sufia:test6> <http://purl.org/dc/terms/rights> "archivist1@example.com" .
11
+ <info:fedora/sufia:test6> <http://purl.org/dc/terms/creator> "archivist1@example.com" .
12
+ <info:fedora/sufia:test6> <http://purl.org/dc/terms/identifier> "Test" .
@@ -1,5 +1,5 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
- <foxml:digitalObject PID="scholarsphere:test6" VERSION="1.1" xmlns:foxml="info:fedora/fedora-system:def/foxml#"
2
+ <foxml:digitalObject PID="sufia:test6" 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 Image</dc:title>
17
- <dc:identifier>scholarsphere:test6</dc:identifier>
17
+ <dc:identifier>sufia:test6</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%>/scholarsphere/scholarsphere_test6.descMeta.txt" TYPE="URL"/>
24
+ <foxml:contentLocation REF="file:<%=@localDir%>/sufia/sufia_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">
@@ -39,7 +39,7 @@
39
39
  LABEL="Fedora Object-to-Object Relationship Metadata" MIMETYPE="application/rdf+xml" SIZE="286">
40
40
  <foxml:xmlContent>
41
41
  <rdf:RDF xmlns:ns0="info:fedora/fedora-system:def/model#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
42
- <rdf:Description rdf:about="info:fedora/scholarsphere:test6">
42
+ <rdf:Description rdf:about="info:fedora/sufia:test6">
43
43
  <ns0:hasModel rdf:resource="info:fedora/afmodel:GenericFile"/>
44
44
  </rdf:Description>
45
45
  </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="image/jpeg">
52
- <foxml:contentLocation REF="file:<%=@localDir%>/scholarsphere/scholarsphere_test6.jp2" TYPE="URL"/>
52
+ <foxml:contentLocation REF="file:<%=@localDir%>/sufia/sufia_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">
@@ -75,7 +75,7 @@
75
75
  <access type="edit">
76
76
  <human/>
77
77
  <machine>
78
- <person>archivist1</person>
78
+ <person>archivist1@example.com</person>
79
79
  </machine>
80
80
  </access>
81
81
  <embargo>
@@ -0,0 +1 @@
1
+ This is a test fixture for sufia: test6.
@@ -0,0 +1,12 @@
1
+ <info:fedora/sufia:<%= @id %>> <http://purl.org/dc/terms/publisher> "<%= @user %>" .
2
+ <info:fedora/sufia:<%= @id %>> <http://purl.org/dc/terms/description> "<%= @title %> Description" .
3
+ <info:fedora/sufia:<%= @id %>> <http://purl.org/dc/terms/created> "<%= Time.now.strftime("%m/%d/%Y") %>" .
4
+ <info:fedora/sufia:<%= @id %>> <http://purl.org/dc/terms/contributor> "<%= @user %>" .
5
+ <info:fedora/sufia:<%= @id %>> <http://purl.org/dc/terms/title> "<%= @title %>" .
6
+ <info:fedora/sufia:<%= @id %>> <http://purl.org/dc/terms/relation> "test" .
7
+ <info:fedora/sufia:<%= @id %>> <http://purl.org/dc/terms/subject> "<%= @title %> Test" .
8
+ <info:fedora/sufia:<%= @id %>> <http://purl.org/dc/terms/language> "En" .
9
+ <info:fedora/sufia:<%= @id %>> <http://xmlns.com/foaf/0.1/based_near> "State College" .
10
+ <info:fedora/sufia:<%= @id %>> <http://purl.org/dc/terms/rights> "<%= @user %>" .
11
+ <info:fedora/sufia:<%= @id %>> <http://purl.org/dc/terms/creator> "<%= @user %>" .
12
+ <info:fedora/sufia:<%= @id %>> <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:<%=@root%>/scholarsphere/<%=SUFIA_TEST_NS%>_<%= @id %>.descMeta.txt" TYPE="URL"/>
24
+ <foxml:contentLocation REF="file:<%=@root%>/sufia/<%=SUFIA_TEST_NS%>_<%= @id %>.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">
@@ -39,7 +39,7 @@
39
39
  <foxml:datastream CONTROL_GROUP="M" ID="content" STATE="A" VERSIONABLE="true">
40
40
  <foxml:datastreamVersion ID="content.0" LABEL="Test Data 1"
41
41
  MIMETYPE="text/plain" >
42
- <foxml:contentLocation REF="file:<%=@root%>/scholarsphere/<%=SUFIA_TEST_NS%>_<%= @id %>.txt" TYPE="URL"/>
42
+ <foxml:contentLocation REF="file:<%=@root%>/sufia/<%=SUFIA_TEST_NS%>_<%= @id %>.txt" TYPE="URL"/>
43
43
  </foxml:datastreamVersion>
44
44
  </foxml:datastream>
45
45
  <foxml:datastream CONTROL_GROUP="X" ID="rightsMetadata" STATE="A" VERSIONABLE="true">
@@ -65,7 +65,7 @@
65
65
  <access type="edit">
66
66
  <human/>
67
67
  <machine>
68
- <person>cam156@psu.edu</person>
68
+ <person>archivist1@example.com</person>
69
69
  </machine>
70
70
  </access>
71
71
  <embargo>
@@ -0,0 +1 @@
1
+ This is a test fixture for sufia: <%= @id %>.
@@ -17,7 +17,7 @@ require 'spec_helper'
17
17
  describe RoleMapper do
18
18
  before do
19
19
  @user = FactoryGirl.create(:user)
20
- User.any_instance.stubs(:groups).returns(["umg/up.dlt.gamma-ci", "umg/up.dlt.redmine"])
20
+ User.any_instance.stub(:groups).and_return(["umg/up.dlt.gamma-ci", "umg/up.dlt.redmine"])
21
21
  end
22
22
  subject {::RoleMapper.roles(@user.user_key)}
23
23
  it "should return LDAP groups" do
@@ -15,34 +15,31 @@
15
15
  require 'spec_helper'
16
16
 
17
17
  describe AuditJob do
18
- before(:all) do
18
+ before do
19
19
  @user = FactoryGirl.find_or_create(:user)
20
20
  @inbox = @user.mailbox.inbox
21
- GenericFile.any_instance.expects(:characterize_if_changed).yields
22
- GenericFile.any_instance.stubs(:terms_of_service).returns('1')
21
+ GenericFile.any_instance.should_receive(:characterize_if_changed).and_yield
22
+ GenericFile.any_instance.stub(:terms_of_service).and_return('1')
23
23
  @file = GenericFile.new
24
24
  @file.apply_depositor_metadata(@user.user_key)
25
25
  @file.save
26
26
  @ds = @file.datastreams.first
27
27
  end
28
- after(:all) do
29
- # clear any existing messages
30
- @inbox.each(&:delete)
31
- @user.delete
28
+ after do
32
29
  @file.delete
33
30
  end
34
31
  describe "passing audit" do
35
32
  it "should not send passing mail" do
36
- ActiveFedora::RelsExtDatastream.any_instance.stubs(:dsChecksumValid).returns(true)
37
- Resque.enqueue(AuditJob, @file.pid, @ds[0], @ds[1].versionID)
33
+ ActiveFedora::RelsExtDatastream.any_instance.stub(:dsChecksumValid).and_return(true)
34
+ AuditJob.new(@file.pid, @ds[0], @ds[1].versionID).run
38
35
  @inbox = @user.mailbox.inbox
39
36
  @inbox.count.should == 0
40
37
  end
41
38
  end
42
39
  describe "failing audit" do
43
40
  it "should send failing mail" do
44
- ActiveFedora::RelsExtDatastream.any_instance.stubs(:dsChecksumValid).returns(false)
45
- Resque.enqueue(AuditJob, @file.pid, @ds[0], @ds[1].versionID)
41
+ ActiveFedora::RelsExtDatastream.any_instance.stub(:dsChecksumValid).and_return(false)
42
+ AuditJob.new(@file.pid, @ds[0], @ds[1].versionID).run
46
43
  @inbox = @user.mailbox.inbox
47
44
  @inbox.count.should == 1
48
45
  @inbox.each { |msg| msg.last_message.subject.should == AuditJob::FAIL }
@@ -17,8 +17,8 @@ require 'spec_helper'
17
17
  describe Batch do
18
18
  before(:all) do
19
19
  @user = FactoryGirl.find_or_create(:user)
20
- GenericFile.any_instance.expects(:characterize_if_changed).yields
21
- GenericFile.any_instance.stubs(:terms_of_service).returns('1')
20
+ GenericFile.any_instance.should_receive(:characterize_if_changed).and_yield
21
+ GenericFile.any_instance.stub(:terms_of_service).and_return('1')
22
22
  @file = GenericFile.new
23
23
  @file.apply_depositor_metadata('mjg36')
24
24
  @file.save
@@ -51,7 +51,7 @@ describe Batch do
51
51
  end
52
52
  it "should be able to have more than one file" do
53
53
  # not sure why this is needed here too, but when the test runs alone it is not needed but when run in the group it is needed
54
- GenericFile.any_instance.stubs(:terms_of_service).returns('1')
54
+ GenericFile.any_instance.stub(:terms_of_service).and_return('1')
55
55
  #logger.info "before create"
56
56
  gf = GenericFile.new
57
57
  #logger.info "after create"
@@ -71,14 +71,14 @@ describe Batch do
71
71
  describe "find_or_create" do
72
72
  describe "when the object exists" do
73
73
  it "should find batch instead of creating" do
74
- Batch.expects(:create).never
74
+ Batch.should_receive(:create).never
75
75
  @b2 = Batch.find_or_create( @batch.pid)
76
76
  end
77
77
  end
78
78
  describe "when the object does not exist" do
79
79
  it "should create" do
80
80
  lambda {Batch.find("batch:123")}.should raise_error(ActiveFedora::ObjectNotFoundError)
81
- Batch.expects(:create).once.returns("the batch")
81
+ Batch.should_receive(:create).once.and_return("the batch")
82
82
  @b2 = Batch.find_or_create( "batch:123")
83
83
  @b2.should == "the batch"
84
84
  end
@@ -1,3 +1,4 @@
1
+ # encoding: UTF-8
1
2
  # Copyright © 2012 The Pennsylvania State University
2
3
  #
3
4
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -15,8 +16,8 @@
15
16
  require 'spec_helper'
16
17
 
17
18
  describe BatchUpdateJob do
18
- before(:all) do
19
- GenericFile.any_instance.stubs(:terms_of_service).returns('1')
19
+ before do
20
+ GenericFile.any_instance.stub(:terms_of_service).and_return('1')
20
21
  @user = FactoryGirl.find_or_create(:user)
21
22
  @batch = Batch.new
22
23
  @batch.save
@@ -27,19 +28,17 @@ describe BatchUpdateJob do
27
28
  @file2.apply_depositor_metadata('otherUser')
28
29
  @file2.save
29
30
  end
30
- after(:all) do
31
- # clear any existing messages
31
+ after do
32
32
  @batch.delete
33
- @user.delete
34
33
  @file.delete
35
34
  @file2.delete
36
35
  end
37
36
  describe "failing update" do
38
37
  it "should check permissions for each file before updating" do
39
- BatchUpdateJob.any_instance.stubs(:get_permissions_solr_response_for_doc_id).returns(["","mock solr permissions"])
40
- User.any_instance.expects(:can?).with(:edit, "mock solr permissions").times(2)
41
- params = {'generic_file' => {'terms_of_service' => '1', 'read_groups_string' => '', 'read_users_string' => 'archivist1, archivist2', 'tag' => ['']}, 'id' => @batch.pid, 'controller' => 'batch', 'action' => 'update'}
42
- BatchUpdateJob.perform(@user.user_key, params, params[:generic_file])
38
+ BatchUpdateJob.any_instance.stub(:get_permissions_solr_response_for_doc_id).and_return(["","mock solr permissions"])
39
+ User.any_instance.should_receive(:can?).with(:edit, "mock solr permissions").exactly(2).times
40
+ params = {'generic_file' => {'terms_of_service' => '1', 'read_groups_string' => '', 'read_users_string' => 'archivist1, archivist2', 'tag' => ['']}, 'id' => @batch.pid, 'controller' => 'batch', 'action' => 'update'}.with_indifferent_access
41
+ BatchUpdateJob.new(@user.user_key, params).run
43
42
  @user.mailbox.inbox[0].messages[0].subject.should == "Batch upload permission denied"
44
43
  @user.mailbox.inbox[0].messages[0].move_to_trash @user
45
44
  #b = Batch.find(@batch.pid)
@@ -47,12 +46,16 @@ describe BatchUpdateJob do
47
46
  end
48
47
  describe "passing update" do
49
48
  it "should log a content update event" do
50
- BatchUpdateJob.any_instance.stubs(:get_permissions_solr_response_for_doc_id).returns(["","mock solr permissions"])
51
- User.any_instance.expects(:can?).with(:edit, "mock solr permissions").times(2).returns(true)
52
- Resque.expects(:enqueue).with(ContentUpdateEventJob, @file.pid, @user.user_key).once
53
- Resque.expects(:enqueue).with(ContentUpdateEventJob, @file2.pid, @user.user_key).once
54
- params = {'generic_file' => {'terms_of_service' => '1', 'read_groups_string' => '', 'read_users_string' => 'archivist1, archivist2', 'tag' => ['']}, 'id' => @batch.pid, 'controller' => 'batch', 'action' => 'update'}
55
- BatchUpdateJob.perform(@user.user_key, params, params[:generic_file])
49
+ BatchUpdateJob.any_instance.stub(:get_permissions_solr_response_for_doc_id).and_return(["","mock solr permissions"])
50
+ User.any_instance.should_receive(:can?).with(:edit, "mock solr permissions").exactly(2).times.and_return(true)
51
+ s1 = stub('one')
52
+ ContentUpdateEventJob.should_receive(:new).with(@file.pid, @user.user_key).and_return(s1)
53
+ Sufia.queue.should_receive(:push).with(s1).once
54
+ s2 = stub('two')
55
+ ContentUpdateEventJob.should_receive(:new).with(@file2.pid, @user.user_key).and_return(s2)
56
+ Sufia.queue.should_receive(:push).with(s2).once
57
+ params = {'generic_file' => {'terms_of_service' => '1', 'read_groups_string' => '', 'read_users_string' => 'archivist1, archivist2', 'tag' => ['']}, 'id' => @batch.pid, 'controller' => 'batch', 'action' => 'update'}.with_indifferent_access
58
+ BatchUpdateJob.new(@user.user_key, params).run
56
59
  @user.mailbox.inbox[0].messages[0].subject.should == "Batch upload complete"
57
60
  @user.mailbox.inbox[0].messages[0].move_to_trash @user
58
61
  end
@@ -16,22 +16,22 @@ require 'spec_helper'
16
16
 
17
17
  describe ChecksumAuditLog do
18
18
  before(:all) do
19
- GenericFile.any_instance.stubs(:terms_of_service).returns('1')
20
- GenericFile.any_instance.stubs(:characterize).returns(true) # stub out characterization so it does not get audited
21
- @f = GenericFile.new
19
+ @f = GenericFile.new(:terms_of_service => '1')
22
20
  @f.add_file_datastream(File.new(fixture_path + '/world.png'), :dsid=>'content')
23
21
  @f.apply_depositor_metadata('mjg36')
24
- @f.save
22
+ @f.save!
25
23
  @version = @f.datastreams['content'].versions.first
26
24
  @old = ChecksumAuditLog.create(:pid=>@f.pid, :dsid=>@version.dsid, :version=>@version.versionID, :pass=>1, :created_at=>2.minutes.ago)
27
25
  @new = ChecksumAuditLog.create(:pid=>@f.pid, :dsid=>@version.dsid, :version=>@version.versionID, :pass=>0)
28
- @different_ds = ChecksumAuditLog.create(:pid=>@f.pid, :dsid=>'descMetadata', :version=>'descMetadata.0', :pass=>0)
29
- @different_pid = ChecksumAuditLog.create(:pid=>"other_pid", :dsid=>'content', :version=>'content.0', :pass=>0)
30
26
  end
31
27
  after(:all) do
32
28
  @f.delete
33
29
  ChecksumAuditLog.all.each(&:delete)
34
30
  end
31
+ before(:each) do
32
+ GenericFile.any_instance.stub(:terms_of_service).and_return('1')
33
+ GenericFile.any_instance.stub(:characterize).and_return(true) # stub out characterization so it does not get audited
34
+ end
35
35
  it "should return a list of logs for this datastream sorted by date descending" do
36
36
  @f.logs(@version.dsid).should == [@new, @old]
37
37
  end
@@ -47,17 +47,4 @@ describe ChecksumAuditLog do
47
47
  ChecksumAuditLog.find(success1.id).should_not be_nil
48
48
  @f.logs(@version.dsid).should == [success1, @new, @old]
49
49
  end
50
- it "should not prune failed audits" do
51
- FileContentDatastream.any_instance.expects(:dsChecksumValid).returns(true)
52
- @f.audit!
53
- FileContentDatastream.any_instance.expects(:dsChecksumValid).returns(false)
54
- @f.audit!
55
- FileContentDatastream.any_instance.expects(:dsChecksumValid).returns(false)
56
- @f.audit!
57
- FileContentDatastream.any_instance.expects(:dsChecksumValid).returns(true)
58
- @f.audit!
59
- FileContentDatastream.any_instance.expects(:dsChecksumValid).returns(false)
60
- @f.audit!
61
- @f.logs(@version.dsid).map(&:pass).should == [0, 1, 0, 0, 1, 0, 1]
62
- end
63
50
  end
@@ -19,7 +19,7 @@ describe 'event jobs' do
19
19
  @user = FactoryGirl.find_or_create(:user)
20
20
  @another_user = FactoryGirl.find_or_create(:archivist)
21
21
  @third_user = FactoryGirl.find_or_create(:curator)
22
- GenericFile.any_instance.stubs(:terms_of_service).returns('1')
22
+ GenericFile.any_instance.stub(:terms_of_service).and_return('1')
23
23
  @gf = GenericFile.new(pid: 'test:123')
24
24
  @gf.apply_depositor_metadata(@user.user_key)
25
25
  @gf.title = 'Hamlet'
@@ -39,9 +39,9 @@ describe 'event jobs' do
39
39
  @another_user.follow(@user)
40
40
  count_user = @user.events.length
41
41
  count_another = @another_user.events.length
42
- Time.expects(:now).returns(1).at_least_once
42
+ Time.should_receive(:now).at_least(:once).and_return(1)
43
43
  event = { action: 'User <a href="/users/jilluser@example.com">jilluser@example.com</a> has edited his or her profile', timestamp: '1' }
44
- UserEditProfileEventJob.perform(@user.user_key)
44
+ UserEditProfileEventJob.new(@user.user_key).run
45
45
  @user.events.length.should == count_user + 1
46
46
  @user.events.first.should == event
47
47
  @another_user.events.length.should == count_another + 1
@@ -53,9 +53,9 @@ describe 'event jobs' do
53
53
  @user.events.length.should == 0
54
54
  @another_user.events.length.should == 0
55
55
  @third_user.events.length.should == 0
56
- Time.expects(:now).returns(1).at_least_once
56
+ Time.should_receive(:now).at_least(:once).and_return(1)
57
57
  event = { action: 'User <a href="/users/jilluser@example.com">jilluser@example.com</a> is now following <a href="/users/archivist1@example.com">archivist1@example.com</a>', timestamp: '1' }
58
- UserFollowEventJob.perform(@user.user_key, @another_user.user_key)
58
+ UserFollowEventJob.new(@user.user_key, @another_user.user_key).run
59
59
  @user.events.length.should == 1
60
60
  @user.events.first.should == event
61
61
  @another_user.events.length.should == 1
@@ -70,9 +70,9 @@ describe 'event jobs' do
70
70
  @user.events.length.should == 0
71
71
  @another_user.events.length.should == 0
72
72
  @third_user.events.length.should == 0
73
- Time.expects(:now).returns(1).at_least_once
73
+ Time.should_receive(:now).at_least(:once).and_return(1)
74
74
  event = { action: 'User <a href="/users/jilluser@example.com">jilluser@example.com</a> has unfollowed <a href="/users/archivist1@example.com">archivist1@example.com</a>', timestamp: '1' }
75
- UserUnfollowEventJob.perform(@user.user_key, @another_user.user_key)
75
+ UserUnfollowEventJob.new(@user.user_key, @another_user.user_key).run
76
76
  @user.events.length.should == 1
77
77
  @user.events.first.should == event
78
78
  @another_user.events.length.should == 1
@@ -84,14 +84,14 @@ describe 'event jobs' do
84
84
  # ContentDeposit should log the event to the depositor's profile, followers' dashboards, and the GF
85
85
  @another_user.follow(@user)
86
86
  @third_user.follow(@user)
87
- User.any_instance.stubs(:can?).returns(true)
87
+ User.any_instance.stub(:can?).and_return(true)
88
88
  @user.profile_events.length.should == 0
89
89
  @another_user.events.length.should == 0
90
90
  @third_user.events.length.should == 0
91
91
  @gf.events.length.should == 0
92
- Time.expects(:now).returns(1).at_least_once
92
+ Time.should_receive(:now).at_least(:once).and_return(1)
93
93
  event = {action: 'User <a href="/users/jilluser@example.com">jilluser@example.com</a> has deposited <a href="/files/123">Hamlet</a>', timestamp: '1' }
94
- ContentDepositEventJob.perform('test:123', @user.user_key)
94
+ ContentDepositEventJob.new('test:123', @user.user_key).run
95
95
  @user.profile_events.length.should == 1
96
96
  @user.profile_events.first.should == event
97
97
  @another_user.events.length.should == 1
@@ -105,14 +105,14 @@ describe 'event jobs' do
105
105
  # ContentUpdate should log the event to the depositor's profile, followers' dashboards, and the GF
106
106
  @another_user.follow(@user)
107
107
  @third_user.follow(@user)
108
- User.any_instance.stubs(:can?).returns(true)
108
+ User.any_instance.stub(:can?).and_return(true)
109
109
  @user.profile_events.length.should == 0
110
110
  @another_user.events.length.should == 0
111
111
  @third_user.events.length.should == 0
112
112
  @gf.events.length.should == 0
113
- Time.expects(:now).returns(1).at_least_once
113
+ Time.should_receive(:now).at_least(:once).and_return(1)
114
114
  event = {action: 'User <a href="/users/jilluser@example.com">jilluser@example.com</a> has updated <a href="/files/123">Hamlet</a>', timestamp: '1' }
115
- ContentUpdateEventJob.perform('test:123', @user.user_key)
115
+ ContentUpdateEventJob.new('test:123', @user.user_key).run
116
116
  @user.profile_events.length.should == 1
117
117
  @user.profile_events.first.should == event
118
118
  @another_user.events.length.should == 1
@@ -126,14 +126,14 @@ describe 'event jobs' do
126
126
  # ContentNewVersion should log the event to the depositor's profile, followers' dashboards, and the GF
127
127
  @another_user.follow(@user)
128
128
  @third_user.follow(@user)
129
- User.any_instance.stubs(:can?).returns(true)
129
+ User.any_instance.stub(:can?).and_return(true)
130
130
  @user.profile_events.length.should == 0
131
131
  @another_user.events.length.should == 0
132
132
  @third_user.events.length.should == 0
133
133
  @gf.events.length.should == 0
134
- Time.expects(:now).returns(1).at_least_once
134
+ Time.should_receive(:now).at_least(:once).and_return(1)
135
135
  event = {action: 'User <a href="/users/jilluser@example.com">jilluser@example.com</a> has added a new version of <a href="/files/123">Hamlet</a>', timestamp: '1' }
136
- ContentNewVersionEventJob.perform('test:123', @user.user_key)
136
+ ContentNewVersionEventJob.new('test:123', @user.user_key).run
137
137
  @user.profile_events.length.should == 1
138
138
  @user.profile_events.first.should == event
139
139
  @another_user.events.length.should == 1
@@ -147,14 +147,14 @@ describe 'event jobs' do
147
147
  # ContentRestoredVersion should log the event to the depositor's profile, followers' dashboards, and the GF
148
148
  @another_user.follow(@user)
149
149
  @third_user.follow(@user)
150
- User.any_instance.stubs(:can?).returns(true)
150
+ User.any_instance.stub(:can?).and_return(true)
151
151
  @user.profile_events.length.should == 0
152
152
  @another_user.events.length.should == 0
153
153
  @third_user.events.length.should == 0
154
154
  @gf.events.length.should == 0
155
- Time.expects(:now).returns(1).at_least_once
155
+ Time.should_receive(:now).at_least(:once).and_return(1)
156
156
  event = {action: 'User <a href="/users/jilluser@example.com">jilluser@example.com</a> has restored a version \'content.0\' of <a href="/files/123">Hamlet</a>', timestamp: '1' }
157
- ContentRestoredVersionEventJob.perform('test:123', @user.user_key, 'content.0')
157
+ ContentRestoredVersionEventJob.new('test:123', @user.user_key, 'content.0').run
158
158
  @user.profile_events.length.should == 1
159
159
  @user.profile_events.first.should == event
160
160
  @another_user.events.length.should == 1
@@ -171,9 +171,9 @@ describe 'event jobs' do
171
171
  @user.profile_events.length.should == 0
172
172
  @another_user.events.length.should == 0
173
173
  @third_user.events.length.should == 0
174
- Time.expects(:now).returns(1).at_least_once
174
+ Time.should_receive(:now).at_least(:once).and_return(1)
175
175
  event = {action: 'User <a href="/users/jilluser@example.com">jilluser@example.com</a> has deleted file \'test:123\'', timestamp: '1' }
176
- ContentDeleteEventJob.perform('test:123', @user.user_key)
176
+ ContentDeleteEventJob.new('test:123', @user.user_key).run
177
177
  @user.profile_events.length.should == 1
178
178
  @user.profile_events.first.should == event
179
179
  @another_user.events.length.should == 1
@@ -190,9 +190,9 @@ describe 'event jobs' do
190
190
  @third_user.events.length.should == 0
191
191
  @gf.events.length.should == 0
192
192
  @now = Time.now
193
- Time.expects(:now).returns(@now).at_least_once
193
+ Time.should_receive(:now).at_least(:once).and_return(@now)
194
194
  event = {action: 'User <a href="/users/jilluser@example.com">jilluser@example.com</a> has updated <a href="/files/123">Hamlet</a>', timestamp: @now.to_i.to_s }
195
- ContentUpdateEventJob.perform('test:123', @user.user_key)
195
+ ContentUpdateEventJob.new('test:123', @user.user_key).run
196
196
  @user.profile_events.length.should == 1
197
197
  @user.profile_events.first.should == event
198
198
  @another_user.events.length.should == 0