sufia 6.2.0 → 6.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (269) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +146 -0
  3. data/.travis.yml +4 -7
  4. data/Gemfile +2 -0
  5. data/History.md +29 -1
  6. data/README.md +25 -9
  7. data/SUFIA_VERSION +1 -1
  8. data/app/assets/stylesheets/sufia/_collections.scss +15 -0
  9. data/app/assets/stylesheets/sufia/_file-listing.scss +7 -0
  10. data/app/assets/stylesheets/sufia/_home-page.scss +10 -0
  11. data/app/builders/sufia/bootstrap_breadcrumbs_builder.rb +3 -5
  12. data/app/controllers/admin/stats_controller.rb +1 -76
  13. data/app/controllers/api/items_controller.rb +4 -6
  14. data/app/controllers/api/zotero_controller.rb +5 -5
  15. data/app/controllers/authorities_controller.rb +5 -1
  16. data/app/controllers/batch_edits_controller.rb +3 -3
  17. data/app/controllers/concerns/sufia/admin/depositor_stats.rb +41 -0
  18. data/app/controllers/concerns/sufia/admin/stats_behavior.rb +94 -0
  19. data/app/controllers/concerns/sufia/batch_controller_behavior.rb +16 -18
  20. data/app/controllers/concerns/sufia/batch_edits_controller_behavior.rb +54 -56
  21. data/app/controllers/concerns/sufia/breadcrumbs.rb +3 -6
  22. data/app/controllers/concerns/sufia/collections_controller_behavior.rb +39 -39
  23. data/app/controllers/concerns/sufia/controller.rb +10 -10
  24. data/app/controllers/concerns/sufia/dashboard_controller_behavior.rb +17 -18
  25. data/app/controllers/concerns/sufia/depositors_controller_behavior.rb +9 -12
  26. data/app/controllers/concerns/sufia/files_controller/browse_everything.rb +6 -7
  27. data/app/controllers/concerns/sufia/files_controller/local_ingest_behavior.rb +39 -40
  28. data/app/controllers/concerns/sufia/files_controller/upload_complete_behavior.rb +1 -1
  29. data/app/controllers/concerns/sufia/files_controller_behavior.rb +109 -110
  30. data/app/controllers/concerns/sufia/homepage_controller.rb +8 -8
  31. data/app/controllers/concerns/sufia/my_controller_behavior.rb +13 -10
  32. data/app/controllers/concerns/sufia/single_use_links_controller_behavior.rb +11 -14
  33. data/app/controllers/concerns/sufia/single_use_links_viewer_controller_behavior.rb +27 -21
  34. data/app/controllers/concerns/sufia/transfers_controller_behavior.rb +17 -17
  35. data/app/controllers/concerns/sufia/users_controller_behavior.rb +54 -54
  36. data/app/controllers/contact_form_controller.rb +1 -1
  37. data/app/controllers/content_blocks_controller.rb +11 -12
  38. data/app/controllers/directory_controller.rb +2 -3
  39. data/app/controllers/featured_work_lists_controller.rb +1 -1
  40. data/app/controllers/featured_works_controller.rb +2 -4
  41. data/app/controllers/homepage_controller.rb +1 -2
  42. data/app/controllers/mailbox_controller.rb +12 -32
  43. data/app/controllers/my/collections_controller.rb +3 -4
  44. data/app/controllers/my/files_controller.rb +4 -6
  45. data/app/controllers/my/highlights_controller.rb +4 -6
  46. data/app/controllers/my/shares_controller.rb +3 -5
  47. data/app/controllers/pages_controller.rb +1 -3
  48. data/app/controllers/single_use_links_controller.rb +0 -1
  49. data/app/controllers/single_use_links_viewer_controller.rb +0 -1
  50. data/app/controllers/static_controller.rb +1 -0
  51. data/app/forms/sufia/forms/collection_edit_form.rb +2 -2
  52. data/app/helpers/batch_edits_helper.rb +1 -3
  53. data/app/helpers/content_block_helper.rb +7 -8
  54. data/app/helpers/generic_file_helper.rb +23 -24
  55. data/app/helpers/sufia/blacklight_override.rb +6 -7
  56. data/app/helpers/sufia/dashboard_helper_behavior.rb +4 -7
  57. data/app/helpers/sufia/permissions_helper.rb +3 -4
  58. data/app/helpers/sufia/sufia_helper_behavior.rb +30 -29
  59. data/app/helpers/trophy_helper.rb +15 -15
  60. data/app/inputs/select_with_modal_help_input.rb +3 -3
  61. data/app/inputs/with_help_icon.rb +4 -4
  62. data/app/jobs/content_delete_event_job.rb +0 -1
  63. data/app/jobs/content_depositor_change_event_job.rb +1 -2
  64. data/app/jobs/event_job.rb +0 -1
  65. data/app/jobs/user_unfollow_event_job.rb +1 -0
  66. data/app/models/concerns/sufia/solr_document_behavior.rb +1 -2
  67. data/app/models/contact_form.rb +6 -6
  68. data/app/models/content_block.rb +1 -2
  69. data/app/models/featured_work_list.rb +3 -5
  70. data/app/models/user_mailbox.rb +44 -0
  71. data/app/presenters/sufia/collection_presenter.rb +6 -8
  72. data/app/presenters/sufia/generic_file_presenter.rb +2 -2
  73. data/app/presenters/sufia/presenter_renderer.rb +2 -2
  74. data/app/presenters/sufia/version_list_presenter.rb +1 -1
  75. data/app/presenters/sufia/version_presenter.rb +3 -6
  76. data/app/search_builders/deposit_search_builder.rb +19 -0
  77. data/app/search_builders/sufia/my_search_builder_behavior.rb +1 -2
  78. data/app/search_builders/sufia/search_builder.rb +1 -3
  79. data/app/uploaders/tinymce_asset_uploader.rb +0 -2
  80. data/app/views/_controls.html.erb +5 -5
  81. data/app/views/admin/stats/_deposits.html.erb +19 -0
  82. data/app/views/admin/stats/index.html.erb +2 -0
  83. data/app/views/batch_edits/edit.html.erb +2 -2
  84. data/app/views/collections/_edit_actions.html.erb +3 -3
  85. data/app/views/collections/_form_for_select_collection.html.erb +2 -2
  86. data/app/views/collections/_sort_and_per_page.html.erb +12 -9
  87. data/app/views/collections/_view_type_group.html.erb +1 -1
  88. data/app/views/collections/edit.html.erb +5 -5
  89. data/app/views/collections/show.html.erb +7 -6
  90. data/app/views/homepage/_announcement.html.erb +5 -0
  91. data/app/views/homepage/_home.html.erb +1 -0
  92. data/app/views/my/_sort_and_per_page.html.erb +14 -10
  93. data/app/views/my/index.html.erb +1 -1
  94. data/app/views/pages/show.html.erb +0 -2
  95. data/app/views/single_use_links/new_download.html.erb +1 -1
  96. data/app/views/single_use_links_viewer/show.html.erb +1 -1
  97. data/app/views/users/_notify_link.html.erb +1 -1
  98. data/app/views/users/_notify_number.html.erb +2 -2
  99. data/config/initializers/simple_form.rb +1 -1
  100. data/config/initializers/simple_form_bootstrap.rb +1 -1
  101. data/config/locales/sufia.en.yml +4 -0
  102. data/config/routes.rb +2 -3
  103. data/lib/generators/sufia/admin_stat_generator.rb +0 -3
  104. data/lib/generators/sufia/install_generator.rb +8 -9
  105. data/lib/generators/sufia/templates/catalog_controller.rb +2 -3
  106. data/lib/generators/sufia/templates/config/action_dispatch_http_upload_monkey_patch.rb +1 -0
  107. data/lib/generators/sufia/upgrade400_generator.rb +9 -9
  108. data/lib/generators/sufia/upgrade600_generator.rb +1 -4
  109. data/lib/sufia.rb +2 -2
  110. data/lib/sufia/arkivo/actor.rb +1 -1
  111. data/lib/sufia/arkivo/create_subscription_job.rb +30 -30
  112. data/lib/sufia/arkivo/metadata_munger.rb +7 -7
  113. data/lib/sufia/arkivo/schema_validator.rb +1 -1
  114. data/lib/sufia/single_use_error.rb +0 -1
  115. data/lib/sufia/version.rb +1 -1
  116. data/lib/sufia/zotero/config.rb +13 -13
  117. data/spec/actors/generic_file/actor_spec.rb +17 -18
  118. data/spec/controllers/admin_stats_controller_spec.rb +56 -5
  119. data/spec/controllers/api/zotero_controller_spec.rb +10 -9
  120. data/spec/controllers/authorities_controller_spec.rb +8 -8
  121. data/spec/controllers/batch_controller_spec.rb +19 -20
  122. data/spec/controllers/batch_edits_controller_spec.rb +8 -9
  123. data/spec/controllers/catalog_controller_spec.rb +7 -9
  124. data/spec/controllers/collections_controller_spec.rb +30 -32
  125. data/spec/controllers/content_blocks_controller_spec.rb +4 -4
  126. data/spec/controllers/dashboard_controller_spec.rb +12 -12
  127. data/spec/controllers/depositors_controller_spec.rb +8 -8
  128. data/spec/controllers/downloads_controller_spec.rb +10 -11
  129. data/spec/controllers/featured_work_lists_controller_spec.rb +4 -4
  130. data/spec/controllers/featured_works_controller_spec.rb +11 -12
  131. data/spec/controllers/generic_files_controller_spec.rb +154 -125
  132. data/spec/controllers/homepage_controller_spec.rb +22 -15
  133. data/spec/controllers/mailbox_controller_spec.rb +20 -36
  134. data/spec/controllers/my/collections_controller_spec.rb +4 -5
  135. data/spec/controllers/my/files_controller_spec.rb +10 -11
  136. data/spec/controllers/my/highlights_controller_spec.rb +4 -5
  137. data/spec/controllers/my/shares_controller_spec.rb +12 -14
  138. data/spec/controllers/my_controller_spec.rb +1 -3
  139. data/spec/controllers/pages_controller_spec.rb +4 -4
  140. data/spec/controllers/single_use_links_controller_spec.rb +1 -3
  141. data/spec/controllers/single_use_links_viewer_controller_spec.rb +1 -2
  142. data/spec/controllers/static_controller_spec.rb +1 -1
  143. data/spec/controllers/tinymce_assets_controller_spec.rb +8 -9
  144. data/spec/controllers/transfers_controller_spec.rb +19 -19
  145. data/spec/controllers/users_controller_spec.rb +33 -35
  146. data/spec/factories/api_items.rb +2 -2
  147. data/spec/factories/content_blocks.rb +1 -1
  148. data/spec/factories/featured_works.rb +1 -1
  149. data/spec/factories/generic_files.rb +3 -3
  150. data/spec/factories/users.rb +7 -8
  151. data/spec/features/browse_dashboard_files_spec.rb +14 -18
  152. data/spec/features/browse_files_spec.rb +3 -4
  153. data/spec/features/catalog_search_spec.rb +3 -5
  154. data/spec/features/cloud_upload_spec.rb +2 -2
  155. data/spec/features/collection_spec.rb +21 -21
  156. data/spec/features/contact_form_spec.rb +10 -11
  157. data/spec/features/display_dashboard_spec.rb +5 -9
  158. data/spec/features/edit_file_spec.rb +8 -9
  159. data/spec/features/featured_item_spec.rb +1 -1
  160. data/spec/features/ingest_upload_files_spec.rb +5 -5
  161. data/spec/features/notifications_spec.rb +2 -6
  162. data/spec/features/ownership_transfer_spec.rb +2 -2
  163. data/spec/features/proxy_spec.rb +2 -2
  164. data/spec/features/search_spec.rb +3 -4
  165. data/spec/features/single_use_links_spec.rb +1 -1
  166. data/spec/features/users_spec.rb +4 -5
  167. data/spec/forms/collection_edit_form_spec.rb +2 -2
  168. data/spec/forms/generic_file_edit_form_spec.rb +6 -7
  169. data/spec/helpers/batch_edits_helper_spec.rb +9 -13
  170. data/spec/helpers/content_block_helper_spec.rb +3 -3
  171. data/spec/helpers/dashboard_helper_spec.rb +19 -24
  172. data/spec/helpers/generic_file_helper_spec.rb +5 -7
  173. data/spec/helpers/sufia_helper_spec.rb +43 -54
  174. data/spec/helpers/trophy_helper_spec.rb +5 -5
  175. data/spec/inputs/multi_value_with_help_input_spec.rb +1 -2
  176. data/spec/inputs/select_with_help_input_spec.rb +19 -15
  177. data/spec/javascripts/jasmine_spec.rb +4 -5
  178. data/spec/javascripts/support/jasmine_helper.rb +9 -9
  179. data/spec/jobs/active_fedora_id_based_job_spec.rb +7 -5
  180. data/spec/jobs/audit_job_spec.rb +7 -7
  181. data/spec/jobs/batch_update_job_spec.rb +5 -6
  182. data/spec/jobs/characterize_job_spec.rb +1 -1
  183. data/spec/jobs/content_depositor_change_event_job_spec.rb +1 -1
  184. data/spec/jobs/create_derivatives_job_spec.rb +5 -5
  185. data/spec/jobs/event_jobs_spec.rb +16 -16
  186. data/spec/jobs/import_url_job_spec.rb +36 -5
  187. data/spec/jobs/ingest_local_file_job_spec.rb +31 -20
  188. data/spec/jobs/sufia_resque_queue_spec.rb +1 -1
  189. data/spec/lib/sufia/analytics_spec.rb +0 -1
  190. data/spec/lib/sufia/arkivo/actor_spec.rb +6 -6
  191. data/spec/lib/sufia/arkivo/schema_validator_spec.rb +18 -18
  192. data/spec/lib/sufia/breadcrumbs_spec.rb +5 -6
  193. data/spec/lib/sufia/messages_spec.rb +11 -12
  194. data/spec/lib/sufia/readable_permissions_spec.rb +8 -10
  195. data/spec/lib/sufia/upload_complete_behavior_spec.rb +6 -7
  196. data/spec/lib/sufia/user_stat_importer_spec.rb +30 -33
  197. data/spec/lib/sufia/writable_permissions_spec.rb +1 -3
  198. data/spec/lib/sufia/zotero/config_spec.rb +4 -6
  199. data/spec/models/ability_spec.rb +11 -9
  200. data/spec/models/batch_spec.rb +13 -13
  201. data/spec/models/characterization_spec.rb +2 -3
  202. data/spec/models/checksum_audit_log_spec.rb +18 -19
  203. data/spec/models/collection_spec.rb +11 -12
  204. data/spec/models/content_block_spec.rb +33 -22
  205. data/spec/models/download_spec.rb +3 -5
  206. data/spec/models/featured_work_list_spec.rb +3 -3
  207. data/spec/models/featured_work_spec.rb +12 -14
  208. data/spec/models/file_content_datastream_spec.rb +9 -7
  209. data/spec/models/file_download_stat_spec.rb +34 -40
  210. data/spec/models/file_usage_spec.rb +46 -52
  211. data/spec/models/file_view_stat_spec.rb +35 -41
  212. data/spec/models/fits_datastream_spec.rb +23 -25
  213. data/spec/models/generic_file/visibility_spec.rb +10 -5
  214. data/spec/models/generic_file_spec.rb +86 -88
  215. data/spec/models/geo_names_resource_spec.rb +3 -5
  216. data/spec/models/local_authority_spec.rb +30 -33
  217. data/spec/models/pageview_spec.rb +3 -3
  218. data/spec/models/proxy_deposit_request_spec.rb +3 -3
  219. data/spec/models/single_use_link_spec.rb +36 -36
  220. data/spec/models/solr_document_spec.rb +3 -6
  221. data/spec/models/trophy_spec.rb +8 -9
  222. data/spec/models/user_mailbox_spec.rb +62 -0
  223. data/spec/models/user_spec.rb +28 -29
  224. data/spec/presenters/presenter_renderer_spec.rb +1 -1
  225. data/spec/presenters/sufia/generic_file_presenter_spec.rb +5 -5
  226. data/spec/presenters/sufia/version_list_presenter_spec.rb +2 -2
  227. data/spec/presenters/sufia/version_presenter_spec.rb +1 -1
  228. data/spec/routing/featured_works_route_spec.rb +4 -4
  229. data/spec/routing/ownership_transfers_route_spec.rb +1 -1
  230. data/spec/routing/route_spec.rb +89 -89
  231. data/spec/services/generic_file_audit_service_spec.rb +8 -8
  232. data/spec/services/repository_audit_service_spec.rb +7 -3
  233. data/spec/spec_helper.rb +5 -4
  234. data/spec/support/features/session_helpers.rb +1 -1
  235. data/spec/support/input_support.rb +1 -2
  236. data/spec/support/rake.rb +1 -1
  237. data/spec/support/selectors.rb +1 -6
  238. data/spec/support/statistic_helper.rb +1 -1
  239. data/spec/support/uploaded_file_monkeypatch.rb +1 -1
  240. data/spec/tasks/rake_spec.rb +3 -5
  241. data/spec/views/admin/stats/index.html.erb_spec.rb +16 -16
  242. data/spec/views/batch/edit.html.erb_spec.rb +1 -3
  243. data/spec/views/batch_edits/check_all_spec.rb +5 -5
  244. data/spec/views/batch_edits/edit.html.erb_spec.rb +1 -3
  245. data/spec/views/catalog/index.html.erb_spec.rb +1 -3
  246. data/spec/views/catalog/sort_and_per_page.html.erb_spec.rb +4 -5
  247. data/spec/views/collections/_form.html.erb_spec.rb +5 -3
  248. data/spec/views/collections/_show_descriptions.html.erb_spec.rb +7 -8
  249. data/spec/views/collections/_show_document_list.erb_spec.rb +4 -6
  250. data/spec/views/dashboard/index_spec.rb +14 -21
  251. data/spec/views/generic_file/_browse_everything.html.erb_spec.rb +2 -2
  252. data/spec/views/generic_file/_permission_form.html.erb_spec.rb +8 -9
  253. data/spec/views/generic_file/edit.html.erb_spec.rb +7 -7
  254. data/spec/views/generic_file/show.html.erb_spec.rb +24 -25
  255. data/spec/views/generic_file/stats.html.erb_spec.rb +19 -19
  256. data/spec/views/homepage/_announcement.html.erb_spec.rb +51 -0
  257. data/spec/views/homepage/_featured_works.html.erb_spec.rb +5 -9
  258. data/spec/views/homepage/_home_header.html.erb_spec.rb +2 -2
  259. data/spec/views/my/facet.html.erb_spec.rb +4 -4
  260. data/spec/views/single_use_links/new_download.html.erb_spec.rb +28 -0
  261. data/spec/views/single_use_links_viewer/show.html.erb_spec.rb +29 -0
  262. data/spec/views/users/_follower_modal.html.erb_spec.rb +7 -8
  263. data/spec/views/users/_following_modal.html.erb_spec.rb +4 -5
  264. data/spec/views/users/_notify_number.html.erb_spec.rb +2 -5
  265. data/spec/views/users/_user_util_links.html.erb_spec.rb +5 -8
  266. data/spec/views/users/index.html.erb_spec.rb +4 -6
  267. data/spec/views/users/show.html.erb_spec.rb +4 -7
  268. data/tasks/sufia-dev.rake +19 -3
  269. metadata +20 -5
