sufia 4.0.0.rc1 → 4.0.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (265) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/.travis.yml +2 -2
  4. data/Gemfile +9 -17
  5. data/README.md +18 -9
  6. data/Rakefile +10 -5
  7. data/SUFIA_VERSION +1 -1
  8. data/app/assets/javascripts/jquery.blacklightTagCloud.js +1 -1
  9. data/app/assets/javascripts/sufia.js +5 -22
  10. data/app/assets/javascripts/sufia/batch.js +8 -0
  11. data/app/assets/javascripts/sufia/batch_edit.js +19 -3
  12. data/app/assets/javascripts/sufia/dashboard_actions.js +23 -10
  13. data/app/assets/javascripts/sufia/multiForm.js +2 -2
  14. data/app/assets/javascripts/sufia/permissions.js +10 -9
  15. data/app/assets/javascripts/sufia/tabs.js +20 -0
  16. data/app/assets/stylesheets/catalog.css.scss +5 -0
  17. data/app/assets/stylesheets/collections.css.scss +40 -0
  18. data/app/assets/stylesheets/file-listing.css.scss +37 -13
  19. data/app/assets/stylesheets/generic_files.css.erb +5 -0
  20. data/app/assets/stylesheets/header.css.scss +1 -4
  21. data/app/assets/stylesheets/settings.css.scss +6 -0
  22. data/app/assets/stylesheets/styles.css.scss +4 -3
  23. data/app/assets/stylesheets/sufia-audio-overrides.css +2 -2
  24. data/app/assets/stylesheets/sufia.css.scss +27 -5
  25. data/app/assets/stylesheets/tagcloud.css +5 -1
  26. data/app/controllers/batch_controller.rb +3 -3
  27. data/app/controllers/concerns/sufia/batch_edits_controller_behavior.rb +14 -1
  28. data/app/controllers/concerns/sufia/catalog.rb +0 -1
  29. data/app/controllers/concerns/sufia/controller.rb +5 -0
  30. data/app/controllers/concerns/sufia/dashboard_controller_behavior.rb +2 -9
  31. data/app/controllers/concerns/sufia/files_controller/browse_everything.rb +3 -3
  32. data/app/controllers/concerns/sufia/files_controller_behavior.rb +5 -1
  33. data/app/controllers/concerns/sufia/homepage_controller.rb +1 -1
  34. data/app/controllers/concerns/sufia/users_controller_behavior.rb +3 -2
  35. data/app/helpers/batch_edits_helper.rb +6 -0
  36. data/app/helpers/generic_file_helper.rb +15 -0
  37. data/app/helpers/sufia/blacklight_override.rb +19 -3
  38. data/app/helpers/sufia/dashboard_helper_behavior.rb +25 -3
  39. data/app/helpers/sufia/records_helper_behavior.rb +13 -5
  40. data/app/helpers/sufia/sufia_helper_behavior.rb +15 -12
  41. data/app/models/concerns/sufia/solr_document_behavior.rb +5 -36
  42. data/app/views/_masthead.html.erb +1 -1
  43. data/app/views/_user_util_links.html.erb +6 -4
  44. data/app/views/advanced/_advanced_search_fields.html.erb +4 -4
  45. data/app/views/advanced/_advanced_search_form.html.erb +14 -17
  46. data/app/views/advanced/index.html.erb +3 -3
  47. data/app/views/batch/_metadata.html.erb +22 -24
  48. data/app/views/batch/_more_metadata.html.erb +1 -1
  49. data/app/views/batch/edit.html.erb +2 -2
  50. data/app/views/batch_edits/_check_all.html.erb +7 -9
  51. data/app/views/batch_edits/_delete_selected.html.erb +1 -0
  52. data/app/views/batch_edits/edit.html.erb +25 -26
  53. data/app/views/batch_edits/update_edit.js.erb +1 -1
  54. data/app/views/catalog/_facet_limit.html.erb +4 -12
  55. data/app/views/catalog/_search_form.html.erb +8 -13
  56. data/app/views/collections/_action_menu.html.erb +2 -2
  57. data/app/views/collections/_collection.html.erb +10 -31
  58. data/app/views/collections/_document_list.html.erb +1 -1
  59. data/app/views/collections/_edit_actions.html.erb +2 -2
  60. data/app/views/collections/_edit_descriptions.html.erb +3 -5
  61. data/app/views/collections/_form.html.erb +8 -10
  62. data/app/views/collections/_media_display.html.erb +1 -1
  63. data/app/views/collections/_show_actions.html.erb +5 -5
  64. data/app/views/collections/_show_descriptions.html.erb +13 -8
  65. data/app/views/collections/_show_document_list.html.erb +17 -0
  66. data/app/views/collections/_show_document_list_menu.html.erb +24 -0
  67. data/app/views/collections/_show_document_list_row.html.erb +63 -0
  68. data/app/views/collections/edit.html.erb +2 -2
  69. data/app/views/collections/show.html.erb +28 -19
  70. data/app/views/contact_form/new.html.erb +21 -29
  71. data/app/views/dashboard/_index_partials/_contents.html.erb +14 -0
  72. data/app/views/dashboard/_index_partials/_heading_actions.html.erb +18 -0
  73. data/app/views/dashboard/_index_partials/_heading_greetings.html.erb +8 -0
  74. data/app/views/dashboard/_index_partials/_stats.html.erb +6 -2
  75. data/app/views/dashboard/index.html.erb +5 -37
  76. data/app/views/generic_files/_breadcrumbs.html.erb +2 -0
  77. data/app/views/generic_files/_browse_everything.html.erb +2 -2
  78. data/app/views/generic_files/_descriptions.html.erb +4 -6
  79. data/app/views/generic_files/_field_form.html.erb +2 -2
  80. data/app/views/generic_files/_generic_file.html.erb +8 -29
  81. data/app/views/generic_files/_groups_description.html.erb +5 -4
  82. data/app/views/generic_files/_permission.html.erb +2 -2
  83. data/app/views/generic_files/_permission_form.html.erb +62 -77
  84. data/app/views/generic_files/_rights_modal.html.erb +0 -2
  85. data/app/views/generic_files/_share_with.html.erb +14 -0
  86. data/app/views/generic_files/_show_actions.html.erb +1 -1
  87. data/app/views/generic_files/_show_collections.html.erb +17 -0
  88. data/app/views/generic_files/_show_descriptions.html.erb +2 -2
  89. data/app/views/generic_files/_versioning.html.erb +2 -2
  90. data/app/views/generic_files/_visibility.html.erb +17 -0
  91. data/app/views/generic_files/show.html.erb +39 -2
  92. data/app/views/generic_files/stats.html.erb +1 -1
  93. data/app/views/generic_files/upload/_form_fields.html.erb +2 -2
  94. data/app/views/generic_files/upload/_local_file_import_chooser.html.erb +1 -1
  95. data/app/views/generic_files/upload/_script_templates.html.erb +2 -2
  96. data/app/views/generic_files/upload/_tos_checkbox.html.erb +3 -3
  97. data/app/views/homepage/_home_content.html.erb +0 -9
  98. data/app/views/homepage/_home_header.html.erb +1 -1
  99. data/app/views/homepage/_recent_document.html.erb +2 -2
  100. data/app/views/layouts/_head_tag_content.html.erb +7 -1
  101. data/app/views/layouts/sufia-dashboard.html.erb +4 -2
  102. data/app/views/layouts/sufia-one-column.html.erb +1 -1
  103. data/app/views/my/_action_menu.html.erb +1 -1
  104. data/app/views/my/_collection_action_menu.html.erb +3 -3
  105. data/app/views/my/_constraints.html.erb +11 -0
  106. data/app/views/my/_document_list.html.erb +1 -1
  107. data/app/views/my/_facet_limit.html.erb +4 -12
  108. data/app/views/my/_facets.html.erb +1 -3
  109. data/app/views/my/_index_partials/_default_group.html.erb +2 -3
  110. data/app/views/my/_index_partials/_list_collections.html.erb +17 -11
  111. data/app/views/my/_index_partials/_list_files.html.erb +20 -24
  112. data/app/views/my/_search_header.html.erb +5 -0
  113. data/app/views/my/_sort_and_per_page.html.erb +11 -7
  114. data/app/views/my/index.html.erb +9 -15
  115. data/app/views/records/_edit_field.html.erb +14 -10
  116. data/app/views/records/edit_fields/_default.html.erb +6 -0
  117. data/app/views/records/edit_fields/_description.html.erb +3 -7
  118. data/app/views/records/edit_fields/_resource_type.html.erb +4 -6
  119. data/app/views/records/edit_fields/_rights.html.erb +4 -5
  120. data/app/views/records/edit_fields/_suffix.html.erb +6 -3
  121. data/app/views/records/edit_fields/_type.html.erb +7 -12
  122. data/app/views/{generic_files → records}/show_fields/_based_near.html.erb +1 -1
  123. data/app/views/{generic_files → records}/show_fields/_contributor.html.erb +2 -2
  124. data/app/views/records/show_fields/_creator.html.erb +6 -0
  125. data/app/views/{generic_files → records}/show_fields/_date_created.html.erb +1 -1
  126. data/app/views/records/show_fields/_default.html.erb +6 -0
  127. data/app/views/records/show_fields/_description.html.erb +6 -0
  128. data/app/views/records/show_fields/_identifier.html.erb +4 -0
  129. data/app/views/{generic_files → records}/show_fields/_language.html.erb +1 -1
  130. data/app/views/{generic_files → records}/show_fields/_publisher.html.erb +1 -1
  131. data/app/views/records/show_fields/_related_url.html.erb +6 -0
  132. data/app/views/{generic_files → records}/show_fields/_resource_type.html.erb +1 -1
  133. data/app/views/{generic_files → records}/show_fields/_rights.html.erb +1 -1
  134. data/app/views/{generic_files → records}/show_fields/_subject.html.erb +1 -1
  135. data/app/views/{generic_files → records}/show_fields/_tag.html.erb +1 -1
  136. data/app/views/records/show_fields/_title.html.erb +6 -0
  137. data/app/views/shared/_attributes.html.erb +27 -0
  138. data/app/views/static/agreement.html.erb +1 -1
  139. data/app/views/users/_activity_log.html.erb +0 -2
  140. data/app/views/users/_follower_modal.html.erb +27 -23
  141. data/app/views/users/_following_modal.html.erb +27 -23
  142. data/app/views/users/_social_media_info.html.erb +4 -4
  143. data/app/views/users/_trophy_edit.html.erb +5 -7
  144. data/app/views/users/_user_info.html.erb +3 -3
  145. data/app/views/users/_user_util_links_extra.html.erb +4 -0
  146. data/app/views/users/edit.html.erb +28 -33
  147. data/app/views/users/index.html.erb +1 -1
  148. data/app/views/users/show.html.erb +0 -4
  149. data/config/jetty.yml +1 -1
  150. data/config/locales/sufia.en.yml +53 -12
  151. data/lib/generators/sufia/install_generator.rb +89 -0
  152. data/lib/generators/sufia/templates/catalog_controller.rb +1 -1
  153. data/lib/generators/sufia/upgrade400_generator.rb +4 -0
  154. data/lib/sufia.rb +1 -10
  155. data/lib/sufia/version.rb +1 -1
  156. data/solr_conf/conf/solrconfig.xml +31 -17
  157. data/spec/actors/generic_file/actor_spec.rb +17 -0
  158. data/spec/controllers/batch_controller_spec.rb +2 -2
  159. data/spec/controllers/batch_edits_controller_spec.rb +24 -19
  160. data/spec/controllers/catalog_controller_spec.rb +23 -12
  161. data/spec/controllers/collections_controller_spec.rb +19 -17
  162. data/spec/controllers/dashboard_controller_spec.rb +5 -19
  163. data/spec/controllers/generic_files_controller_spec.rb +35 -20
  164. data/spec/controllers/homepage_controller_spec.rb +25 -2
  165. data/spec/controllers/users_controller_spec.rb +99 -102
  166. data/spec/factories/generic_files.rb +2 -2
  167. data/spec/factories/users.rb +32 -2
  168. data/spec/features/browse_dashboard_files_spec.rb +14 -2
  169. data/spec/features/browse_files_spec.rb +5 -1
  170. data/spec/features/catalog_search_spec.rb +7 -6
  171. data/spec/features/collection_spec.rb +43 -33
  172. data/spec/features/display_dashboard_spec.rb +25 -22
  173. data/spec/features/notifications_spec.rb +9 -4
  174. data/spec/features/users_spec.rb +34 -25
  175. data/spec/fixtures/1.5mb-avatar.jpg +0 -0
  176. data/spec/helpers/batch_edits_helper_spec.rb +38 -0
  177. data/spec/helpers/dashboard_helper_spec.rb +16 -5
  178. data/spec/helpers/generic_file_helper_spec.rb +41 -0
  179. data/spec/helpers/records_helper_spec.rb +12 -0
  180. data/spec/jobs/active_fedora_pid_based_job_spec.rb +1 -1
  181. data/spec/jobs/audit_job_spec.rb +2 -3
  182. data/spec/jobs/batch_update_job_spec.rb +39 -24
  183. data/spec/jobs/event_jobs_spec.rb +1 -1
  184. data/spec/lib/sufia/id_service_spec.rb +25 -7
  185. data/spec/lib/sufia/messages_spec.rb +60 -0
  186. data/spec/lib/sufia/readable_permissions_spec.rb +56 -0
  187. data/spec/lib/sufia/writable_permissions_spec.rb +20 -0
  188. data/spec/models/batch_spec.rb +1 -1
  189. data/spec/models/collection_spec.rb +24 -2
  190. data/spec/models/featured_work_spec.rb +2 -2
  191. data/spec/models/file_content_datastream_spec.rb +5 -5
  192. data/spec/models/generic_file_spec.rb +149 -133
  193. data/spec/models/local_authority_spec.rb +1 -1
  194. data/spec/models/user_spec.rb +33 -6
  195. data/spec/spec_helper.rb +7 -10
  196. data/spec/{support → test_app_templates}/lib/generators/test_app_generator.rb +11 -6
  197. data/spec/views/batch/edit.html.erb_spec.rb +8 -2
  198. data/spec/views/catalog/index.html.erb_spec.rb +34 -0
  199. data/spec/views/catalog/{sort_and_per_pange.html.erb_spec.rb → sort_and_per_page.html.erb_spec.rb} +0 -0
  200. data/spec/views/collections/_form.html.erb_spec.rb +32 -0
  201. data/spec/views/collections/_show_descriptions.html.erb_spec.rb +25 -0
  202. data/spec/views/dashboard/index_spec.rb +33 -4
  203. data/spec/views/generic_file/_breadcrumbs.html.erb_spec.rb +32 -0
  204. data/spec/views/generic_file/show.html.erb_spec.rb +273 -8
  205. data/spec/views/users/_user_util_links.html.erb_spec.rb +25 -0
  206. data/sufia-models/app/actors/sufia/generic_file/actor.rb +14 -5
  207. data/sufia-models/{lib/sufia/models → app}/jobs/active_fedora_pid_based_job.rb +0 -0
  208. data/sufia-models/{lib/sufia/models → app}/jobs/audit_job.rb +4 -10
  209. data/sufia-models/{lib/sufia/models → app}/jobs/batch_update_job.rb +22 -18
  210. data/sufia-models/{lib/sufia/models → app}/jobs/characterize_job.rb +0 -0
  211. data/sufia-models/{lib/sufia/models → app}/jobs/create_derivatives_job.rb +0 -0
  212. data/sufia-models/{lib/sufia/models → app}/jobs/import_url_job.rb +0 -0
  213. data/sufia-models/{lib/sufia/models → app}/jobs/resolrize_job.rb +0 -0
  214. data/sufia-models/app/models/collection.rb +1 -39
  215. data/sufia-models/{lib → app/models/concerns}/sufia/ability.rb +0 -0
  216. data/sufia-models/app/models/concerns/sufia/collection.rb +55 -0
  217. data/sufia-models/app/models/concerns/sufia/generic_file.rb +5 -11
  218. data/sufia-models/app/models/concerns/sufia/generic_file/audit.rb +1 -2
  219. data/sufia-models/app/models/concerns/sufia/generic_file/characterization.rb +4 -2
  220. data/sufia-models/app/models/concerns/sufia/generic_file/full_text_indexing.rb +27 -0
  221. data/sufia-models/app/models/concerns/sufia/generic_file/mime_types.rb +1 -0
  222. data/sufia-models/app/models/concerns/sufia/generic_file/permissions.rb +2 -49
  223. data/sufia-models/{lib/sufia/models → app/models/concerns/sufia}/model_methods.rb +0 -0
  224. data/sufia-models/app/models/concerns/sufia/user.rb +8 -1
  225. data/sufia-models/app/models/sufia/avatar_uploader.rb +2 -3
  226. data/sufia-models/app/services/sufia/noid.rb +9 -0
  227. data/sufia-models/config/locales/sufia.en.yml +1 -0
  228. data/sufia-models/lib/generators/sufia/models/fulltext_generator.rb +27 -0
  229. data/sufia-models/lib/generators/sufia/models/install_generator.rb +7 -0
  230. data/sufia-models/lib/generators/sufia/models/templates/config/analytics.yml +5 -5
  231. data/sufia-models/lib/generators/sufia/models/templates/config/solrconfig.xml +177 -0
  232. data/sufia-models/lib/generators/sufia/models/templates/config/sufia.rb +3 -1
  233. data/sufia-models/lib/generators/sufia/models/upgrade400_generator.rb +7 -0
  234. data/sufia-models/lib/sufia/messages.rb +67 -0
  235. data/sufia-models/lib/sufia/models.rb +2 -0
  236. data/sufia-models/lib/sufia/models/active_fedora/redis.rb +0 -6
  237. data/sufia-models/lib/sufia/models/engine.rb +1 -3
  238. data/sufia-models/lib/sufia/models/resque.rb +1 -1
  239. data/sufia-models/lib/sufia/models/version.rb +1 -1
  240. data/sufia-models/lib/sufia/permissions.rb +9 -0
  241. data/sufia-models/lib/sufia/permissions/readable.rb +20 -0
  242. data/sufia-models/lib/sufia/permissions/writable.rb +56 -0
  243. data/sufia-models/lib/tasks/sufia-models_tasks.rake +58 -2
  244. data/sufia-models/sufia-models.gemspec +11 -11
  245. data/sufia.gemspec +19 -9
  246. data/tasks/jetty.rake +6 -5
  247. data/tasks/sufia-dev.rake +4 -77
  248. metadata +235 -72
  249. data/app/assets/images/folder.png +0 -0
  250. data/app/views/collections/show_fields/_creator.html.erb +0 -11
  251. data/app/views/collections/show_fields/_description.html.erb +0 -8
  252. data/app/views/collections/show_fields/_title.html.erb +0 -8
  253. data/app/views/generic_files/edit_fields/_default.html.erb +0 -6
  254. data/app/views/generic_files/edit_fields/_description.html.erb +0 -5
  255. data/app/views/generic_files/edit_fields/_resource_type.html.erb +0 -6
  256. data/app/views/generic_files/edit_fields/_rights.html.erb +0 -6
  257. data/app/views/generic_files/edit_fields/_suffix.html.erb +0 -9
  258. data/app/views/generic_files/show_fields/_creator.html.erb +0 -7
  259. data/app/views/generic_files/show_fields/_default.html.erb +0 -6
  260. data/app/views/generic_files/show_fields/_description.html.erb +0 -7
  261. data/app/views/generic_files/show_fields/_identifier.html.erb +0 -4
  262. data/app/views/generic_files/show_fields/_related_url.html.erb +0 -6
  263. data/app/views/generic_files/show_fields/_title.html.erb +0 -7
  264. data/lib/generators/sufia/sufia_generator.rb +0 -89
  265. data/spec/active_fedora/unsaved_digital_object_spec.rb +0 -35
