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
@@ -1,12 +1,12 @@
1
1
  feature 'Reindex Monitor', js: true do
2
2
  let(:resources) do
3
- [FactoryGirl.create(:resource)]
3
+ [FactoryBot.create(:resource)]
4
4
  end
5
- let(:exhibit) { FactoryGirl.create(:exhibit, resources: resources) }
6
- let(:exhibit_curator) { FactoryGirl.create(:exhibit_curator, exhibit: exhibit) }
5
+ let(:exhibit) { FactoryBot.create(:exhibit, resources: resources) }
6
+ let(:exhibit_curator) { FactoryBot.create(:exhibit_curator, exhibit: exhibit) }
7
7
 
8
8
  before do
9
- FactoryGirl.create(:in_progress_reindexing_log_entry, exhibit: exhibit, items_reindexed_estimate: 5)
9
+ FactoryBot.create(:in_progress_reindexing_log_entry, exhibit: exhibit, items_reindexed_estimate: 5)
10
10
  login_as exhibit_curator
11
11
  visit spotlight.admin_exhibit_catalog_path(exhibit)
12
12
  end
@@ -1,6 +1,6 @@
1
1
  describe 'Roles Admin', type: :feature, js: true do
2
- let(:exhibit) { FactoryGirl.create(:exhibit) }
3
- let(:exhibit_admin) { FactoryGirl.create(:exhibit_admin, exhibit: exhibit) }
2
+ let(:exhibit) { FactoryBot.create(:exhibit) }
3
+ let(:exhibit_admin) { FactoryBot.create(:exhibit_admin, exhibit: exhibit) }
4
4
  before do
5
5
  login_as exhibit_admin
6
6
 
@@ -9,7 +9,7 @@ describe 'Roles Admin', type: :feature, js: true do
9
9
  end
10
10
 
11
11
  it 'has the appropriate status message when an existing user is added' do
12
- second_user = FactoryGirl.create(:site_admin)
12
+ second_user = FactoryBot.create(:site_admin)
13
13
 
14
14
  click_link 'Add a new user'
15
15
  fill_in 'User key', with: second_user.email
@@ -1,6 +1,6 @@
1
1
  feature 'Search Configuration Administration', js: true do
2
- let(:exhibit) { FactoryGirl.create(:exhibit) }
3
- let(:user) { FactoryGirl.create(:exhibit_admin, exhibit: exhibit) }
2
+ let(:exhibit) { FactoryBot.create(:exhibit) }
3
+ let(:user) { FactoryBot.create(:exhibit_admin, exhibit: exhibit) }
4
4
  before { login_as user }
5
5
 
6
6
  describe 'search fields' do
@@ -13,7 +13,6 @@ feature 'Search Configuration Administration', js: true do
13
13
  click_link 'Exhibit dashboard'
14
14
  end
15
15
  click_link 'Search'
16
- click_link 'Options'
17
16
 
18
17
  uncheck 'Display search box'
19
18
 
@@ -1,8 +1,8 @@
1
1
  feature 'Search contexts' do
2
- let(:exhibit) { FactoryGirl.create(:exhibit) }
3
- let(:exhibit_curator) { FactoryGirl.create(:exhibit_curator, exhibit: exhibit) }
2
+ let(:exhibit) { FactoryBot.create(:exhibit) }
3
+ let(:exhibit_curator) { FactoryBot.create(:exhibit_curator, exhibit: exhibit) }
4
4
  let(:feature_page) do