@@ -4,7 +4,7 @@ describe 'searching' do
4
4
  let!(:file) { FactoryGirl.create(:public_file, title: ["Toothbrush"]) }
5
5
 
6
6
  context "as a public user" do
7
- it "should find the file and have a gallery" do
7
+ it "finds the file and have a gallery" do
8
8
  visit '/'
9
9
  fill_in "search-field-header", with: "Toothbrush"
10
10
  click_button "search-submit-header"
@@ -12,7 +12,7 @@ describe 'searching' do
12
12
  within "#search-results" do
13
13
  expect(page).to have_content "Toothbrush"
14
14
  end
15
-
15
+
16
16
  click_link "Gallery"
17
17
  expect(page).to have_content "You searched for: Toothbrush"
18
18
  within "#documents" do
@@ -20,7 +20,7 @@ describe 'searching' do
20
20
  end
21
21
  end
22
22
 
23
- it "should not display search options for dashboard files" do
23
+ it "does not display search options for dashboard files" do
24
24
  visit "/"
25
25
  within(".input-group-btn") do
26
26
  expect(page).to_not have_content("My Files")
@@ -28,6 +28,5 @@ describe 'searching' do
28
28
  expect(page).to_not have_content("My Shares")
29
29
  end
30
30
  end
31
-
32
31
  end