@@ -2,22 +2,22 @@ require 'spec_helper'
2
2
 
3
3
  describe 'catalog searching' do
4
4
 
5
- before :all do
6
- @gf1 = GenericFile.new.tap do |f|
7
- f.title = 'title 1'
5
+ before(:all) do
6
+ @gf1 = GenericFile.new.tap do |f|
7
+ f.title = ['title 1']
8
8
  f.tag = ["tag1", "tag2"]
9
9
  f.apply_depositor_metadata('jilluser')
10
10
  f.read_groups = ['public']
11
11
  f.save!
12
12
  end
13
- @gf2 = GenericFile.new.tap do |f|
14
- f.title = 'title 2'
13
+ @gf2 = GenericFile.new.tap do |f|
14
+ f.title = ['title 2']
15
15
  f.tag = ["tag2", "tag3"]
16
16
  f.apply_depositor_metadata('jilluser')
17
17
  f.read_groups = ['public']
18
18
  f.save!
19
19
  end
20
- @col = Collection.new.tap do |f|
20
+ @col = Collection.new.tap do |f|
21
21
  f.title = 'title 3'
22
22
  f.tag = ["tag3", "tag4"]
23
23
  f.apply_depositor_metadata('jilluser')
@@ -33,6 +33,7 @@ describe 'catalog searching' do
33
33
  end
