blacklight-spotlight 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (215) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +0 -4
  3. data/app/assets/javascripts/spotlight/blocks/link_to_search_block.js +16 -0
  4. data/app/assets/javascripts/spotlight/exhibits.js +16 -5
  5. data/app/assets/javascripts/spotlight/form_observer.js +2 -2
  6. data/app/assets/javascripts/spotlight/pages.js.erb +3 -2
  7. data/app/assets/javascripts/spotlight/sir-trevor/locales.js +6 -0
  8. data/app/controllers/spotlight/concerns/application_controller.rb +4 -8
  9. data/app/controllers/spotlight/contact_email_controller.rb +22 -0
  10. data/app/controllers/spotlight/searches_controller.rb +3 -1
  11. data/app/models/concerns/spotlight/blacklight_configuration_defaults.rb +4 -4
  12. data/app/models/sir_trevor_rails/blocks/browse_block.rb +7 -1
  13. data/app/models/sir_trevor_rails/blocks/featured_pages_block.rb +3 -1
  14. data/app/models/sir_trevor_rails/blocks/link_to_search_block.rb +15 -0
  15. data/app/models/spotlight/ability.rb +1 -1
  16. data/app/models/spotlight/blacklight_configuration.rb +8 -7
  17. data/app/models/spotlight/exhibit.rb +2 -0
  18. data/app/models/spotlight/resource.rb +8 -2
  19. data/app/services/spotlight/carrierwave_file_resolver.rb +5 -0
  20. data/app/services/spotlight/upload_solr_document_builder.rb +2 -2
  21. data/app/views/spotlight/appearances/edit.html.erb +1 -1
  22. data/app/views/spotlight/exhibits/_confirmation_status.html.erb +1 -1
  23. data/app/views/spotlight/exhibits/_contact.html.erb +15 -10
  24. data/app/views/spotlight/exhibits/_exhibit_card_back.html.erb +2 -2
  25. data/app/views/spotlight/exhibits/_form.html.erb +7 -6
  26. data/app/views/spotlight/metadata_configurations/edit.html.erb +1 -1
  27. data/app/views/spotlight/pages/_form.html.erb +1 -1
  28. data/app/views/spotlight/search_configurations/_facets.html.erb +1 -1
  29. data/app/views/spotlight/search_configurations/_search_fields.html.erb +1 -1
  30. data/app/views/spotlight/search_configurations/_sort.html.erb +1 -1
  31. data/app/views/spotlight/sir_trevor/blocks/_link_to_search_block.html.erb +23 -0
  32. data/config/locales/spotlight.en.yml +9 -0
  33. data/config/routes.rb +1 -0
  34. data/db/migrate/20171005231502_add_missing_indexes_on_taggings.acts_as_taggable_on_engine.rb +23 -0
  35. data/lib/spotlight/engine.rb +4 -3
  36. data/lib/spotlight/version.rb +1 -1
  37. data/spec/controllers/application_controller_spec.rb +1 -1
  38. data/spec/controllers/spotlight/about_pages_controller_spec.rb +15 -15
  39. data/spec/controllers/spotlight/admin_users_controller_spec.rb +4 -4
  40. data/spec/controllers/spotlight/appearances_controller_spec.rb +3 -3
  41. data/spec/controllers/spotlight/application_controller_spec.rb +1 -1
  42. data/spec/controllers/spotlight/attachments_controller_spec.rb +2 -2
  43. data/spec/controllers/spotlight/browse_controller_spec.rb +4 -4
  44. data/spec/controllers/spotlight/catalog_controller_spec.rb +15 -15
  45. data/spec/controllers/spotlight/confirmations_controller_spec.rb +1 -1
  46. data/spec/controllers/spotlight/contact_email_controller_spec.rb +63 -0
  47. data/spec/controllers/spotlight/contact_forms_controller_spec.rb +1 -1
  48. data/spec/controllers/spotlight/contacts_controller_spec.rb +5 -5
  49. data/spec/controllers/spotlight/custom_fields_controller_spec.rb +3 -3
  50. data/spec/controllers/spotlight/dashboards_controller_spec.rb +3 -3
  51. data/spec/controllers/spotlight/exhibits_controller_spec.rb +4 -4
  52. data/spec/controllers/spotlight/feature_pages_controller_spec.rb +12 -12
  53. data/spec/controllers/spotlight/featured_images_controller_spec.rb +2 -2
  54. data/spec/controllers/spotlight/filters_controller_spec.rb +4 -4
  55. data/spec/controllers/spotlight/home_pages_controller_spec.rb +5 -5
  56. data/spec/controllers/spotlight/metadata_configurations_controller_spec.rb +3 -3
  57. data/spec/controllers/spotlight/resources/csv_upload_controller_spec.rb +2 -2
  58. data/spec/controllers/spotlight/resources/upload_controller_spec.rb +2 -2
  59. data/spec/controllers/spotlight/resources_controller_spec.rb +2 -2
  60. data/spec/controllers/spotlight/roles_controller_spec.rb +4 -4
  61. data/spec/controllers/spotlight/search_configurations_controller_spec.rb +3 -3
  62. data/spec/controllers/spotlight/searches_controller_spec.rb +10 -11
  63. data/spec/controllers/spotlight/sites_controller_spec.rb +5 -5
  64. data/spec/controllers/spotlight/solr_controller_spec.rb +3 -3
  65. data/spec/controllers/spotlight/tags_controller_spec.rb +3 -3
  66. data/spec/controllers/spotlight/versions_controller_spec.rb +7 -7
  67. data/spec/controllers/spotlight/view_configurations_controller_spec.rb +3 -3
  68. data/spec/examples.txt +1154 -1136
  69. data/spec/factories/contact_emails.rb +6 -0
  70. data/spec/factories/contact_images.rb +1 -1
  71. data/spec/factories/contacts.rb +1 -1
  72. data/spec/factories/custom_fields.rb +1 -1
  73. data/spec/factories/exhibit_thumbnails.rb +1 -1
  74. data/spec/factories/exhibits.rb +2 -2
  75. data/spec/factories/featured_images.rb +1 -1
  76. data/spec/factories/pages.rb +2 -2
  77. data/spec/factories/reindexing_log_entries.rb +1 -1
  78. data/spec/factories/resources.rb +1 -1
  79. data/spec/factories/roles.rb +2 -2
  80. data/spec/factories/searches.rb +3 -3
  81. data/spec/factories/tags.rb +3 -3
  82. data/spec/factories/users.rb +2 -2
  83. data/spec/features/about_page_spec.rb +6 -6
  84. data/spec/features/add_contacts_spec.rb +3 -3
  85. data/spec/features/add_custom_field_metadata_spec.rb +4 -4
  86. data/spec/features/add_iiif_manifest_spec.rb +2 -2
  87. data/spec/features/add_items_spec.rb +4 -4
  88. data/spec/features/autocomplete_typeahead_spec.rb +3 -4
  89. data/spec/features/browse_category_admin_spec.rb +3 -3
  90. data/spec/features/browse_category_spec.rb +3 -3
  91. data/spec/features/catalog_spec.rb +3 -3
  92. data/spec/features/confirm_email_spec.rb +1 -1
  93. data/spec/features/create_exhibit_spec.rb +1 -1
  94. data/spec/features/create_page_spec.rb +5 -5
  95. data/spec/features/curator_items.rb +2 -2
  96. data/spec/features/dashboard_spec.rb +4 -4
  97. data/spec/features/edit_contact_spec.rb +4 -4
  98. data/spec/features/edit_search_fields_spec.rb +2 -2
  99. data/spec/features/exhibit_masthead_spec.rb +2 -2
  100. data/spec/features/exhibit_themes_spec.rb +2 -2
  101. data/spec/features/exhibits/add_tags_spec.rb +3 -3
  102. data/spec/features/exhibits/administration_spec.rb +78 -4
  103. data/spec/features/exhibits/custom_metadata_fields_spec.rb +2 -2
  104. data/spec/features/exhibits/edit_metadata_fields_spec.rb +2 -2
  105. data/spec/features/exhibits_index_spec.rb +3 -3
  106. data/spec/features/feature_page_spec.rb +9 -9
  107. data/spec/features/home_page_spec.rb +4 -4
  108. data/spec/features/import_exhibit_spec.rb +2 -2
  109. data/spec/features/item_admin_spec.rb +2 -2
  110. data/spec/features/javascript/about_page_admin_spec.rb +2 -2
  111. data/spec/features/javascript/block_controls_spec.rb +2 -2
  112. data/spec/features/javascript/blocks/featured_browse_categories_block_spec.rb +5 -5
  113. data/spec/features/javascript/blocks/featured_pages_block_spec.rb +4 -4
  114. data/spec/features/javascript/blocks/link_to_search_block_spec.rb +44 -0
  115. data/spec/features/javascript/{rule_block_spec.rb → blocks/rule_block_spec.rb} +4 -4
  116. data/spec/features/javascript/blocks/search_result_block_spec.rb +4 -4
  117. data/spec/features/javascript/blocks/solr_documents_block_spec.rb +5 -6
  118. data/spec/features/javascript/blocks/uploaded_items_block_spec.rb +3 -4
  119. data/spec/features/javascript/edit_in_place_spec.rb +2 -2
  120. data/spec/features/javascript/feature_page_admin_spec.rb +26 -7
  121. data/spec/features/javascript/home_page_edit_spec.rb +3 -3
  122. data/spec/features/javascript/metadata_admin_spec.rb +2 -2
  123. data/spec/features/javascript/multi_image_select_spec.rb +6 -6
  124. data/spec/features/javascript/reindex_monitor_spec.rb +4 -4
  125. data/spec/features/javascript/roles_admin_spec.rb +3 -3
  126. data/spec/features/javascript/search_config_admin_spec.rb +2 -3
  127. data/spec/features/javascript/search_context_spec.rb +6 -6
  128. data/spec/features/main_navigation_spec.rb +2 -2
  129. data/spec/features/metadata_admin_spec.rb +2 -2
  130. data/spec/features/report_a_problem_spec.rb +2 -2
  131. data/spec/features/site_admin_management_spec.rb +4 -4
  132. data/spec/features/site_masthead_spec.rb +1 -1
  133. data/spec/features/slideshow_spec.rb +4 -3
  134. data/spec/features/tags_admin_spec.rb +3 -3
  135. data/spec/features/user_admin_spec.rb +2 -2
  136. data/spec/helpers/spotlight/application_helper_spec.rb +2 -2
  137. data/spec/helpers/spotlight/crud_link_helpers_spec.rb +1 -1
  138. data/spec/helpers/spotlight/main_app_helpers_spec.rb +3 -3
  139. data/spec/helpers/spotlight/meta_helper_spec.rb +1 -1
  140. data/spec/helpers/spotlight/pages_helper_spec.rb +2 -2
  141. data/spec/jobs/spotlight/add_uploads_from_csv_spec.rb +3 -3
  142. data/spec/jobs/spotlight/reindex_job_spec.rb +3 -3
  143. data/spec/jobs/spotlight/rename_sidecar_field_job_spec.rb +1 -1
  144. data/spec/lib/migration/iiif_spec.rb +3 -3
  145. data/spec/lib/spotlight/controller_spec.rb +3 -3
  146. data/spec/models/sir_trevor_rails/blocks/browse_block_spec.rb +19 -1
  147. data/spec/models/sir_trevor_rails/blocks/featured_pages_block_spec.rb +9 -1
  148. data/spec/models/sir_trevor_rails/blocks/search_results_block_spec.rb +1 -1
  149. data/spec/models/sir_trevor_rails/blocks/solr_documents_block_spec.rb +1 -1
  150. data/spec/models/solr_document_spec.rb +2 -2
  151. data/spec/models/spotlight/ability_spec.rb +9 -9
  152. data/spec/models/spotlight/about_page_spec.rb +1 -1
  153. data/spec/models/spotlight/access_controls_enforcement_search_builder_spec.rb +1 -1
  154. data/spec/models/spotlight/blacklight_configuration_spec.rb +15 -1
  155. data/spec/models/spotlight/contact_email_spec.rb +1 -1
  156. data/spec/models/spotlight/contact_form_spec.rb +1 -1
  157. data/spec/models/spotlight/contact_spec.rb +1 -1
  158. data/spec/models/spotlight/custom_field_spec.rb +5 -5
  159. data/spec/models/spotlight/exhibit_spec.rb +20 -16
  160. data/spec/models/spotlight/feature_page_spec.rb +14 -14
  161. data/spec/models/spotlight/field_metadata_spec.rb +1 -1
  162. data/spec/models/spotlight/home_page_spec.rb +1 -1
  163. data/spec/models/spotlight/main_navigation_spec.rb +1 -1
  164. data/spec/models/spotlight/page_spec.rb +12 -8
  165. data/spec/models/spotlight/reindex_progress_spec.rb +4 -4
  166. data/spec/models/spotlight/reindexing_log_entry_spec.rb +8 -8
  167. data/spec/models/spotlight/resource_spec.rb +12 -1
  168. data/spec/models/spotlight/resources/iiif_harvester_spec.rb +1 -1
  169. data/spec/models/spotlight/resources/iiif_manifest_spec.rb +1 -1
  170. data/spec/models/spotlight/resources/upload_spec.rb +3 -3
  171. data/spec/models/spotlight/role_spec.rb +3 -3
  172. data/spec/models/spotlight/search_spec.rb +7 -7
  173. data/spec/models/spotlight/sitemap_spec.rb +6 -6
  174. data/spec/models/spotlight/solr_document_sidecar_spec.rb +1 -1
  175. data/spec/presenters/spotlight/iiif_manifest_presenter_spec.rb +1 -1
  176. data/spec/serializers/spotlight/exhibit_export_serializer_spec.rb +20 -20
  177. data/spec/services/spotlight/carrierwave_file_resolver_spec.rb +1 -1
  178. data/spec/services/spotlight/iiif_resource_resolver_spec.rb +1 -1
  179. data/spec/services/spotlight/solr_document_builder_spec.rb +3 -3
  180. data/spec/spec_helper.rb +4 -5
  181. data/spec/support/features/test_features_helpers.rb +2 -2
  182. data/spec/uploaders/spotlight/featured_image_uploader_spec.rb +1 -1
  183. data/spec/views/_user_util_links.html.erb_spec.rb +1 -1
  184. data/spec/views/shared/_exhibit_navbar.html.erb_spec.rb +9 -9
  185. data/spec/views/shared/_masthead.html.erb_spec.rb +3 -3
  186. data/spec/views/spotlight/about_pages/_sidebar.html.erb_spec.rb +4 -4
  187. data/spec/views/spotlight/browse/_search.html.erb_spec.rb +2 -2
  188. data/spec/views/spotlight/browse/index.html.erb_spec.rb +2 -2
  189. data/spec/views/spotlight/browse/show.html.erb_spec.rb +2 -2
  190. data/spec/views/spotlight/contacts/edit.html.erb_spec.rb +1 -1
  191. data/spec/views/spotlight/dashboards/_analytics.html.erb_spec.rb +1 -1
  192. data/spec/views/spotlight/dashboards/_reindexing_activity.html.erb_spec.rb +6 -6
  193. data/spec/views/spotlight/dashboards/analytics.html.erb_spec.rb +1 -1
  194. data/spec/views/spotlight/exhibits/_exhibit_card_front.html.erb_spec.rb +1 -1
  195. data/spec/views/spotlight/exhibits/edit.html.erb_spec.rb +1 -1
  196. data/spec/views/spotlight/exhibits/index.html.erb_spec.rb +6 -6
  197. data/spec/views/spotlight/feature_pages/_sidebar.html.erb_spec.rb +8 -8
  198. data/spec/views/spotlight/home_pages/_empty.html.erb_spec.rb +1 -1
  199. data/spec/views/spotlight/metadata_configurations/_metadata_field.html.erb_spec.rb +1 -1
  200. data/spec/views/spotlight/metadata_configurations/edit.html.erb_spec.rb +1 -1
  201. data/spec/views/spotlight/pages/_form.html.erb_spec.rb +18 -0
  202. data/spec/views/spotlight/roles/index.html.erb_spec.rb +2 -2
  203. data/spec/views/spotlight/search_configurations/_facets.html.erb_spec.rb +14 -2
  204. data/spec/views/spotlight/search_configurations/_search_fields.html.erb_spec.rb +9 -2
  205. data/spec/views/spotlight/search_configurations/_sort.html.erb_spec.rb +10 -1
  206. data/spec/views/spotlight/searches/_search.html.erb_spec.rb +8 -8
  207. data/spec/views/spotlight/searches/edit.html.erb_spec.rb +1 -1
  208. data/spec/views/spotlight/sir_trevor/blocks/_browse_block.html.erb_spec.rb +1 -1
  209. data/spec/views/spotlight/sir_trevor/blocks/_link_to_search_block.html.erb_spec.rb +18 -0
  210. data/spec/views/spotlight/sites/edit_exhibits.html.erb_spec.rb +2 -2
  211. data/spec/views/spotlight/tags/index.html.erb_spec.rb +3 -3
  212. metadata +226 -200
  213. data/app/assets/stylesheets/spotlight/application.scss +0 -5
  214. data/vendor/assets/javascripts/leaflet.js +0 -9
  215. data/vendor/assets/stylesheets/leaflet.css +0 -624