33
32
  end
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe "Create and use single-use links", :type => :feature do
3
+ describe "Create and use single-use links", type: :feature do
4
4
  include Warden::Test::Helpers
5
5
  Warden.test_mode!
6
6
  include Sufia::Engine.routes.url_helpers
@@ -1,13 +1,12 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe "User Profile", :type => :feature do
4
-
3
+ describe "User Profile", type: :feature do
5
4
  before do
6
5
  sign_in FactoryGirl.create(:curator)
7
6
  end
8
7
 
9
8
  context 'when visiting user profile' do
10
- it 'should render page properly' do
9
+ it 'renders page properly' do
11
10
  visit '/users/curator1@example-dot-com'
12
11
  expect(page).to have_content('curator1@example.com')
13
12
  expect(page).to have_content('Edit Your Profile')
@@ -15,7 +14,7 @@ describe "User Profile", :type => :feature do
15
14
  end
16
15
 
17
16
  context 'when clicking all users' do
18
- it 'should display all users' do
17
+ it 'displays all users' do
19
18
  visit '/users/curator1@example-dot-com'
20
19
  click_link 'View Users'
21
20
  expect(page).to have_xpath("//td/a[@href='/users/curator1@example-dot-com']")
@@ -35,7 +34,7 @@ describe "User Profile", :type => :feature do
35
34
  end