34
34
 
35
35
  before do
36
+ allow(User).to receive(:find_by_user_key).and_return(stub_model(User, twitter_handle: 'bob'))
36
37
  sign_in :user
37
38
  visit '/'
38
39
  end
@@ -6,7 +6,7 @@ describe 'collection' do
6
6
  first('#hydra-collection-add').click
7
7
  expect(page).to have_content 'Create New Collection'
8
8
  fill_in('Title', with: title)
9
- fill_in('Description', with: description)
9
+ fill_in('Abstract or Summary', with: description)
10
10
  click_button("Create Collection")
11
11
  expect(page).to have_content 'Items in this Collection'
12
12
  expect(page).to have_content title
@@ -28,7 +28,7 @@ describe 'collection' do
28
28
  @gfs = []
29
29
  (0..12).each do |x|
30
30
  @gfs[x] = GenericFile.new.tap do |f|
31
- f.title = "title #{x}"
31
+ f.title = ["title #{x}"]
32
32
  f.apply_depositor_metadata('archivist1@example.com')
33
33
  f.save!
34
34
  end
@@ -57,7 +57,9 @@ describe 'collection' do
57
57
  # since there is only one collection, it's not necessary to choose a radio button
58
58
  click_button "Update Collection"
59
59
  expect(page).to have_content "Items in this Collection"