@@ -14,7 +14,7 @@ describe Spotlight::ConfirmationsController, type: :controller do
14
14
  end
15
15
 
16
16
  describe 'GET show' do
17
- let(:exhibit) { FactoryGirl.create(:exhibit) }
17
+ let(:exhibit) { FactoryBot.create(:exhibit) }
18
18
  let(:contact_email) { Spotlight::ContactEmail.create!(email: 'justin@example.com', exhibit: exhibit) }
19
19
  let(:raw_token) { contact_email.instance_variable_get(:@raw_confirmation_token) }
20
20
  describe 'when the token is invalid' do
@@ -0,0 +1,63 @@
1
+ describe Spotlight::ContactEmailController, type: :controller do
2
+ routes { Spotlight::Engine.routes }
3
+ let(:contact_email) { FactoryBot.create(:contact_email) }
4
+
5
+ context 'when not logged in' do
6
+ describe 'DELETE destroy' do
7
+ it 'redirects to the login page' do
8
+ # note about odd behavior: it was discovered in testing that if format: :json is explicitly specified here, the user is redirected
9
+ # to login on rails 4, but gets a 401 on rails 5. we suspect differing CanCan behavior, but didn't investigate in depth.
10
+ delete :destroy, params: { id: contact_email, exhibit_id: contact_email.exhibit }
11
+ # custom logic in ApplicationController redirects user to app login page on CanCan::AccessDenied if user can't read current exhibit
12
+ expect(response).to redirect_to main_app.new_user_session_path
13
+ end
14
+ end
15
+ end
16
+
17
+ context 'when logged in' do
18
+ before { sign_in user }
19
+
20
+ context 'as a visitor' do
21
+ let(:user) { FactoryBot.create(:exhibit_visitor) }
22
+
23
+ describe 'DELETE destroy' do
24
+ it 'redirects to the home page' do
25
+ delete :destroy, params: { id: contact_email, exhibit_id: contact_email.exhibit }
26
+ # custom logic in ApplicationController redirects user to app root on CanCan::AccessDenied if user's allowed to view current exhibit
27
+ expect(response).to redirect_to main_app.root_path
28
+ end
29
+ end
30
+ end
31
+
32
+ context 'as an exhibit curator' do
33
+ let(:user) { FactoryBot.create(:exhibit_curator, exhibit: contact_email.exhibit) }
34
+
35
+ describe 'DELETE destroy' do
36
+ it 'redirects to the home page' do
37
+ delete :destroy, params: { id: contact_email, exhibit_id: contact_email.exhibit }
38
+ # custom logic in ApplicationController redirects user to app root on CanCan::AccessDenied if user's allowed to view current exhibit
39
+ expect(response).to redirect_to main_app.root_path
40
+ end
41
+ end
42
+ end
43
+
44
+ context 'as an exhibit admin' do
45
+ let(:user) { FactoryBot.create(:exhibit_admin, exhibit: contact_email.exhibit) }
46
+
47
+ describe 'DELETE destroy' do
48
+ it 'is successful when the record exists' do
49
+ delete :destroy, params: { id: contact_email, exhibit_id: contact_email.exhibit }
50
+ expect(response).to be_successful
51
+ expect(JSON.parse(response.body)).to eq('success' => true, 'error' => nil)
52
+ end
53
+
54
+ it 'gives a 404 with appropriate message when the record no longer exists' do
55
+ contact_email.destroy
56
+ delete :destroy, params: { id: contact_email, exhibit_id: contact_email.exhibit }
57
+ expect(response.status).to eq 404
58
+ expect(JSON.parse(response.body)).to eq('success' => false, 'error' => 'Not Found')
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
@@ -1,6 +1,6 @@
1
1
  describe Spotlight::ContactFormsController, type: :controller do