36
35
 
37
36
  context 'user profile' do
38
- it 'should be searchable' do
37
+ it 'is searchable' do
39
38
  @archivist = FactoryGirl.find_or_create(:archivist)
40
39
  visit '/users/curator1@example-dot-com'
41
40
  click_link 'View Users'
@@ -5,7 +5,7 @@ describe Sufia::Forms::CollectionEditForm do
5
5
  let(:form) { described_class.new(collection) }
6
6
 
7
7
  describe "#terms" do
8
- subject { form.terms}
8
+ subject { form.terms }
9
9
  it { is_expected.to eq [:resource_type, :title, :creator, :contributor, :description,
10
10
  :tag, :rights, :publisher, :date_created, :subject, :language,
11
11
  :identifier, :based_near, :related_url] }
@@ -13,7 +13,7 @@ describe Sufia::Forms::CollectionEditForm do
13
13
 
14
14
  describe "unique?" do
15
15
  context "with :title" do
16
- subject { Sufia::Forms::CollectionEditForm.unique?(:title) }
16
+ subject { described_class.unique?(:title) }
17
17
  it { is_expected.to be true }
18
18
  end
19
19
  end
@@ -4,9 +4,9 @@ describe Sufia::Forms::GenericFileEditForm do
4
4
  subject { described_class.new(GenericFile.new) }
5
5
 