60
- expect(page).to have_selector "ol.catalog li:nth-child(9)" # at least 9 files in this collection
60
+ # There are two rows in the table per document (one for the general info, one for the details)
61
+ # Make sure we have at least 9 documents (18 table rows)
62
+ expect(page).to have_selector "table.table-zebra-striped tr:nth-child(18)"
61
63
  end
62
64
  end
63
65
 
@@ -93,18 +95,21 @@ describe 'collection' do
93
95
  end
94
96
 
95
97
  it "should show a collection with a listing of Descriptive Metadata and catalog-style search results" do
96
- page.should have_content(@collection.title)
98
+ expect(page).to have_content(@collection.title)
97
99
  within('#document_'+@collection.noid) do
98
100
  click_link("collection title")
99
101
  end
100
- page.should have_content(@collection.title)
101
- page.should have_content(@collection.description)
102
+ expect(page).to have_content(@collection.title)
103
+ expect(page).to have_content(@collection.description)
104
+ # Should not show title and description a second time
105
+ expect(page).to_not have_css('.metadata-collections', text: @collection.title)
106
+ expect(page).to_not have_css('.metadata-collections', text: @collection.description)
102
107
  # Should not have Collection Descriptive metadata table
103
- page.should have_content("Descriptions")
108
+ expect(page).to have_content("Descriptions")
104
109
  # Should have search results / contents listing