2
2
  routes { Spotlight::Engine.routes }
3
- let(:exhibit) { FactoryGirl.create(:exhibit) }
3
+ let(:exhibit) { FactoryBot.create(:exhibit) }
4
4
  let(:honeypot_field_name) { Spotlight::Engine.config.spambot_honeypot_email_field }
5
5
 
6
6
  before do
@@ -2,7 +2,7 @@ describe Spotlight::ContactsController, type: :controller do
2
2
  routes { Spotlight::Engine.routes }
3
3
  describe 'when not logged in' do
4
4
  describe 'GET edit' do
5
- let(:contact) { FactoryGirl.create(:contact) }
5
+ let(:contact) { FactoryBot.create(:contact) }
6
6
  it 'is successful' do
7
7
  get :edit, params: { id: contact, exhibit_id: contact.exhibit }
8
8
  expect(response).to redirect_to main_app.new_user_session_path
@@ -11,9 +11,9 @@ describe Spotlight::ContactsController, type: :controller do
11
11
  end
12
12
 
13
13
  describe 'when signed in as a curator' do
14
- let(:user) { FactoryGirl.create(:exhibit_curator, exhibit: exhibit) }
15
- let(:exhibit) { FactoryGirl.create(:exhibit) }
16
- let(:contact) { FactoryGirl.create(:contact, exhibit: exhibit, name: 'Andrew Carnegie') }
14
+ let(:user) { FactoryBot.create(:exhibit_curator, exhibit: exhibit) }
15
+ let(:exhibit) { FactoryBot.create(:exhibit) }
16
+ let(:contact) { FactoryBot.create(:contact, exhibit: exhibit, name: 'Andrew Carnegie') }
17
17
  before { sign_in user }