6
6
  describe "#terms" do
7
- it "should return a list" do
7
+ it "returns a list" do
8
8
  expect(subject.terms).to eq([:resource_type, :title, :creator, :contributor, :description, :tag,
9
- :rights, :publisher, :date_created, :subject, :language, :identifier, :based_near, :related_url])
9
+ :rights, :publisher, :date_created, :subject, :language, :identifier, :based_near, :related_url])
10
10
  end
11
11
 
12
12
  it "doesn't contain fields that users shouldn't be allowed to edit" do
@@ -15,19 +15,18 @@ describe Sufia::Forms::GenericFileEditForm do
15
15
  end
16
16
  end
17
17
 
18
- it "should initialize multivalued fields" do
18
+ it "initializes multivalued fields" do
19
19
  expect(subject.title).to eq ['']
20
20
  end
21
21
 
22
22
  describe ".model_attributes" do
23
- let(:params) { ActionController::Parameters.new(title: ['foo'], description: [''], "permissions_attributes"=>{"2"=>{"access"=>"edit", "_destroy"=>"true", "id"=>"a987551e-b87f-427a-8721-3e5942273125"}})}
23
+ let(:params) { ActionController::Parameters.new(title: ['foo'], description: [''], "permissions_attributes" => { "2" => { "access" => "edit", "_destroy" => "true", "id" => "a987551e-b87f-427a-8721-3e5942273125" } }) }
24
24
  subject { described_class.model_attributes(params) }
25
25
 
26
- it "should only change title" do
26
+ it "onlies change title" do
27
27
  expect(subject['title']).to eq ["foo"]
28
28
  expect(subject['description']).to be_empty
29
- expect(subject['permissions_attributes']).to eq("2" => {"access"=>"edit", "id"=>"a987551e-b87f-427a-8721-3e5942273125", "_destroy"=>"true"})
29
+ expect(subject['permissions_attributes']).to eq("2" => { "access" => "edit", "id" => "a987551e-b87f-427a-8721-3e5942273125", "_destroy" => "true" })
30
30
  end
31
31
  end
32
-
33
32
  end
@@ -1,9 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe BatchEditsHelper, :type => :helper do
4
-
3
+ describe BatchEditsHelper, type: :helper do
5
4
  describe "#render_check_all" do
6
-
7
5
  before do
8
6
  @document_list = ["doc1", "doc2"]
9
7
  @batch_size_on_other_page = 1
@@ -11,34 +9,32 @@ describe BatchEditsHelper, :type => :helper do
11
9
  end
12
10
 
13
11
  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" })
12
+ it "shows the check all dropdown" do
13
+ allow(helper).to receive(:params).and_return(controller: "my/files")
16
14
  allow(helper).to receive(:controller_name).and_return("batch_edits")
17
15
  expect(helper.render_check_all).to have_css("span.glyphicon-cog")
18
16
  end
19
17
 
20
- it "should show my action menu for my controller" do
21
- allow(helper).to receive(:params).and_return({ controller: "my" })
18
+ it "shows my action menu for my controller" do
19
+ allow(helper).to receive(:params).and_return(controller: "my")
22
20
  allow(helper).to receive(:controller_name).and_return("my")
23
21
  expect(helper.render_check_all).not_to have_content("ABC")
24
22
  end
25
23
  end
26
24
 
27
25
  context "with my collections" do
28
- it "should not show the check all dropdown" do
29
- allow(helper).to receive(:params).and_return({ controller: "my/collections" })
26
+ it "does not show the check all dropdown" do
27
+ allow(helper).to receive(:params).and_return(controller: "my/collections")
30
28
  expect(helper.render_check_all).to be_nil
31
29
  end
32
30
  end
33
31
 
34
32
  context "with select all disabled" do
35
- it "should not show the check all dropdown" do
36
- allow(helper).to receive(:params).and_return({ controller: "foo" })
33
+ it "does not show the check all dropdown" do
34
+ allow(helper).to receive(:params).and_return(controller: "foo")
37
35
  assign(:disable_select_all, true)
38
36
  expect(helper.render_check_all).to have_css("input[disabled=disabled]")
39
37
  end
40
38
  end
41
-
42
39
  end
43
-
44
40
  end
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe ContentBlockHelper, :type => :helper do
3
+ describe ContentBlockHelper, type: :helper do
4
4
  let(:content_block) { FactoryGirl.create(:content_block, value: "<p>foo bar</p>") }
5
5
 
6
6
  subject { helper.editable_content_block(content_block) }
@@ -12,7 +12,7 @@ describe ContentBlockHelper, :type => :helper do
12
12
  end
13
13
  let(:node) { Capybara::Node::Simple.new(subject) }
14
14
 
15
- it "should show the preview and the form" do
15
+ it "shows the preview and the form" do
16
16
  expect(node).to have_selector "button[data-target='#edit_content_block_1'][data-behavior='reveal-editor']"
17
17
  expect(node).to have_selector "form#edit_content_block_1[action='#{sufia.content_block_path(content_block)}']"
18
18
  expect(subject).to be_html_safe
@@ -33,7 +33,7 @@ describe ContentBlockHelper, :type => :helper do
33
33
  before do
34
34
  expect(helper).to receive(:can?).with(:update, content_block).and_return(false)
35
35
  end
36
- it "should show the content" do
36
+ it "shows the content" do
37
37
  expect(subject).to eq '<p>foo bar</p>'
38
38
  expect(subject).to be_html_safe
39
39
  end
@@ -1,10 +1,9 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe DashboardHelper, :type => :helper do
4
-
3
+ describe DashboardHelper, type: :helper do
5
4
  describe "#render_recent_activity" do
6
5
  context "when there is no activity" do
7
- it "should return a messages stating the user has no recent activity" do
6
+ it "returns a messages stating the user has no recent activity" do
8
7
  assign(:activity, [])
9
8
  expect(helper.render_recent_activity).to include("no recent activity")
10
9
  end