105
- page.should have_content(@gf1.title.first)
106
- page.should have_content(@gf2.title.first)
107
- page.should_not have_css(".pager")
110
+ expect(page).to have_content(@gf1.title.first)
111
+ expect(page).to have_content(@gf2.title.first)
112
+ expect(page).to_not have_css(".pager")
108
113
 
109
114
  click_link "Gallery"
110
115
  expect(page).to have_content(@gf1.title.first)
@@ -112,25 +117,26 @@ describe 'collection' do
112
117
  end
113
118
 
114
119
  it "should hide collection descriptive metadata when searching a collection" do
115
- page.should have_content(@collection.title)
120
+ # URL: /dashboard/collections
121
+ expect(page).to have_content(@collection.title)
116
122
  within("#document_#{@collection.noid}") do
117
123
  click_link("collection title")
118
124
  end
119
- page.should have_content(@collection.title)
120
- page.should have_content(@collection.description)
121
- page.should have_content(@gf1.title.first)
122
- page.should have_content(@gf2.title.first)
125
+ # URL: /collections/collection-id
126
+ expect(page).to have_content(@collection.title)
127
+ expect(page).to have_content(@collection.description)
128
+ expect(page).to have_content(@gf1.title.first)
129
+ expect(page).to have_content(@gf2.title.first)
123
130
  fill_in('collection_search', with: @gf1.title.first)