5
- FactoryGirl.create(
5
+ FactoryBot.create(
6
6
  :feature_page,
7
7
  title: 'FeaturePage1',
8
8
  exhibit: exhibit
@@ -35,7 +35,7 @@ feature 'Search contexts' do
35
35
  expect(page).not_to have_css('.title')
36
36
  end
37
37
 
38
- find('.thumbnail a').trigger('click')
38
+ find('.thumbnail a').click
39
39
 
40
40
  expect(page).to have_selector '.breadcrumb a', text: 'Home'
41
41
  end
@@ -65,14 +65,14 @@ feature 'Search contexts' do
65
65
  expect(page).not_to have_css('.title')
66
66
  end
67
67
 
68
- find('.thumbnail a').trigger('click')
68
+ find('.thumbnail a').click
69
69
 
70
70
  expect(page).to have_selector '.breadcrumb a', text: 'Home'
71
71
  expect(page).to have_link 'FeaturePage1', href: spotlight.exhibit_feature_page_path(exhibit, feature_page)
72
72
  end
73
73
 
74
74
  context 'from a browse page' do
75
- let!(:search) { FactoryGirl.create(:search, title: 'Some Saved Search', exhibit: exhibit, published: true) }
75
+ let!(:search) { FactoryBot.create(:search, title: 'Some Saved Search', exhibit: exhibit, published: true) }
76
76
 
77
77
  scenario 'should add context breadcrumbs back to the browse page when navigating to an item', js: true do
78
78
  visit spotlight.exhibit_home_page_path(exhibit, exhibit.home_page)
@@ -1,6 +1,6 @@
1
1
  describe 'Main navigation labels are settable', type: :feature do
2
- let!(:exhibit) { FactoryGirl.create(:exhibit) }
3
- let!(:about) { FactoryGirl.create(:about_page, exhibit: exhibit, published: true) }
2
+ let!(:exhibit) { FactoryBot.create(:exhibit) }
3
+ let!(:about) { FactoryBot.create(:about_page, exhibit: exhibit, published: true) }
4
4
  before do
5
5
  about_nav = exhibit.main_navigations.about
6
6
  about_nav.label = 'New About Label'
@@ -1,6 +1,6 @@
1
1
  describe 'Metadata Administration', type: :feature do
2
- let(:exhibit) { FactoryGirl.create(:exhibit) }
3
- let(:user) { FactoryGirl.create(:exhibit_admin, exhibit: exhibit) }
2
+ let(:exhibit) { FactoryBot.create(:exhibit) }
3
+ let(:user) { FactoryBot.create(:exhibit_admin, exhibit: exhibit) }
4
4
  before { login_as user }
5
5
 
6
6
  describe 'edit' do
@@ -1,5 +1,5 @@
1
1
  describe 'Report a Problem', type: :feature do
2
- let!(:exhibit) { FactoryGirl.create(:exhibit) }
2
+ let!(:exhibit) { FactoryBot.create(:exhibit) }
3
3
  let(:honeypot_field_name) { Spotlight::Engine.config.spambot_honeypot_email_field }
4
4
 
5
5
  it 'does not have a header link' do
@@ -47,7 +47,7 @@ describe 'Report a Problem', type: :feature do
47
47
  expect(find('#contact_form_current_url', visible: false).value).to end_with spotlight.exhibit_solr_document_path(exhibit, id: 'dq287tq6352')
48
48
  fill_in 'Name', with: 'Some Body'
49
49
  fill_in 'Email', with: 'test@example.com'
50
- page.find("#contact_form_#{honeypot_field_name}", visible: false).set 'possible_spam@spam.com'
50
+ page.evaluate_script("$('#contact_form_#{honeypot_field_name}').val('possible_spam@spam.com')")
51
51
  fill_in 'Message', with: 'This is my problem report'
52
52
 
53
53
  expect do
@@ -1,8 +1,8 @@
1
1
  describe 'Site admin management', js: true do
2
- let(:user) { FactoryGirl.create(:site_admin) }
3
- let!(:existing_user) { FactoryGirl.create(:exhibit_visitor) }
4
- let!(:exhibit_admin) { FactoryGirl.create(:exhibit_admin) }
5
- let!(:exhibit_curator) { FactoryGirl.create(:exhibit_curator) }
2
+ let(:user) { FactoryBot.create(:site_admin) }
3
+ let!(:existing_user) { FactoryBot.create(:exhibit_visitor) }
4
+ let!(:exhibit_admin) { FactoryBot.create(:exhibit_admin) }
5
+ let!(:exhibit_curator) { FactoryBot.create(:exhibit_curator) }
6
6
 
7
7
  before do
8
8
  login_as(user)
@@ -1,5 +1,5 @@
1
1
  describe 'Add and update the site masthead', type: :feature do
2
- let(:user) { FactoryGirl.create(:site_admin) }
2
+ let(:user) { FactoryBot.create(:site_admin) }
3
3
 
4
4
  before { login_as user }
5
5
 
@@ -1,18 +1,19 @@
1
1
  describe 'Slideshow', type: :feature, js: true do
2
- let(:exhibit) { FactoryGirl.create(:exhibit) }
3
- let(:user) { FactoryGirl.create(:exhibit_admin, exhibit: exhibit) }
2
+ let(:exhibit) { FactoryBot.create(:exhibit) }
3
+ let(:user) { FactoryBot.create(:exhibit_admin, exhibit: exhibit) }
4
4
 
5
5
  before do
6
6
  login_as user
7
7
  exhibit.blacklight_configuration.update(document_index_view_types: %w(list gallery slideshow))
8
8
  end
9
9
  it 'has slideshow' do
10
+ pending('does not work with chrome headless')
10
11
  visit spotlight.search_exhibit_catalog_path(exhibit, f: { genre_ssim: ['map'] })
11
12
  expect(page).to have_content 'You searched for:'
12
13
  within '.view-type' do
13
14
  click_link 'Slideshow'
14
15
  end
15
- find('.grid [data-slide-to="1"]').trigger('click')
16
+ find('.grid [data-slide-to="1"]').click
16
17
  expect(page).to have_selector '#slideshow', visible: true
17
18
  end
18
19
  end
@@ -1,7 +1,7 @@
1
1
  describe 'Tags Administration', type: :feature do
2
- let(:exhibit) { FactoryGirl.create(:exhibit) }
3
- let!(:tagging) { FactoryGirl.create(:tagging, tagger: exhibit, taggable: exhibit) }
4
- let(:exhibit_curator) { FactoryGirl.create(:exhibit_curator, exhibit: exhibit) }
2
+ let(:exhibit) { FactoryBot.create(:exhibit) }
3
+ let!(:tagging) { FactoryBot.create(:tagging, tagger: exhibit, taggable: exhibit) }
4
+ let(:exhibit_curator) { FactoryBot.create(:exhibit_curator, exhibit: exhibit) }
5
5
  before { login_as exhibit_curator }
6
6
 
7
7
  describe 'index' do
@@ -1,6 +1,6 @@
1
1
  describe 'User Administration', type: :feature do
2
- let!(:exhibit) { FactoryGirl.create(:exhibit) }
3
- let!(:user) { FactoryGirl.create(:exhibit_admin, exhibit: exhibit) }
2
+ let!(:exhibit) { FactoryBot.create(:exhibit) }
3
+ let!(:user) { FactoryBot.create(:exhibit_admin, exhibit: exhibit) }
4
4
  before { login_as user }
5
5
  describe 'index' do
6
6
  it 'shows the users for the exhibit' do
@@ -52,7 +52,7 @@ describe Spotlight::ApplicationHelper, type: :helper do
52
52
 
53
53
  describe '#url_to_tag_facet' do
54
54
  before do
55
- allow(helper).to receive_messages(current_exhibit: FactoryGirl.create(:exhibit))
55
+ allow(helper).to receive_messages(current_exhibit: FactoryBot.create(:exhibit))
56
56
  allow(helper).to receive_messages(blacklight_config: Blacklight::Configuration.new)
57
57
 
58
58
  # controller provided helper.
@@ -101,7 +101,7 @@ describe Spotlight::ApplicationHelper, type: :helper do
101
101
  end
102
102
 
103
103
  describe 'render_document_class' do
104
- let(:current_exhibit) { FactoryGirl.create(:exhibit) }
104
+ let(:current_exhibit) { FactoryBot.create(:exhibit) }
105
105
  let(:document) { SolrDocument.new(some_field: 'Some data') }
106
106
  before do
107
107
  allow(helper).to receive_messages(current_exhibit: current_exhibit)
@@ -1,5 +1,5 @@
1
1
  describe Spotlight::CrudLinkHelpers, type: :helper do
2
- let(:exhibit) { FactoryGirl.create(:exhibit) }
2
+ let(:exhibit) { FactoryBot.create(:exhibit) }
3
3
  let(:some_model) { Spotlight::FeaturePage.create! exhibit: exhibit }
4
4
  describe '#cancel_link' do
5
5
  it 'is a model-specific cancel link' do
@@ -2,8 +2,8 @@
2
2
  describe Spotlight::MainAppHelpers, type: :helper do
3
3
  describe '#show_contact_form?' do
4
4
  subject { helper }
5
- let(:exhibit) { FactoryGirl.create :exhibit }
6
- let(:exhibit_with_contacts) { FactoryGirl.create :exhibit }
5
+ let(:exhibit) { FactoryBot.create :exhibit }
6
+ let(:exhibit_with_contacts) { FactoryBot.create :exhibit }
7
7
  context 'with an exhibit with confirmed contacts' do
8
8
  before do
9
9
  exhibit_with_contacts.contact_emails.create(email: 'cabeer@stanford.edu').tap do |e|
@@ -42,7 +42,7 @@ describe Spotlight::MainAppHelpers, type: :helper do
42
42
  end
43
43
 
44
44
  describe '#exhibit_stylesheet_link_tag' do
45
- let(:exhibit) { FactoryGirl.create(:exhibit) }
45
+ let(:exhibit) { FactoryBot.create(:exhibit) }
46
46
  before do
47
47
  allow(helper).to receive_messages(current_exhibit: exhibit)
48
48
  end
@@ -1,6 +1,6 @@
1
1
  describe Spotlight::MetaHelper, type: :helper do
2
2
  describe '#add_exhibit_meta_content' do
3
- let(:current_exhibit) { FactoryGirl.create(:exhibit) }
3
+ let(:current_exhibit) { FactoryBot.create(:exhibit) }
4
4
  before do
5
5
  allow(helper).to receive_messages(current_exhibit: current_exhibit)
6
6
  allow(helper).to receive(:site_title).and_return('some title')
@@ -2,9 +2,9 @@ describe Spotlight::PagesHelper, type: :helper do
2
2
  let(:blacklight_config) { Blacklight::Configuration.new { |config| config.show.title_field = :abc } }
3
3
  let(:titled_document) { blacklight_config.document_model.new(abc: 'value') }
4
4
  let(:untitled_document) { blacklight_config.document_model.new(id: '1234') }
5
- let!(:current_exhibit) { FactoryGirl.create(:exhibit) }
5
+ let!(:current_exhibit) { FactoryBot.create(:exhibit) }
6
6
  let!(:home_page) { current_exhibit.home_page }
7
- let!(:search) { FactoryGirl.create(:search, exhibit: current_exhibit, query_params: { 'q' => 'query' }, published: true) }
7
+ let!(:search) { FactoryBot.create(:search, exhibit: current_exhibit, query_params: { 'q' => 'query' }, published: true) }
8
8
 
9
9
  before do
10
10
  allow(helper).to receive_messages(blacklight_config: blacklight_config)
@@ -1,7 +1,7 @@
1
1
  describe Spotlight::AddUploadsFromCSV do
2
2
  subject(:job) { described_class.new(data, exhibit, user) }
3
- let(:exhibit) { FactoryGirl.create(:exhibit) }
4
- let(:user) { FactoryGirl.create(:exhibit_curator, exhibit: exhibit) }
3
+ let(:exhibit) { FactoryBot.create(:exhibit) }
4
+ let(:user) { FactoryBot.create(:exhibit_curator, exhibit: exhibit) }
5
5
  let(:data) do
6
6
  [
7
7
  { 'url' => 'x' },
@@ -26,7 +26,7 @@ describe Spotlight::AddUploadsFromCSV do
26
26
  end
27
27
 
28
28
  it 'creates uploaded resources for each row of data' do
29
- upload = FactoryGirl.create(:uploaded_resource)
29
+ upload = FactoryBot.create(:uploaded_resource)
30
30
  expect(Spotlight::Resources::Upload).to receive(:new).at_least(:once).and_return(upload)
31
31
 
32
32
  expect(upload).to receive(:build_upload).with(remote_image_url: 'x').and_call_original
@@ -1,8 +1,8 @@
1
1
 
2
2
  describe Spotlight::ReindexJob do
3
- let(:exhibit) { FactoryGirl.create(:exhibit) }
4
- let(:resource) { FactoryGirl.create(:resource) }
5
- let(:user) { FactoryGirl.create(:user) }
3
+ let(:exhibit) { FactoryBot.create(:exhibit) }
4
+ let(:resource) { FactoryBot.create(:resource) }
5
+ let(:user) { FactoryBot.create(:user) }
6
6
  let(:log_entry) { Spotlight::ReindexingLogEntry.create(exhibit: exhibit, user: user) }
7
7
 
8
8
  before do
@@ -2,7 +2,7 @@
2
2
  describe Spotlight::RenameSidecarFieldJob do
3
3
  include ActiveJob::TestHelper
4
4
 
5
- let(:exhibit) { FactoryGirl.create(:exhibit) }
5
+ let(:exhibit) { FactoryBot.create(:exhibit) }
6
6
  let(:sidecar) { SolrDocument.new(id: 'test').sidecar(exhibit).tap(&:save!) }
7
7
 
8
8
  it 'updates the sidecar data and reindex affected documents' do
@@ -4,8 +4,8 @@ RSpec.describe Migration::IIIF do
4
4
  let(:instance) { described_class.new('http://test.host') }
5
5
 
6
6
  context '#migrate_featured_images' do
7
- let!(:old_exhibit_thumbnail) { FactoryGirl.create(:featured_image, type: nil, iiif_tilesource: nil) }
8
- let!(:exhibit) { FactoryGirl.create(:exhibit, thumbnail_id: old_exhibit_thumbnail.id) }
7
+ let!(:old_exhibit_thumbnail) { FactoryBot.create(:featured_image, type: nil, iiif_tilesource: nil) }
8
+ let!(:exhibit) { FactoryBot.create(:exhibit, thumbnail_id: old_exhibit_thumbnail.id) }
9
9
  let(:updated_thumb) { Spotlight::FeaturedImage.find(old_exhibit_thumbnail.id) }
10
10
 
11
11
  context "when it's an exhibit thumbnail" do
@@ -47,7 +47,7 @@ RSpec.describe Migration::IIIF do
47
47
 
48
48
  describe '#migrate_upload_images' do
49
49
  let(:file) { double }
50
- let(:exhibit) { FactoryGirl.create(:exhibit) }
50
+ let(:exhibit) { FactoryBot.create(:exhibit) }
51
51
  let!(:upload) { Spotlight::Resources::Upload.create(exhibit: exhibit) }
52
52
 
53
53
  before do
@@ -49,8 +49,8 @@ describe Spotlight::Controller do
49
49
  let(:search_masthead) { double('search-masthead', display?: true) }
50
50
  let(:no_display_search_masthead) { double('no-display-search-masthead', display?: false) }
51
51
  let(:exhibit_masthead) { double('exhibit-masthead', display?: true) }
52
- let(:exhibit) { FactoryGirl.create(:exhibit) }
53
- let(:search) { FactoryGirl.create(:search) }
52
+ let(:exhibit) { FactoryBot.create(:exhibit) }
53
+ let(:search) { FactoryBot.create(:search) }
54
54
 
55
55
  it 'is nil by default' do
56
56
  expect(subject.current_masthead).to be_nil
@@ -86,7 +86,7 @@ describe Spotlight::Controller do
86
86
  end
87
87
 
88
88
  describe '#exhibit_search_facet_url' do
89
- let(:exhibit) { FactoryGirl.create(:exhibit) }
89
+ let(:exhibit) { FactoryBot.create(:exhibit) }
90
90
  let(:params) { { action: 'index', q: 'xyz' } }
91
91
 
92
92
  before do
@@ -1,6 +1,6 @@
1
1
 
2
2
  describe SirTrevorRails::Blocks::BrowseBlock do
3
- let(:page) { FactoryGirl.create(:feature_page) }
3
+ let(:page) { FactoryBot.create(:feature_page) }
4
4
  let(:block_data) { {} }
5
5
  subject { described_class.new({ type: '', data: block_data }, page) }
6
6
 
@@ -18,4 +18,22 @@ describe SirTrevorRails::Blocks::BrowseBlock do
18
18
  expect(subject.items).to eq([])
19
19
  end
20
20
  end
21
+ describe '#as_json' do
22
+ context 'when no items are present' do
23
+ it 'returns an empty items value' do
24
+ block_data[:item] = nil
25
+ expect(subject.as_json[:data]).to include item: {}
26
+ end
27
+ end
28
+
29
+ context 'when the id of a browse category does not exist' do
30
+ it 'is not included the returned items hash' do
31
+ search = FactoryBot.create(:search, exhibit: page.exhibit)
32
+ block_data[:item] = { item_0: { 'id' => 'abc123' }, item_1: { 'id' => search.slug } }
33
+
34
+ expect(subject.as_json[:data][:item]).not_to have_key :item_0
35
+ expect(subject.as_json[:data][:item]).to have_key :item_1
36
+ end
37
+ end
38
+ end
21
39
  end
@@ -1,5 +1,5 @@
1
1
  describe SirTrevorRails::Blocks::FeaturedPagesBlock do
2
- let(:page) { FactoryGirl.create(:feature_page) }
2
+ let(:page) { FactoryBot.create(:feature_page) }
3
3
  let(:block_data) { {} }
4
4
  subject { described_class.new({ type: '', data: block_data }, page) }
5
5
 
@@ -17,4 +17,12 @@ describe SirTrevorRails::Blocks::FeaturedPagesBlock do
17
17
  expect(subject.items).to eq([])
18
18
  end
19
19
  end
20
+ describe '#as_json' do
21
+ context 'when no items are present' do
22
+ it 'returns an empty items value' do
23
+ block_data[:item] = nil
24
+ expect(subject.as_json[:data]).to include item: {}
25
+ end
26
+ end
27
+ end
20
28
  end
@@ -1,5 +1,5 @@
1
1
  describe SirTrevorRails::Blocks::SearchResultsBlock do
2
- let(:page) { FactoryGirl.create(:feature_page) }
2
+ let(:page) { FactoryBot.create(:feature_page) }
3
3
  let(:block_data) { {} }
4
4
  subject { described_class.new({ type: '', data: block_data }, page) }
5
5
 
@@ -1,6 +1,6 @@
1
1
 
2
2
  describe SirTrevorRails::Blocks::SolrDocumentsBlock do
3
- let(:page) { FactoryGirl.create(:feature_page) }
3
+ let(:page) { FactoryBot.create(:feature_page) }
4
4
  let(:block_data) { {} }
5
5
  subject { described_class.new({ type: '', data: block_data }, page) }
6
6
 
@@ -7,8 +7,8 @@ describe SolrDocument, type: :model do
7
7
  allow(subject).to receive_messages(reindex: nil)
8
8
  end
9
9
 
10
- let(:exhibit) { FactoryGirl.create(:exhibit) }
11
- let(:exhibit_alt) { FactoryGirl.create(:exhibit) }
10
+ let(:exhibit) { FactoryBot.create(:exhibit) }
11
+ let(:exhibit_alt) { FactoryBot.create(:exhibit) }
12
12
 
13
13
  describe '.build_for_exhibit' do
14
14
  let(:id) { '123abc' }
@@ -4,10 +4,10 @@ describe Spotlight::Ability, type: :model do
4
4
  before do
5
5
  allow_any_instance_of(Spotlight::Search).to receive(:set_default_featured_image)
6
6
  end
7
- let(:exhibit) { FactoryGirl.create(:exhibit) }
8
- let(:search) { FactoryGirl.create(:published_search, exhibit: exhibit) }
9
- let(:unpublished_search) { FactoryGirl.create(:search, exhibit: exhibit) }
10
- let(:page) { FactoryGirl.create(:feature_page, exhibit: exhibit) }
7
+ let(:exhibit) { FactoryBot.create(:exhibit) }
8
+ let(:search) { FactoryBot.create(:published_search, exhibit: exhibit) }
9
+ let(:unpublished_search) { FactoryBot.create(:search, exhibit: exhibit) }
10
+ let(:page) { FactoryBot.create(:feature_page, exhibit: exhibit) }
11
11
  subject { Ability.new(user) }
12
12
 
13
13
  describe 'a user with no roles' do
@@ -22,14 +22,14 @@ describe Spotlight::Ability, type: :model do
22
22
  end
23
23
 
24
24
  describe 'a superadmin' do
25
- let(:user) { FactoryGirl.create(:site_admin) }
25
+ let(:user) { FactoryBot.create(:site_admin) }
26
26
 
27
27
  it { is_expected.to be_able_to(:create, Spotlight::Exhibit) }
28
28
  end
29
29
 
30
30
  describe 'a user with admin role' do
31
- let(:user) { FactoryGirl.create(:exhibit_admin, exhibit: exhibit) }
32
- let(:role) { FactoryGirl.create(:role, resource: exhibit) }
31
+ let(:user) { FactoryBot.create(:exhibit_admin, exhibit: exhibit) }
32
+ let(:role) { FactoryBot.create(:role, resource: exhibit) }
33
33
 
34
34
  it { is_expected.to be_able_to(:update, exhibit) }
35
35
 
@@ -46,7 +46,7 @@ describe Spotlight::Ability, type: :model do
46
46
  end
47
47
 
48
48
  describe 'a user with curate role' do
49
- let(:user) { FactoryGirl.create(:exhibit_curator, exhibit: exhibit) }
49
+ let(:user) { FactoryBot.create(:exhibit_curator, exhibit: exhibit) }
50
50
 
51
51
  it { is_expected.not_to be_able_to(:update, exhibit) }
52
52
  it { is_expected.to be_able_to(:curate, exhibit) }
@@ -64,7 +64,7 @@ describe Spotlight::Ability, type: :model do
64
64
 
65
65
  it { is_expected.to be_able_to(:tag, exhibit) }
66
66
 
67
- let(:contact) { FactoryGirl.create(:contact, exhibit: exhibit) }
67
+ let(:contact) { FactoryBot.create(:contact, exhibit: exhibit) }
68
68
 
69
69
  it { is_expected.to be_able_to(:edit, contact) }
70
70
  it { is_expected.to be_able_to(:new, contact) }