@@ -13,7 +12,7 @@ describe DashboardHelper, :type => :helper do
13
12
 
14
13
  describe "#render_recent_notifications" do
15
14
  context "when there are no notifications" do
16
- it "should return a messages stating the user has no recent notifications" do
15
+ it "returns a messages stating the user has no recent notifications" do
17
16
  assign(:notifications, [])
18
17
  expect(helper.render_recent_notifications).to include("no notifications")
19
18
  end
@@ -21,35 +20,34 @@ describe DashboardHelper, :type => :helper do
21
20
  end
22
21
 
23
22
  describe "#on_the_dashboard?" do
24
- it "should return false for controllers that aren't a part of the dashboard" do
25
- allow(helper).to receive(:params).and_return({ controller: "foo" })
23
+ it "returns false for controllers that aren't a part of the dashboard" do
24
+ allow(helper).to receive(:params).and_return(controller: "foo")
26
25
  expect(helper).to_not be_on_the_dashboard
27
26
  end
28
27
 
29
- it "should return true for controllers that are part of the dashboard" do
30
- allow(helper).to receive(:params).and_return({ controller: "my/files" })
28
+ it "returns true for controllers that are part of the dashboard" do
29
+ allow(helper).to receive(:params).and_return(controller: "my/files")
31
30
  expect(helper).to be_on_the_dashboard
32
- allow(helper).to receive(:params).and_return({ controller: "my/collections" })
31
+ allow(helper).to receive(:params).and_return(controller: "my/collections")
33
32
  expect(helper).to be_on_the_dashboard
34
- allow(helper).to receive(:params).and_return({ controller: "my/highlights" })
33
+ allow(helper).to receive(:params).and_return(controller: "my/highlights")
35
34
  expect(helper).to be_on_the_dashboard
36
- allow(helper).to receive(:params).and_return({ controller: "my/shares" })
35
+ allow(helper).to receive(:params).and_return(controller: "my/shares")
37
36
  expect(helper).to be_on_the_dashboard
38
37
  end
39
38
  end
40
39
 
41
40
  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" })
41
+ it "returns false when the controller isn't my files" do
42
+ allow(helper).to receive(:params).and_return(controller: "my/collections")
44
43
  expect(helper).to_not be_on_my_files
45
44
  end
46
- it "should return true when the controller is my files" do
47
- allow(helper).to receive(:params).and_return({ controller: "my/files" })
45
+ it "returns true when the controller is my files" do
46
+ allow(helper).to receive(:params).and_return(controller: "my/files")
48
47
  expect(helper).to be_on_my_files
49
48
  end
50
49
  end
51
50
 
52
-
53
51
  describe "#number_of_files" do
54
52
  let(:conn) { ActiveFedora::SolrService.instance.conn }
55
53
  let(:user1) { User.new(email: "abc@test") }
@@ -61,7 +59,6 @@ describe DashboardHelper, :type => :helper do
61
59
  it "finds only 3 files" do
62
60
  expect(helper.number_of_files(user1)).to eq(3)
63
61
  end
64
-
65
62
  end
66
63
 
67
64
  describe "#number_of_collections" do
@@ -75,20 +72,18 @@ describe DashboardHelper, :type => :helper do
75
72
  it "finds only 3 files" do
76
73
  expect(helper.number_of_collections(user1)).to eq(3)
77
74
  end
78
-
79
75
  end
80
76
 
81
- def create_models (model, user1, user2)
77
+ def create_models(model, user1, user2)
82
78
  # deposited by the first user
83
79
  3.times do |t|
84
- conn.add id: "199#{t}", Solrizer.solr_name('depositor', :stored_searchable) => user1.user_key, "has_model_ssim"=>[model],
85
- Solrizer.solr_name('depositor', :symbol) => user1.user_key
80
+ conn.add id: "199#{t}", Solrizer.solr_name('depositor', :stored_searchable) => user1.user_key, "has_model_ssim" => [model],
81
+ Solrizer.solr_name('depositor', :symbol) => user1.user_key
86
82
  end
87
83
 
88
84
  # deposited by the second user, but editable by the first
89
- conn.add id: "1994", Solrizer.solr_name('depositor', :stored_searchable) => user2.user_key, "has_model_ssim"=>[model],
90
- Solrizer.solr_name('depositor', :symbol) => user2.user_key, "edit_access_person_ssim" =>user1.user_key
85
+ conn.add id: "1994", Solrizer.solr_name('depositor', :stored_searchable) => user2.user_key, "has_model_ssim" => [model],
86
+ Solrizer.solr_name('depositor', :symbol) => user2.user_key, "edit_access_person_ssim" => user1.user_key
91
87
  conn.commit
92
88
  end
93
-
94
89
  end
@@ -1,33 +1,31 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe GenericFileHelper do
4
-
5
4
  describe "#render_collection_list" do
6
5
  context "using a file that is part of a collection" do
7
-
8
6
  let(:collection) do
9
7
  mock_model(Collection, title: "Foo Collection")
10
8
  end
11
9
 
12
10
  let(:gf) do
13
- mock_model(GenericFile, { collections: [collection, collection] })
11
+ mock_model(GenericFile, collections: [collection, collection])
14
12
  end
15
13
 
16
14
  let(:link) do
17
15
  "<a href=\"/collections/#{collection.id}\">#{collection.title}</a>"
18
16
  end
19
17
 
20
- it "should display a comma-delimited list of collections" do
21
- expect(helper.render_collection_list(gf)).to eq("Is part of: " + [link,link].join(", "))
18
+ it "displays a comma-delimited list of collections" do
19
+ expect(helper.render_collection_list(gf)).to eq("Is part of: " + [link, link].join(", "))
22
20
  end
23
21
  end
24
22
 
25
23
  context "using a file that is not part of a collection" do
26
24
  let(:gf) do
27
- mock_model(GenericFile, { collections: [] })
25
+ mock_model(GenericFile, collections: [])
28
26
  end
29
27
 