124
131
  click_button('collection_submit')
125
- # Should not have Collection Descriptive metadata table
126
- page.should_not have_content("Descriptions")
127
- page.should have_content(@collection.title)
128
- page.should have_content(@collection.description)
132
+ # Should not have Collection metadata table (only title and description)
133
+ expect(page).to_not have_content("Total Items")
134
+ expect(page).to have_content(@collection.title)
135
+ expect(page).to have_content(@collection.description)
129
136
  # Should have search results / contents listing
130
- page.should have_content(@gf1.title.first)
131
- page.should_not have_content(@gf2.title.first)
132
- # Should not have Dashboard content in contents listing
133
- page.should_not have_content("Visibility")
137
+ expect(page).to have_content("Search Results")
138
+ expect(page).to have_content(@gf1.title.first)
139
+ expect(page).to_not have_content(@gf2.title.first)
134
140
  end
135
141
  end
136
142
 
@@ -146,27 +152,31 @@ describe 'collection' do
146
152
  end
147
153
 
148
154
  it "should edit and update collection metadata" do
149
- page.should have_content(@collection.title)
155
+ # URL: /dashboard/collections
156
+ expect(page).to have_content(@collection.title)
150
157
  within("#document_#{@collection.noid}") do
151
158
  find('button.dropdown-toggle').click
152
159
  click_link('Edit Collection')
153
160
  end
154
- page.should have_field('collection_title', with: @collection.title)
155
- page.should have_field('collection_description', with: @collection.description)
161
+ # URL: /collections/collection-id/edit
162
+ expect(page).to have_field('collection_title', with: @collection.title)
163
+ expect(page).to have_field('collection_description', with: @collection.description)
156
164
  new_title = "Altered Title"
157
165
  new_description = "Completely new Description text."
158
166
  creators = ["Dorje Trollo", "Vajrayogini"]
159
167
  fill_in('Title', with: new_title)
160
- fill_in('Description', with: new_description)
168
+ fill_in('Abstract or Summary', with: new_description)
161
169
  fill_in('Creator', with: creators.first)
162
- within('.form-actions') do
170
+ within('.primary-actions') do
163
171
  click_button('Update Collection')
164
172
  end
165
- page.should_not have_content(@collection.title)
166
- page.should_not have_content(@collection.description)
167
- page.should have_content(new_title)
168
- page.should have_content(new_description)
169
- page.should have_content(creators.first)
173
+ # URL: /collections/collection-id
174
+ header = find('header')
175
+ expect(header).to_not have_content(@collection.title)
176
+ expect(header).to_not have_content(@collection.description)
177
+ expect(header).to have_content(new_title)
178
+ expect(header).to have_content(new_description)
179
+ expect(page).to have_content(creators.first)
170
180
  end
171
181
 
172
182
  it "should remove a file from a collection" do
@@ -1,35 +1,38 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe "Display User Dashboard" do
3
+ describe "The Dashboard" do
4
4
 
5
5
  before do
6
6
  sign_in :user_with_fixtures
7
- visit "/dashboard"
8
7
  end
9
8
 
10
- it "should show the user's information" do
11
- page.should have_content "My Dashboard"
12
- page.should have_content "User Activity"
13
- page.should have_content "User Notifications"
14
- page.should have_content "Your Statistics"
15
- end
9
+ context "upon sign-in" do
16
10
 
17
- it "should let the user upload files" do
18
- click_link "Upload"
19
- page.should have_content "Upload"
20
- end
11
+ it "should show the user's information" do
12
+ page.should have_content "My Dashboard"
13
+ page.should have_content "User Activity"
14
+ page.should have_content "User Notifications"
15
+ page.should have_content "Your Statistics"
16
+ end
21
17
 