18
18
 
19
19
  describe 'GET edit' do
@@ -34,7 +34,7 @@ describe Spotlight::ContactsController, type: :controller do
34
34
  end
35
35
 
36
36
  it 'allows thumbnails to be updated' do
37
- contact = FactoryGirl.create(:contact, exhibit: exhibit, name: 'Andrew Carnegie')
37
+ contact = FactoryBot.create(:contact, exhibit: exhibit, name: 'Andrew Carnegie')
38
38
  patch :update, params: {
39
39
  id: contact,
40
40
  contact: {
@@ -1,9 +1,9 @@
1
1
  describe Spotlight::CustomFieldsController, type: :controller do
2
2
  routes { Spotlight::Engine.routes }
3
- let(:exhibit) { FactoryGirl.create(:exhibit) }
3
+ let(:exhibit) { FactoryBot.create(:exhibit) }
4
4
 
5
5
  describe 'when signed in as an exhibit admin' do
6
- let(:user) { FactoryGirl.create(:exhibit_admin, exhibit: exhibit) }
6
+ let(:user) { FactoryBot.create(:exhibit_admin, exhibit: exhibit) }
7
7
  before { sign_in user }
8
8
 
9
9
  describe 'GET new' do
@@ -18,7 +18,7 @@ describe Spotlight::CustomFieldsController, type: :controller do
18
18
  end
19
19
 
20
20
  describe 'GET edit' do
21
- let(:field) { FactoryGirl.create(:custom_field, exhibit: exhibit) }
21
+ let(:field) { FactoryBot.create(:custom_field, exhibit: exhibit) }
22
22
  it 'assigns the requested custom_field' do
23
23
  expect(controller).to receive(:add_breadcrumb).with('Home', exhibit)
24
24
  expect(controller).to receive(:add_breadcrumb).with('Configuration', exhibit_dashboard_path(exhibit))
@@ -1,7 +1,7 @@
1
1
 
2
2
  describe Spotlight::DashboardsController, type: :controller do
3
3
  routes { Spotlight::Engine.routes }
4
- let(:exhibit) { FactoryGirl.create(:exhibit) }
4
+ let(:exhibit) { FactoryBot.create(:exhibit) }
5
5
  let(:repository) { double }
6
6
 
7
7
  before do
@@ -9,7 +9,7 @@ describe Spotlight::DashboardsController, type: :controller do
9
9
  end
10
10
 
11
11
  describe 'when logged in' do
12
- let(:curator) { FactoryGirl.create(:exhibit_curator, exhibit: exhibit) }
12
+ let(:curator) { FactoryBot.create(:exhibit_curator, exhibit: exhibit) }
13
13
  before { sign_in curator }
14
14
  describe 'GET show' do
15
15
  it 'loads the exhibit' do
@@ -38,7 +38,7 @@ describe Spotlight::DashboardsController, type: :controller do
38
38
  end
39
39
 
40
40
  describe 'when user does not have access' do
41
- before { sign_in FactoryGirl.create(:exhibit_visitor) }
41
+ before { sign_in FactoryBot.create(:exhibit_visitor) }
42
42
  it 'does not allow show' do
43
43
  get :show, params: { exhibit_id: exhibit.id }
44
44
  expect(response).to redirect_to main_app.root_path
@@ -2,7 +2,7 @@ require 'rack/test'
2
2
 
3
3
  describe Spotlight::ExhibitsController, type: :controller do
4
4
  routes { Spotlight::Engine.routes }
5
- let(:exhibit) { FactoryGirl.create(:exhibit) }
5
+ let(:exhibit) { FactoryBot.create(:exhibit) }
6
6
 
7
7
  before do
8
8
  allow(Spotlight::DefaultThumbnailJob).to receive(:perform_later)
@@ -10,7 +10,7 @@ describe Spotlight::ExhibitsController, type: :controller do
10
10
 
11
11
  describe 'when the user is not authorized' do
12
12
  before do
13
- sign_in FactoryGirl.create(:exhibit_visitor)
13
+ sign_in FactoryBot.create(:exhibit_visitor)
14
14
  end
15
15
 
16
16
  describe 'GET edit' do
@@ -67,7 +67,7 @@ describe Spotlight::ExhibitsController, type: :controller do
67
67
  end
68
68
 
69
69
  describe 'when signed in as a site admin' do
70
- let(:user) { FactoryGirl.create(:site_admin) }
70
+ let(:user) { FactoryBot.create(:site_admin) }
71
71
  before { sign_in user }
72
72
 
73
73
  describe 'GET new' do
@@ -101,7 +101,7 @@ describe Spotlight::ExhibitsController, type: :controller do
101
101
  end
102
102
 
103
103
  describe 'when signed in as an exhibit admin' do
104
- let(:user) { FactoryGirl.create(:exhibit_admin, exhibit: exhibit) }
104
+ let(:user) { FactoryBot.create(:exhibit_admin, exhibit: exhibit) }
105
105
  before { sign_in user }
106
106
 
107
107
  describe 'GET new' do
@@ -1,4 +1,4 @@
1
- describe Spotlight::FeaturePagesController, type: :controller do
1
+ describe Spotlight::FeaturePagesController, type: :controller, versioning: true do
2
2
  routes { Spotlight::Engine.routes }
3
3
 
4
4
  # This should return the minimal set of attributes required to create a valid
@@ -6,12 +6,12 @@ describe Spotlight::FeaturePagesController, type: :controller do
6
6
  # adjust the attributes here as well.
7
7
  let(:valid_attributes) { { 'title' => 'MyString', thumbnail_attributes: { iiif_url: '' } } }
8
8
  describe 'when signed in as a curator' do
9
- let(:exhibit) { FactoryGirl.create(:exhibit) }
10
- let(:user) { FactoryGirl.create(:exhibit_curator, exhibit: exhibit) }
9
+ let(:exhibit) { FactoryBot.create(:exhibit) }
10
+ let(:user) { FactoryBot.create(:exhibit_curator, exhibit: exhibit) }
11
11
  before { sign_in user }
12
12
 
13
13
  describe 'GET index' do
14
- let!(:page) { FactoryGirl.create(:feature_page, exhibit: exhibit) }
14
+ let!(:page) { FactoryBot.create(:feature_page, exhibit: exhibit) }
15
15
  it 'assigns all feature pages as @pages' do
16
16
  expect(controller).to receive(:add_breadcrumb).with('Home', exhibit_root_path(exhibit))
17
17
  expect(controller).to receive(:add_breadcrumb).with('Curation', exhibit_dashboard_path(exhibit))
@@ -24,7 +24,7 @@ describe Spotlight::FeaturePagesController, type: :controller do
24
24
 
25
25
  describe 'GET show' do
26
26
  describe 'on a top level page' do
27
- let(:page) { FactoryGirl.create(:feature_page, exhibit: exhibit) }
27
+ let(:page) { FactoryBot.create(:feature_page, exhibit: exhibit) }
28
28
  it 'assigns the requested page as @page' do
29
29
  expect(controller).to receive(:add_breadcrumb).with('Home', exhibit_root_path(exhibit))
30
30
  expect(controller).to receive(:add_breadcrumb).with(page.title, [exhibit, page])
@@ -33,7 +33,7 @@ describe Spotlight::FeaturePagesController, type: :controller do
33
33
  end
34
34
  end
35
35
  describe 'on a sub-page' do
36
- let(:page) { FactoryGirl.create(:feature_subpage, exhibit: exhibit) }
36
+ let(:page) { FactoryBot.create(:feature_subpage, exhibit: exhibit) }
37
37
  it 'assigns the requested page as @page' do
38
38
  expect(controller).to receive(:add_breadcrumb).with('Home', exhibit_root_path(exhibit))
39
39
  expect(controller).to receive(:add_breadcrumb).with(page.parent_page.title, [exhibit, page.parent_page])
@@ -53,7 +53,7 @@ describe Spotlight::FeaturePagesController, type: :controller do
53
53
  end
54
54
 
55
55
  describe 'GET edit' do
56
- let(:page) { FactoryGirl.create(:feature_subpage, exhibit: exhibit) }
56
+ let(:page) { FactoryBot.create(:feature_subpage, exhibit: exhibit) }
57
57
  it 'assigns the requested page as @page' do
58
58
  expect(controller).to receive(:add_breadcrumb).with('Home', exhibit_root_path(exhibit))
59
59
  expect(controller).to receive(:add_breadcrumb).with('Feature pages', exhibit_feature_pages_path(exhibit))
@@ -101,7 +101,7 @@ describe Spotlight::FeaturePagesController, type: :controller do
101
101
  end
102
102
 
103
103
  describe 'PUT update' do
104
- let(:page) { FactoryGirl.create(:feature_page, exhibit: exhibit) }
104
+ let(:page) { FactoryBot.create(:feature_page, exhibit: exhibit) }
105
105
  describe 'with valid params' do
106
106
  it 'updates the requested page' do
107
107
  expect_any_instance_of(Spotlight::FeaturePage).to receive(:update)
@@ -139,9 +139,9 @@ describe Spotlight::FeaturePagesController, type: :controller do
139
139
  end
140
140
 
141
141
  describe 'POST update_all' do
142
- let!(:page1) { FactoryGirl.create(:feature_page, exhibit: exhibit) }
143
- let!(:page2) { FactoryGirl.create(:feature_page, exhibit: page1.exhibit) }
144
- let!(:page3) { FactoryGirl.create(:feature_page, exhibit: page1.exhibit, parent_page_id: page1.id) }
142
+ let!(:page1) { FactoryBot.create(:feature_page, exhibit: exhibit) }
143
+ let!(:page2) { FactoryBot.create(:feature_page, exhibit: page1.exhibit) }
144
+ let!(:page3) { FactoryBot.create(:feature_page, exhibit: page1.exhibit, parent_page_id: page1.id) }
145
145
  before { request.env['HTTP_REFERER'] = 'http://example.com' }
146
146
  it 'updates the parent/child relationship' do
147
147
  post :update_all, params: { exhibit_id: page1.exhibit, exhibit: { feature_pages_attributes: [{ id: page2.id, parent_page_id: page1.id }] } }
@@ -154,7 +154,7 @@ describe Spotlight::FeaturePagesController, type: :controller do
154
154
  end
155
155
 
156
156
  describe 'DELETE destroy' do
157
- let!(:page) { FactoryGirl.create(:feature_page, exhibit: exhibit) }
157
+ let!(:page) { FactoryBot.create(:feature_page, exhibit: exhibit) }
158
158
  it 'destroys the requested page' do
159
159
  expect do
160
160
  delete :destroy, params: { id: page, exhibit_id: page.exhibit.id }
@@ -3,7 +3,7 @@ describe Spotlight::FeaturedImagesController, type: :controller do
3
3
 
4
4
  describe 'when the user is not authorized' do
5
5
  before do
6
- sign_in FactoryGirl.create(:exhibit_visitor)
6
+ sign_in FactoryBot.create(:exhibit_visitor)
7
7
  end
8
8
 
9
9
  describe 'POST create' do
@@ -23,7 +23,7 @@ describe Spotlight::FeaturedImagesController, type: :controller do
23
23
  end
24
24
 
25
25
  describe 'when signed in as a site admin' do
26
- let(:user) { FactoryGirl.create(:site_admin) }
26
+ let(:user) { FactoryBot.create(:site_admin) }
27
27
  before { sign_in user }
28
28
 
29
29
  describe 'POST create a thumbnail' do
@@ -2,7 +2,7 @@ describe Spotlight::FiltersController do
2
2
  routes { Spotlight::Engine.routes }
3
3
 
4
4
  describe '#create' do
5
- let(:exhibit) { FactoryGirl.create(:exhibit) }
5
+ let(:exhibit) { FactoryBot.create(:exhibit) }
6
6
  let(:exhibit_filter) { exhibit.filters.first }
7
7
 
8
8
  before do
@@ -18,7 +18,7 @@ describe Spotlight::FiltersController do
18
18
 
19
19
  context 'when signed in as a site admin' do
20
20
  before { sign_in user }
21
- let(:user) { FactoryGirl.create(:site_admin) }
21
+ let(:user) { FactoryBot.create(:site_admin) }
22
22
 
23
23
  it 'is successful' do
24
24
  post :create, params: { exhibit_id: exhibit, filter: { field: 'foo_ssi', value: 'bar' } }
@@ -35,7 +35,7 @@ describe Spotlight::FiltersController do
35
35
  end
36
36
 
37
37
  describe '#update' do
38
- let(:exhibit) { FactoryGirl.create(:exhibit) }
38
+ let(:exhibit) { FactoryBot.create(:exhibit) }
39
39
  let(:exhibit_filter) { exhibit.filters.first }
40
40
 
41
41
  before do
@@ -51,7 +51,7 @@ describe Spotlight::FiltersController do
51
51
 
52
52
  context 'when signed in as a site admin' do
53
53
  before { sign_in user }
54
- let(:user) { FactoryGirl.create(:site_admin) }
54
+ let(:user) { FactoryBot.create(:site_admin) }
55
55
 
56
56
  it 'is successful' do
57
57
  patch :update, params: { exhibit_id: exhibit, id: exhibit_filter, filter: { field: 'foo_ssi', value: 'bar' } }
@@ -1,11 +1,11 @@
1
- describe Spotlight::HomePagesController, type: :controller do
1
+ describe Spotlight::HomePagesController, type: :controller, versioning: true do
2
2
  routes { Spotlight::Engine.routes }
3
3
  let(:valid_attributes) { { 'title' => 'MyString', thumbnail: { iiif_url: '' } } }
4
- let(:exhibit) { FactoryGirl.create(:exhibit) }
4
+ let(:exhibit) { FactoryBot.create(:exhibit) }
5
5
  let(:page) { exhibit.home_page }
6
6
 
7
7
  describe 'when signed in as a curator' do
8
- let(:user) { FactoryGirl.create(:exhibit_curator, exhibit: exhibit) }
8
+ let(:user) { FactoryBot.create(:exhibit_curator, exhibit: exhibit) }
9
9
  before do
10
10
  sign_in user
11
11
  end
@@ -76,7 +76,7 @@ describe Spotlight::HomePagesController, type: :controller do
76
76
  end
77
77
 
78
78
  it 'redirects an unauthorized user to the signin path' do
79
- user = FactoryGirl.create(:exhibit_curator)
79
+ user = FactoryBot.create(:exhibit_curator)
80
80
  sign_in user
81
81
  expect do
82
82
  get :show, params: { exhibit_id: exhibit }
@@ -84,7 +84,7 @@ describe Spotlight::HomePagesController, type: :controller do
84
84
  end
85
85
 
86
86
  it 'redirects an authorized user to the signin path' do
87
- user = FactoryGirl.create(:exhibit_curator, exhibit: exhibit)
87
+ user = FactoryBot.create(:exhibit_curator, exhibit: exhibit)
88
88
  sign_in user
89
89
  get :show, params: { exhibit_id: exhibit }
90
90
  expect(response).to be_successful
@@ -1,10 +1,10 @@
1
1
  describe Spotlight::MetadataConfigurationsController, type: :controller do
2
2
  routes { Spotlight::Engine.routes }
3
- let(:exhibit) { FactoryGirl.create(:exhibit) }
3
+ let(:exhibit) { FactoryBot.create(:exhibit) }
4
4
 
5
5
  describe 'when the user is not authorized' do
6
6
  before do
7
- sign_in FactoryGirl.create(:exhibit_visitor)
7
+ sign_in FactoryBot.create(:exhibit_visitor)
8
8
  end
9
9
 
10
10
  describe 'GET show' do
@@ -41,7 +41,7 @@ describe Spotlight::MetadataConfigurationsController, type: :controller do
41
41
  end
42
42
 
43
43
  describe 'when signed in' do
44
- let(:user) { FactoryGirl.create(:exhibit_admin, exhibit: exhibit) }
44
+ let(:user) { FactoryBot.create(:exhibit_admin, exhibit: exhibit) }
45
45
  before { sign_in user }
46
46
 
47
47
  describe 'GET edit' do
@@ -1,7 +1,7 @@
1
1
 
2
2
  describe Spotlight::Resources::CsvUploadController, type: :controller do
3
3
  routes { Spotlight::Engine.routes }
4
- let(:exhibit) { FactoryGirl.create(:exhibit) }
4
+ let(:exhibit) { FactoryBot.create(:exhibit) }
5
5
 
6
6
  describe 'when not logged in' do
7
7
  describe 'POST create' do
@@ -13,7 +13,7 @@ describe Spotlight::Resources::CsvUploadController, type: :controller do
13
13
  end
14
14
 
15
15
  describe 'when signed in as a curator' do
16
- let(:user) { FactoryGirl.create(:exhibit_curator, exhibit: exhibit) }
16
+ let(:user) { FactoryBot.create(:exhibit_curator, exhibit: exhibit) }
17
17
  before { sign_in user }
18
18
 
19
19
  describe 'POST create' do
@@ -1,7 +1,7 @@
1
1
 
2
2
  describe Spotlight::Resources::UploadController, type: :controller do
3
3
  routes { Spotlight::Engine.routes }
4
- let(:exhibit) { FactoryGirl.create(:exhibit) }
4
+ let(:exhibit) { FactoryBot.create(:exhibit) }
5
5
 
6
6
  describe 'when not logged in' do
7
7
  describe 'POST create' do
@@ -13,7 +13,7 @@ describe Spotlight::Resources::UploadController, type: :controller do
13
13
  end
14
14
 
15
15
  describe 'when signed in as a curator' do
16
- let(:user) { FactoryGirl.create(:exhibit_curator, exhibit: exhibit) }
16
+ let(:user) { FactoryBot.create(:exhibit_curator, exhibit: exhibit) }
17
17
  before { sign_in user }
18
18
 
19
19
  describe 'POST create' do
@@ -1,6 +1,6 @@
1
1
  describe Spotlight::ResourcesController, type: :controller do
2
2
  routes { Spotlight::Engine.routes }
3
- let(:exhibit) { FactoryGirl.create(:exhibit) }
3
+ let(:exhibit) { FactoryBot.create(:exhibit) }
4
4
 
5
5
  describe 'when not logged in' do
6
6
  describe 'GET new' do
@@ -33,7 +33,7 @@ describe Spotlight::ResourcesController, type: :controller do
33
33
  end
34
34
 
35
35
  describe 'when signed in as a curator' do
36
- let(:user) { FactoryGirl.create(:exhibit_curator, exhibit: exhibit) }
36
+ let(:user) { FactoryBot.create(:exhibit_curator, exhibit: exhibit) }
37
37
  before { sign_in user }
38
38
 
39
39
  describe 'GET new' do
@@ -1,9 +1,9 @@
1
1
  describe Spotlight::RolesController, type: :controller do
2
2
  routes { Spotlight::Engine.routes }
3
- let(:exhibit) { FactoryGirl.create(:exhibit) }
3
+ let(:exhibit) { FactoryBot.create(:exhibit) }
4
4
 
5
5
  describe 'when user does not have access' do
6
- before { sign_in FactoryGirl.create(:exhibit_visitor) }
6
+ before { sign_in FactoryBot.create(:exhibit_visitor) }
7
7
  describe 'GET index' do
8
8
  it 'denies access' do
9
9
  get :index, params: { exhibit_id: exhibit }
@@ -13,8 +13,8 @@ describe Spotlight::RolesController, type: :controller do
13
13
  end
14
14
 
15
15
  describe 'when user is an admin' do
16
- let(:admin) { FactoryGirl.create(:exhibit_admin, exhibit: exhibit) }
17
- let(:user) { FactoryGirl.create(:user) }
16
+ let(:admin) { FactoryBot.create(:exhibit_admin, exhibit: exhibit) }
17
+ let(:user) { FactoryBot.create(:user) }
18
18
  let(:role) { admin.roles.first }
19
19
  before { sign_in admin }
20
20
  it 'allows index' do