30
- it "should render nothing" do
28
+ it "renders nothing" do
31
29
  expect(helper.render_collection_list(gf)).to be_nil
32
30
  end
33
31
  end
@@ -1,7 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe SufiaHelper, :type => :helper do
4
-
3
+ describe SufiaHelper, type: :helper do
5
4
  describe "#link_to_facet_list" do
6
5
  before do
7
6
  allow(helper).to receive(:blacklight_config).and_return(CatalogController.blacklight_config)
@@ -10,9 +9,9 @@ describe SufiaHelper, :type => :helper do
10
9
  context "with values" do
11
10
  subject { helper.link_to_facet_list(['car', 'truck'], 'vehicle_type') }
12
11
 
13
- it "should join the values" do
14
- car_link = catalog_index_path(f: {'vehicle_type_sim' => ['car']})
15
- truck_link = catalog_index_path(f: {'vehicle_type_sim' => ['truck']})
12
+ it "joins the values" do
13
+ car_link = catalog_index_path(f: { 'vehicle_type_sim' => ['car'] })
14
+ truck_link = catalog_index_path(f: { 'vehicle_type_sim' => ['truck'] })
16
15
  expect(subject).to eq "<a href=\"#{car_link}\">car</a>, <a href=\"#{truck_link}\">truck</a>"
17
16
  expect(subject).to be_html_safe
18
17
  end
@@ -21,7 +20,7 @@ describe SufiaHelper, :type => :helper do
21
20
  context "without values" do
22
21
  subject { helper.link_to_facet_list([], 'vehicle_type') }
23
22
 
24
- it "should show the default text" do
23
+ it "shows the default text" do
25
24
  expect(subject).to eq "No value entered"
26
25
  end
27
26
  end
@@ -30,36 +29,36 @@ describe SufiaHelper, :type => :helper do
30
29
  describe "has_collection_search_parameters?" do
31
30
  subject { helper }
32
31
  context "when cq is set" do
33
- before { allow(helper).to receive(:params).and_return({ cq: 'foo'}) }
32
+ before { allow(helper).to receive(:params).and_return(cq: 'foo') }
34
33
  it { is_expected.to have_collection_search_parameters }
35
34
  end
36
35
 
37
36
  context "when cq is not set" do
38
- before { allow(helper).to receive(:params).and_return({ cq: ''}) }
37
+ before { allow(helper).to receive(:params).and_return(cq: '') }
39
38
  it { is_expected.not_to have_collection_search_parameters }
40
39
  end
41
40
  end
42
41
 
43
42
  describe "sufia_thumbnail_tag" do
44
43
  context "for an image object" do
45
- let(:document) { SolrDocument.new( mime_type_tesim: 'image/jpeg', id: '1234' ) }
46
- it "should show the audio thumbnail" do
47
- rendered = helper.sufia_thumbnail_tag(document, { width: 90 })
44
+ let(:document) { SolrDocument.new(mime_type_tesim: 'image/jpeg', id: '1234') }
45
+ it "shows the audio thumbnail" do
46
+ rendered = helper.sufia_thumbnail_tag(document, width: 90)
48
47
  expect(rendered).to match(/src="\/downloads\/1234\?file=thumbnail"/)
49
48
  expect(rendered).to match(/width="90"/)
50
49
  end
51
50
  end
52
51
  context "for an audio object" do
53
- let(:document) { SolrDocument.new( mime_type_tesim: 'audio/x-wave', id: '1234') }
54
- it "should show the audio thumbnail" do
52
+ let(:document) { SolrDocument.new(mime_type_tesim: 'audio/x-wave', id: '1234') }
53
+ it "shows the audio thumbnail" do
55
54
  rendered = helper.sufia_thumbnail_tag(document, {})
56
55
  expect(rendered).to match(/src="\/assets\/audio.png"/)
57
56
  end
58
57
  end
59
58
  context "for an document object" do