22
- it "should let the user create collections" do
23
- click_link "Create Collection"
24
- page.should have_content "Create New Collection"
25
- end
18
+ it "should let the user upload files" do
19
+ click_link "Upload"
20
+ page.should have_content "Upload"
21
+ end
22
+
23
+ it "should let the user create collections" do
24
+ click_link "Create Collection"
25
+ page.should have_content "Create New Collection"
26
+ end
27
+
28
+ it "should let the user view files" do
29
+ click_link "View Files"
30
+ page.should have_content "My Files"
31
+ page.should have_content "My Collections"
32
+ page.should have_content "My Highlights"
33
+ page.should have_content "Files Shared with Me"
34
+ end
26
35
 
27
- it "should let the user view files" do
28
- click_link "View Files"
29
- page.should have_content "Files"
30
- page.should have_content "Collections"
31
- page.should have_content "Highlighted"
32
- page.should have_content "Shared with Me"
33
36
  end
34
37
 
35
38
  end
@@ -4,17 +4,22 @@ describe "Notifications page" do
4
4
 
5
5
  before do
6
6
  sign_in FactoryGirl.create(:user_with_mail)
7
+ visit "/notifications"
7
8
  end
8
9
 
9
10
  it "should list notifications with date, subject and message" do
10
- visit "/notifications"
11
11
  page.should have_content "User Notifications"
12
12
  page.find(:xpath, '//thead/tr').should have_content "Date"
13
13
  page.find(:xpath, '//thead/tr').should have_content "Subject"
14
14
  page.find(:xpath, '//thead/tr').should have_content "Message"
15
- page.should have_content "Sample notification."
16
- page.should have_content "less than a minute ago"
17
- page.should have_content "You've got mail."
15
+ page.should have_content "These files could not be updated. You do not have sufficient privileges to edit them. "
16
+ page.should have_content "These files have been saved"
17
+ page.should have_content "File 1 could not be updated. You do not have sufficient privileges to edit it."
18
+ page.should have_content "File 1 has been saved"
19
+ page.should have_content "Batch upload permission denied "
20
+ page.should have_content "Batch upload complete"
18
21
  end
19
22
 
23
+
24
+
20
25
  end
@@ -1,41 +1,50 @@
1
1
  require 'spec_helper'
2
2
 
3
+
3
4
  describe "User Profile" do
4
5
 
5
6
  before do
6
7
  sign_in FactoryGirl.create(:curator)
7
8
  end
8
9
 
9
- it "should be displayed" do
10
- click_link "curator1@example.com"
11
- page.should have_content "Edit Your Profile"
10
+ context 'when visiting user profile' do
11
+ it 'should render page properly' do
12
+ visit '/users/curator1@example-dot-com'
13
+ expect(page).to have_content('curator1@example.com')
14
+ expect(page).to have_content('Edit Your Profile')
15
+ end
12
16
  end
13
17
 
14
- it "should be editable" do
15
- click_link "curator1@example.com"
16
- click_link "Edit Your Profile"
17
- page.should have_xpath("//form[@action='/users/curator1@example-dot-com']")
18
- fill_in 'user_twitter_handle', with: 'curatorOfData'
19
- click_button 'Save Profile'
20
- page.should have_content "Your profile has been updated"
21
- page.should have_content "curatorOfData"
18
+ context 'when clicking all users' do
19
+ it 'should display all users' do
20
+ visit '/users/curator1@example-dot-com'
21
+ click_link 'View Users'
22
+ expect(page).to have_xpath("//td/a[@href='/users/curator1@example-dot-com']")
23
+ end
22
24
  end
23
25
 
24
- it "should display all users" do
25
- click_link "curator1@example.com"
26
- click_link "View Users"
27
- page.should have_xpath("//td/a[@href='/users/curator1@example-dot-com']")
26
+ context 'when visiting user profile' do
27
+ it 'page should be editable' do
28
+ visit '/users/curator1@example-dot-com'
29
+ click_link 'Edit Your Profile'
30
+ fill_in 'user_twitter_handle', with: 'curatorOfData'
31
+ click_button 'Save Profile'
32
+ expect(page).to have_content 'Your profile has been updated'
33
+ expect(page).to have_content 'curatorOfData'
34
+ end
28
35
  end
29
36
 
30
- it "should be searchable" do
31
- @archivist = FactoryGirl.find_or_create(:archivist)
32
- click_link "curator1@example.com"
33
- click_link "View Users"
34
- page.should have_xpath("//td/a[@href='/users/curator1@example-dot-com']")
35
- page.should have_xpath("//td/a[@href='/users/archivist1@example-dot-com']")
36
- fill_in 'user_search', with: 'archivist1@example.com'
37
- click_button "user_submit"
38
- page.should_not have_xpath("//td/a[@href='/users/curator1@example-dot-com']")
39
- page.should have_xpath("//td/a[@href='/users/archivist1@example-dot-com']")
37
+ context 'user profile' do
38
+ it 'should be searchable' do
39
+ @archivist = FactoryGirl.find_or_create(:archivist)
40
+ visit '/users/curator1@example-dot-com'
41
+ click_link 'View Users'
42
+ expect(page).to have_xpath("//td/a[@href='/users/curator1@example-dot-com']")
43
+ expect(page).to have_xpath("//td/a[@href='/users/archivist1@example-dot-com']")
44
+ fill_in 'user_search', with: 'archivist1@example.com'
45
+ click_button "user_submit"
46
+ expect(page).to_not have_xpath("//td/a[@href='/users/curator1@example-dot-com']")
47
+ expect(page).to have_xpath("//td/a[@href='/users/archivist1@example-dot-com']")
48
+ end
40
49
  end