60
- let(:document) { SolrDocument.new( mime_type_tesim: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', id: '1234') }
61
- it "should show the default thumbnail" do
62
- rendered = helper.sufia_thumbnail_tag(document, { width: 90 })
59
+ let(:document) { SolrDocument.new(mime_type_tesim: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', id: '1234') }
60
+ it "shows the default thumbnail" do
61
+ rendered = helper.sufia_thumbnail_tag(document, width: 90)
63
62
  expect(rendered).to match(/src="\/downloads\/1234\?file=thumbnail"/)
64
63
  expect(rendered).to match(/width="90"/)
65
64
  end
@@ -67,101 +66,93 @@ describe SufiaHelper, :type => :helper do
67
66
  end
68
67
 
69
68
  describe "#link_to_telephone" do
70
-
71
69
  before do
72
70
  @user = mock_model(User)
73
71
  allow(@user).to receive(:telephone).and_return('867-5309')
74
72
  end
75
73
 
76
74
  context "when @user is set" do
77
- it "should return a link to the user's telephone" do
75
+ it "returns a link to the user's telephone" do
78
76
  expect(helper.link_to_telephone).to eq("<a href=\"wtai://wp/mc;867-5309\">867-5309</a>")
79
77
  end
80
78
  end
81
79
 
82
80
  context "when @user is not set" do
83
- it "should return a link to the user's telephone" do
81
+ it "returns a link to the user's telephone" do
84
82
  expect(helper.link_to_telephone(@user)).to eq("<a href=\"wtai://wp/mc;867-5309\">867-5309</a>")
85
83
  end
86
84
  end
87
-
88
85
  end
89
86
 
90
87
  describe "#current_search_parameters" do
91
-
92
88
  context "when the user is not in the dashboard" do
93
- it "should be whatever q is" do
94
- allow(helper).to receive(:params).and_return({ controller: "catalog", q: "foo" })
89
+ it "is whatever q is" do
90
+ allow(helper).to receive(:params).and_return(controller: "catalog", q: "foo")
95
91
  expect(helper.current_search_parameters).to eq("foo")
96
92
  end
97
93
  end
98
94
 
99
95
  context "when the user is on any dashboard page" do
100
-
101
- it "should be ignored on dashboard" do
102
- allow(helper).to receive(:params).and_return({ controller: "dashboard", q: "foo" })
96
+ it "is ignored on dashboard" do
97
+ allow(helper).to receive(:params).and_return(controller: "dashboard", q: "foo")
103
98
  expect(helper.current_search_parameters).to be_nil
104
99
  end
105
100
 
106
- it "should be ignored on dashboard files, collections, highlights and shares" do
107
- allow(helper).to receive(:params).and_return({ controller: "my/files", q: "foo" })
101
+ it "is ignored on dashboard files, collections, highlights and shares" do
102
+ allow(helper).to receive(:params).and_return(controller: "my/files", q: "foo")
108
103
  expect(helper.current_search_parameters).to be_nil
109
- allow(helper).to receive(:params).and_return({ controller: "my/collections", q: "foo" })
104
+ allow(helper).to receive(:params).and_return(controller: "my/collections", q: "foo")
110
105
  expect(helper.current_search_parameters).to be_nil
111
- allow(helper).to receive(:params).and_return({ controller: "my/highlights", q: "foo" })
106
+ allow(helper).to receive(:params).and_return(controller: "my/highlights", q: "foo")
112
107
  expect(helper.current_search_parameters).to be_nil
113
- allow(helper).to receive(:params).and_return({ controller: "my/shares", q: "foo" })
108
+ allow(helper).to receive(:params).and_return(controller: "my/shares", q: "foo")
114
109
  expect(helper.current_search_parameters).to be_nil
115
110
  end
116
-
117
111
  end
118
-
119
112
  end
120
113
 
121
114
  describe "#search_form_action" do
122
-
123
115
  context "when the user is not in the dashboard" do
124
- it "should return the catalog index path" do
125
- allow(helper).to receive(:params).and_return({ controller: "foo" })
116
+ it "returns the catalog index path" do
117
+ allow(helper).to receive(:params).and_return(controller: "foo")
126
118
  expect(helper.search_form_action).to eq(catalog_index_path)
127
119
  end
128
120
  end
129
121
 
130
122
  context "when the user is on the dashboard page" do
131
- it "should default to My Files" do
132
- allow(helper).to receive(:params).and_return({ controller: "dashboard" })
123
+ it "defaults to My Files" do
124
+ allow(helper).to receive(:params).and_return(controller: "dashboard")
133
125
  expect(helper.search_form_action).to eq(sufia.dashboard_files_path)
134
126
  end
135
127
  end
136
128
 
137
129
  context "when the user is on the my files page" do
138
- it "should return the my dashboard files path" do
139
- allow(helper).to receive(:params).and_return({ controller: "my/files" })
130
+ it "returns the my dashboard files path" do
131
+ allow(helper).to receive(:params).and_return(controller: "my/files")
140
132
  expect(helper.search_form_action).to eq(sufia.dashboard_files_path)
141
133
  end
142
134
  end
143
135
 
144
136
  context "when the user is on the my collections page" do
145
- it "should return the my dashboard collections path" do
146
- allow(helper).to receive(:params).and_return({ controller: "my/collections" })
137
+ it "returns the my dashboard collections path" do
138
+ allow(helper).to receive(:params).and_return(controller: "my/collections")
147
139
  expect(helper.search_form_action).to eq(sufia.dashboard_collections_path)
148
140
  end
149
141
  end
150
142
 
151
143
  context "when the user is on the my highlights page" do
152
- it "should return the my dashboard highlights path" do
153
- allow(helper).to receive(:params).and_return({ controller: "my/highlights" })
144
+ it "returns the my dashboard highlights path" do
145
+ allow(helper).to receive(:params).and_return(controller: "my/highlights")
154
146
  expect(helper.search_form_action).to eq(sufia.dashboard_highlights_path)
155
147
  end
156
148
  end
157
149
 
158
150
  context "when the user is on the my shares page" do
159
- it "should return the my dashboard shares path" do
160
- allow(helper).to receive(:params).and_return({ controller: "my/shares" })
151
+ it "returns the my dashboard shares path" do
152
+ allow(helper).to receive(:params).and_return(controller: "my/shares")
161
153
  expect(helper.search_form_action).to eq(sufia.dashboard_shares_path)
162
154
  end
163
155
  end
164
-
165
156
  end
166
157
 
167
158
  describe '#zotero_label' do
@@ -182,19 +173,17 @@ describe SufiaHelper, :type => :helper do
182
173
  expect(helper.number_of_deposits(user1)).to eq(3)
183
174
  end
184
175
 
185
- def create_models (model, user1, user2)
176
+ def create_models(model, user1, user2)
186
177
  # deposited by the first user
187
178
  3.times do |t|
188
- conn.add id: "199#{t}", Solrizer.solr_name('depositor', :stored_searchable) => user1.user_key, "has_model_ssim"=>[model],
189
- Solrizer.solr_name('depositor', :symbol) => user1.user_key
179
+ conn.add id: "199#{t}", Solrizer.solr_name('depositor', :stored_searchable) => user1.user_key, "has_model_ssim" => [model],
180
+ Solrizer.solr_name('depositor', :symbol) => user1.user_key
190
181
  end
191
182
 
192
183
  # deposited by the second user, but editable by the first
193
- conn.add id: "1994", Solrizer.solr_name('depositor', :stored_searchable) => user2.user_key, "has_model_ssim"=>[model],
194
- Solrizer.solr_name('depositor', :symbol) => user2.user_key, "edit_access_person_ssim" =>user1.user_key
184
+ conn.add id: "1994", Solrizer.solr_name('depositor', :stored_searchable) => user2.user_key, "has_model_ssim" => [model],
185
+ Solrizer.solr_name('depositor', :symbol) => user2.user_key, "edit_access_person_ssim" => user1.user_key
195
186
  conn.commit
196
187
  end
197
-
198
188
  end
199
-
200
189
  end