41
50
  end
@@ -0,0 +1,38 @@
1
+ require 'spec_helper'
2
+
3
+ describe BatchEditsHelper do
4
+
5
+ describe "#render_check_all" do
6
+
7
+ before do
8
+ @document_list = ["doc1", "doc2"]
9
+ @batch_size_on_other_page = 1
10
+ @max_batch_size = 10
11
+ end
12
+
13
+ context "with my files" do
14
+ it "should show the check all dropdown" do
15
+ allow(helper).to receive(:params).and_return({ controller: "my/files" })
16
+ allow(helper).to receive(:controller_name).and_return("batch_edits")
17
+ expect(helper.render_check_all).to have_css("span.glyphicon-cog")
18
+ end
19
+ end
20
+
21
+ context "with my collections" do
22
+ it "should not show the check all dropdown" do
23
+ allow(helper).to receive(:params).and_return({ controller: "my/collections" })
24
+ expect(helper.render_check_all).to be_nil
25
+ end
26
+ end
27
+
28
+ context "with select all disabled" do
29
+ it "should not show the check all dropdown" do
30
+ allow(helper).to receive(:params).and_return({ controller: "foo" })
31
+ assign(:disable_select_all, true)
32
+ expect(helper.render_check_all).to be_nil
33
+ end
34
+ end
35
+
36
+ end
37
+
38
+ end
@@ -23,18 +23,29 @@ describe DashboardHelper do
23
23
  describe "#on_the_dashboard?" do
24
24
  it "should return false for controllers that aren't a part of the dashboard" do
25
25
  allow(helper).to receive(:params).and_return({ controller: "foo" })
26
- expect(helper.on_the_dashboard?).to be_false
26
+ expect(helper).to_not be_on_the_dashboard
27
27
  end
28
28
 
29
29
  it "should return true for controllers that are part of the dashboard" do
30
30
  allow(helper).to receive(:params).and_return({ controller: "my/files" })
31
- expect(helper.on_the_dashboard?).to be_true
31
+ expect(helper).to be_on_the_dashboard
32
32
  allow(helper).to receive(:params).and_return({ controller: "my/collections" })
33
- expect(helper.on_the_dashboard?).to be_true
33
+ expect(helper).to be_on_the_dashboard
34
34
  allow(helper).to receive(:params).and_return({ controller: "my/highlights" })
35
- expect(helper.on_the_dashboard?).to be_true
35
+ expect(helper).to be_on_the_dashboard
36
36
  allow(helper).to receive(:params).and_return({ controller: "my/shares" })
37
- expect(helper.on_the_dashboard?).to be_true
37
+ expect(helper).to be_on_the_dashboard
38
+ end
39
+ end
40
+
41
+ describe "#on_my_files" do
42
+ it "should return false when the controller isn't my files" do
43
+ allow(helper).to receive(:params).and_return({ controller: "my/collections" })
44
+ expect(helper).to_not be_on_my_files
45
+ end
46
+ it "should return true when the controller is my files" do
47
+ allow(helper).to receive(:params).and_return({ controller: "my/files" })
48
+ expect(helper).to be_on_my_files
38
49
  end
39
50
  end
40
51
 
@@ -0,0 +1,41 @@
1
+ require 'spec_helper'
2
+
3
+ describe GenericFileHelper do
4
+
5
+ describe "#render_collection_list" do
6
+
7
+ context "using a file that is part of a collection" do
8
+
9
+ let(:collection) do
10
+ mock_model(Collection, title: "Foo Collection")
11
+ end
12
+
13
+ let(:gf) do
14
+ mock_model(GenericFile, { collections: [collection, collection] })
15
+ end
16
+
17
+ let(:link) do
18
+ "<a href=\"/collections/#{collection.id}\">#{collection.title}</a>"
19
+ end
20
+
21
+ it "should display a comma-delimited list of collections" do
22
+ expect(helper.render_collection_list(gf)).to eq("Is part of: " + [link,link].join(", "))
23
+ end
24
+
25
+ end
26
+
27
+ context "using a file that is not part of a collection" do
28
+
29
+ let(:gf) do
30
+ mock_model(GenericFile, { collections: [] })
31
+ end
32
+
33
+ it "should render nothing" do
34
+ expect(helper.render_collection_list(gf)).to be_nil
35
+ end
36
+
37
+ end
38
+
39
+ end
40
+
41
+ end