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
@@ -2,7 +2,7 @@ describe Spotlight::Resource, type: :model do
2
2
  before do
3
3
  allow_any_instance_of(described_class).to receive(:update_index)
4
4
  end
5
- let(:exhibit) { FactoryGirl.create(:exhibit) }
5
+ let(:exhibit) { FactoryBot.create(:exhibit) }
6
6
 
7
7
  describe '#reindex' do
8
8
  context 'with a provider that generates ids' do
@@ -34,6 +34,17 @@ describe Spotlight::Resource, type: :model do
34
34
  subject.reindex
35
35
  end
36
36
 
37
+ context 'when a document does not have an identifier' do
38
+ let(:solr_response) { { other_field: 'Content' } }
39
+
40
+ it 'is not indexed (but a commit can be sent)' do
41
+ allow(subject.send(:blacklight_solr)).to receive(:commit)
42
+ expect(subject.send(:blacklight_solr)).not_to receive(:update)
43
+
44
+ subject.reindex
45
+ end
46
+ end
47
+
37
48
  context 'reindexing_log_entry is provided' do
38
49
  before do
39
50
  allow(subject.send(:blacklight_solr)).to receive(:update)
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Spotlight::Resources::IiifHarvester do
4
- let(:exhibit) { FactoryGirl.create(:exhibit) }
4
+ let(:exhibit) { FactoryBot.create(:exhibit) }
5
5
  let(:harvester) { described_class.create(exhibit_id: exhibit.id, url: url) }
6
6
 
7
7
  describe 'Validation' do
@@ -20,7 +20,7 @@ describe Spotlight::Resources::IiifManifest do
20
20
 
21
21
  describe '#to_solr' do
22
22
  let(:manifest) { Spotlight::Resources::IiifService.new(url).send(:object) }
23
- let(:exhibit) { FactoryGirl.create(:exhibit) }
23
+ let(:exhibit) { FactoryBot.create(:exhibit) }
24
24
  describe 'id' do
25
25
  it 'is an MD5 hexdigest of the exhibit id and the and the url' do
26
26
  expected = Digest::MD5.hexdigest("#{exhibit.id}-#{url}")
@@ -1,7 +1,7 @@
1
1
 
2
2
  describe Spotlight::Resources::Upload, type: :model do
3
- let!(:exhibit) { FactoryGirl.create :exhibit }
4
- let!(:custom_field) { FactoryGirl.create :custom_field, exhibit: exhibit }
3
+ let!(:exhibit) { FactoryBot.create :exhibit }
4
+ let!(:custom_field) { FactoryBot.create :custom_field, exhibit: exhibit }
5
5
  let(:resource) { described_class.new(exhibit: exhibit) }
6
6
  let(:doc_builder) { resource.document_builder }
7
7
 
@@ -16,7 +16,7 @@ describe Spotlight::Resources::Upload, type: :model do
16
16
  custom_field.field => 'Custom Field Data'
17
17
  }
18
18
  end
19
- let(:featured_image) { FactoryGirl.create(:featured_image, image: File.open(File.join(FIXTURES_PATH, '800x600.png'))) }
19
+ let(:featured_image) { FactoryBot.create(:featured_image, image: File.open(File.join(FIXTURES_PATH, '800x600.png'))) }
20
20
 
21
21
  before do
22
22
  Rails.cache.clear # wipes out any cached image info.
@@ -10,7 +10,7 @@ describe Spotlight::Role, type: :model do
10
10
  end
11
11
  describe 'with user_key' do
12
12
  describe "that doesn't point at a user" do
13
- let(:user) { FactoryGirl.build(:user) }
13
+ let(:user) { FactoryBot.build(:user) }
14
14
  let(:args) { { role: 'curator', user_key: user.email } }
15
15
  it 'does not be valid' do
16
16
  expect(subject).to be_valid
@@ -19,7 +19,7 @@ describe Spotlight::Role, type: :model do
19
19
  end
20
20
  end
21
21
  describe 'that points at a user' do
22
- let(:user) { FactoryGirl.create(:user) }
22
+ let(:user) { FactoryBot.create(:user) }
23
23
  let(:args) { { role: 'curator', user_key: user.email } }
24
24
  it 'is valid' do
25
25
  expect(subject).to be_valid
@@ -27,7 +27,7 @@ describe Spotlight::Role, type: :model do
27
27
  end
28
28
  end
29
29
  describe 'that points at a user with an existing role' do
30
- let(:user) { FactoryGirl.create(:user) }
30
+ let(:user) { FactoryBot.create(:user) }
31
31
  before { described_class.create!(role: 'curator', user: user) }
32
32
  let(:args) { { role: 'curator', user_key: user.email } }
33
33
  it 'is valid' do
@@ -1,5 +1,5 @@
1
1
  describe Spotlight::Search, type: :model do
2
- let(:exhibit) { FactoryGirl.create(:exhibit) }
2
+ let(:exhibit) { FactoryBot.create(:exhibit) }
3
3
 
4
4
  let(:query_params) { { 'f' => { 'genre_sim' => ['map'] } } }
5
5
  subject { exhibit.searches.build(title: 'Search', query_params: query_params) }
@@ -19,16 +19,16 @@ describe Spotlight::Search, type: :model do
19
19
  end
20
20
 
21
21
  describe 'default_scope' do
22
- let!(:page1) { FactoryGirl.create(:search, weight: 5, published: true) }
23
- let!(:page2) { FactoryGirl.create(:search, weight: 1, published: true) }
24
- let!(:page3) { FactoryGirl.create(:search, weight: 10, published: true) }
22
+ let!(:page1) { FactoryBot.create(:search, weight: 5, published: true) }
23
+ let!(:page2) { FactoryBot.create(:search, weight: 1, published: true) }
24
+ let!(:page3) { FactoryBot.create(:search, weight: 10, published: true) }
25
25
  it 'orders by weight' do
26
26
  expect(described_class.published.map(&:weight)).to eq [1, 5, 10]
27
27
  end
28
28
  end
29
29
 
30
30
  describe '#slug' do
31
- let(:search) { FactoryGirl.create(:search) }
31
+ let(:search) { FactoryBot.create(:search) }
32
32
 
33
33
  it 'gets a default slug' do
34
34
  expect(search.slug).not_to be_blank
@@ -40,7 +40,7 @@ describe Spotlight::Search, type: :model do
40
40
  end
41
41
 
42
42
  context 'with a custom slug' do
43
- let(:search) { FactoryGirl.create(:search, slug: 'xyz') }
43
+ let(:search) { FactoryBot.create(:search, slug: 'xyz') }
44
44
 
45
45
  it 'gets a default slug' do
46
46
  expect(search.slug).to eq 'xyz'
@@ -65,7 +65,7 @@ describe Spotlight::Search, type: :model do
65
65
  end
66
66
 
67
67
  describe '#repository' do
68
- let(:search) { FactoryGirl.create(:search) }
68
+ let(:search) { FactoryBot.create(:search) }
69
69
  before do
70
70
  allow(search).to receive(:blacklight_config).and_return blacklight_config
71
71
  end
@@ -2,7 +2,7 @@ require 'sitemap_generator'
2
2
 
3
3
  describe Spotlight::Sitemap do
4
4
  let(:sitemap) { SitemapGenerator::Interpreter.new }
5
- let(:exhibit) { FactoryGirl.create(:exhibit, published: true) }
5
+ let(:exhibit) { FactoryBot.create(:exhibit, published: true) }
6
6
  let(:blacklight_config) { Blacklight::Configuration.new }
7
7
  let(:sitemap_content) { sitemap.sitemap.sitemap.instance_variable_get(:@xml_content) }
8
8
  let(:url_helpers) { Spotlight::Engine.routes.url_helpers }
@@ -18,8 +18,8 @@ describe Spotlight::Sitemap do
18
18
  end
19
19
 
20
20
  describe '.add_all_exhibits' do
21
- let!(:second_exhibit) { FactoryGirl.create(:exhibit, published: true) }
22
- let!(:unpublished_exhibit) { FactoryGirl.create(:exhibit, published: false) }
21
+ let!(:second_exhibit) { FactoryBot.create(:exhibit, published: true) }
22
+ let!(:unpublished_exhibit) { FactoryBot.create(:exhibit, published: false) }
23
23
 
24
24
  it 'builds a sitemap for all published exhibits' do
25
25
  sitemaps = []
@@ -73,8 +73,8 @@ describe Spotlight::Sitemap do
73
73
  end
74
74
 
75
75
  describe '#add_pages' do
76
- let!(:feature_page) { FactoryGirl.create(:feature_page, exhibit: exhibit, published: true) }
77
- let!(:about_page) { FactoryGirl.create(:about_page, exhibit: exhibit, published: true) }
76
+ let!(:feature_page) { FactoryBot.create(:feature_page, exhibit: exhibit, published: true) }
77
+ let!(:about_page) { FactoryBot.create(:about_page, exhibit: exhibit, published: true) }
78
78
 
79
79
  it 'adds feature pages' do
80
80
  subject.add_pages
@@ -101,7 +101,7 @@ describe Spotlight::Sitemap do
101
101
  end
102
102
 
103
103
  describe '#add_browse_categories' do
104
- let!(:search) { FactoryGirl.create(:published_search, exhibit: exhibit) }
104
+ let!(:search) { FactoryBot.create(:published_search, exhibit: exhibit) }
105
105
 
106
106
  it 'adds browse categories to the sitemap' do
107
107
  subject.add_browse_categories
@@ -1,5 +1,5 @@
1
1
  describe Spotlight::SolrDocumentSidecar, type: :model do
2
- let(:exhibit) { FactoryGirl.create(:exhibit) }
2
+ let(:exhibit) { FactoryBot.create(:exhibit) }
3
3
  before do
4
4
  allow(subject).to receive_messages exhibit: exhibit
5
5
  allow(subject).to receive_messages document: SolrDocument.new(id: 'doc_id')
@@ -2,7 +2,7 @@ describe Spotlight::IiifManifestPresenter do
2
2
  require 'iiif_manifest'
3
3
 
4
4
  let(:resource) { SolrDocument.new(id: '1-1') }
5
- let(:uploaded_resource) { FactoryGirl.build(:uploaded_resource) }
5
+ let(:uploaded_resource) { FactoryBot.build(:uploaded_resource) }
6
6
  let(:controller) { double(Spotlight::CatalogController) }
7
7
 
8
8
  let(:subject) { described_class.new(resource, controller) }
@@ -1,5 +1,5 @@
1
1
  describe Spotlight::ExhibitExportSerializer do
2
- let!(:source_exhibit) { FactoryGirl.create(:exhibit) }
2
+ let!(:source_exhibit) { FactoryBot.create(:exhibit) }
3
3
 
4
4
  before do
5
5
  allow_any_instance_of(Spotlight::Search).to receive(:set_default_featured_image)
@@ -82,7 +82,7 @@ describe Spotlight::ExhibitExportSerializer do
82
82
  end
83
83
 
84
84
  subject do
85
- e = FactoryGirl.create(:exhibit)
85
+ e = FactoryBot.create(:exhibit)
86
86
  e.import(export).tap(&:save)
87
87
  end
88
88
 
@@ -124,9 +124,9 @@ describe Spotlight::ExhibitExportSerializer do
124
124
  context 'for an exhibit with contacts' do
125
125
  context 'for a contact with an avatar' do
126
126
  let!(:curator) do
127
- FactoryGirl.create(:contact, :with_avatar,
128
- exhibit: source_exhibit,
129
- contact_info: { title: 'xyz' })
127
+ FactoryBot.create(:contact, :with_avatar,
128
+ exhibit: source_exhibit,
129
+ contact_info: { title: 'xyz' })
130
130
  end
131
131
  it 'has contacts' do
132
132
  expect(subject.contacts.count).to eq 1
@@ -138,7 +138,7 @@ describe Spotlight::ExhibitExportSerializer do
138
138
 
139
139
  context 'for a contact without an avatar' do
140
140
  let!(:curator) do
141
- FactoryGirl.create(:contact, exhibit: source_exhibit, avatar: nil)
141
+ FactoryBot.create(:contact, exhibit: source_exhibit, avatar: nil)
142
142
  end
143
143
 
144
144
  it 'has contacts' do
@@ -166,13 +166,13 @@ describe Spotlight::ExhibitExportSerializer do
166
166
  end
167
167
 
168
168
  it 'deals with nested feature pages' do
169
- FactoryGirl.create :feature_subpage, exhibit: source_exhibit
169
+ FactoryBot.create :feature_subpage, exhibit: source_exhibit
170
170
  expect(subject.feature_pages.at_top_level.length).to eq 1
171
171
  expect(subject.feature_pages.first.child_pages.length).to eq 1
172
172
  end
173
173
 
174
174
  context 'page slugs' do
175
- let!(:feature_page) { FactoryGirl.create(:feature_page, exhibit: source_exhibit, slug: 'xyz') }
175
+ let!(:feature_page) { FactoryBot.create(:feature_page, exhibit: source_exhibit, slug: 'xyz') }
176
176
 
177
177
  it 'uses the existing slug for the page' do
178
178
  expect(subject.feature_pages.find('xyz')).to be_persisted
@@ -180,8 +180,8 @@ describe Spotlight::ExhibitExportSerializer do
180
180
  end
181
181
 
182
182
  context 'with a feature page' do
183
- let(:feature_page) { FactoryGirl.create(:feature_page, exhibit: source_exhibit) }
184
- let(:thumbnail) { FactoryGirl.create(:featured_image) }
183
+ let(:feature_page) { FactoryBot.create(:feature_page, exhibit: source_exhibit) }
184
+ let(:thumbnail) { FactoryBot.create(:featured_image) }
185
185
 
186
186
  before do
187
187
  feature_page.content = { data: [{ type: 'text', data: { text: 'xyz' } }] }.to_json
@@ -207,23 +207,23 @@ describe Spotlight::ExhibitExportSerializer do
207
207
  end
208
208
 
209
209
  it 'assigns STI resources the correct class' do
210
- resource = FactoryGirl.create :uploaded_resource, exhibit: source_exhibit
210
+ resource = FactoryBot.create :uploaded_resource, exhibit: source_exhibit
211
211
  expect(subject.resources.length).to eq 1
212
212
  expect(subject.resources.first.class).to eq Spotlight::Resources::Upload
213
213
  expect(subject.resources.first.upload.image.path).not_to eq resource.upload.image.path
214
214
  end
215
215
 
216
216
  it 'assigns normal resources the correct class' do
217
- resource = FactoryGirl.create :resource, exhibit: source_exhibit
217
+ resource = FactoryBot.create :resource, exhibit: source_exhibit
218
218
  expect(subject.resources.length).to eq 1
219
219
  expect(subject.resources.first.class).to eq Spotlight::Resource
220
220
  expect(subject.resources.first.url).to eq resource.url
221
221
  end
222
222
 
223
223
  context 'with a browse category' do
224
- let(:masthead) { FactoryGirl.create(:masthead) }
225
- let(:thumbnail) { FactoryGirl.create(:featured_image) }
226
- let!(:search) { FactoryGirl.create(:search, exhibit: source_exhibit, masthead: masthead, thumbnail: thumbnail) }
224
+ let(:masthead) { FactoryBot.create(:masthead) }
225
+ let(:thumbnail) { FactoryBot.create(:featured_image) }
226
+ let!(:search) { FactoryBot.create(:search, exhibit: source_exhibit, masthead: masthead, thumbnail: thumbnail) }
227
227
 
228
228
  before do
229
229
  source_exhibit.reload
@@ -267,7 +267,7 @@ describe Spotlight::ExhibitExportSerializer do
267
267
  end
268
268
 
269
269
  context 'with a masthead' do
270
- let!(:masthead) { FactoryGirl.create(:masthead) }
270
+ let!(:masthead) { FactoryBot.create(:masthead) }
271
271
 
272
272
  before do
273
273
  source_exhibit.masthead = masthead
@@ -280,7 +280,7 @@ describe Spotlight::ExhibitExportSerializer do
280
280
  end
281
281
 
282
282
  context 'with a thumbnail' do
283
- let!(:thumbnail) { FactoryGirl.create(:exhibit_thumbnail) }
283
+ let!(:thumbnail) { FactoryBot.create(:exhibit_thumbnail) }
284
284
 
285
285
  before do
286
286
  source_exhibit.thumbnail = thumbnail
@@ -294,9 +294,9 @@ describe Spotlight::ExhibitExportSerializer do
294
294
  end
295
295
 
296
296
  it 'is idempotent-ish' do
297
- FactoryGirl.create :feature_subpage, exhibit: source_exhibit
297
+ FactoryBot.create :feature_subpage, exhibit: source_exhibit
298
298
  export = described_class.new(source_exhibit).as_json
299
- e = FactoryGirl.create(:exhibit)
299
+ e = FactoryBot.create(:exhibit)
300
300
  e.import(export).tap(&:save)
301
301
  e.import(export).tap(&:save)
302
302
  end
@@ -315,7 +315,7 @@ describe Spotlight::ExhibitExportSerializer do
315
315
  end
316
316
 
317
317
  subject do
318
- e = FactoryGirl.create(:exhibit)
318
+ e = FactoryBot.create(:exhibit)
319
319
  e.import(export).tap(&:save)
320
320
  end
321
321
 
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  RSpec.describe Spotlight::CarrierwaveFileResolver do
4
- let(:masthead) { FactoryGirl.create(:masthead) }
4
+ let(:masthead) { FactoryBot.create(:masthead) }
5
5
  let(:resolver) { described_class.new }
6
6
 
7
7
  describe 'finding the file' do
@@ -6,7 +6,7 @@ describe Spotlight::IiifResourceResolver do
6
6
  end
7
7
  let(:iiif_manifest_url) { 'https://purl.stanford.edu/gk446cj2442/manifest.json' }
8
8
  let(:resource) do
9
- FactoryGirl.create(
9
+ FactoryBot.create(
10
10
  :featured_image,
11
11
  iiif_manifest_url: iiif_manifest_url,
12
12
  iiif_image_id: 'https://purl.stanford.edu/gk446cj2442/iiif/annotation/gk446cj2442_1',
@@ -1,5 +1,5 @@
1
1
  describe Spotlight::SolrDocumentBuilder do
2
- let(:exhibit) { FactoryGirl.create(:exhibit) }
2
+ let(:exhibit) { FactoryBot.create(:exhibit) }
3
3
  let(:doc_builder) { described_class.new(resource) }
4
4
  let(:resource) { Spotlight::Resource.new }
5
5
 
@@ -18,8 +18,8 @@ describe Spotlight::SolrDocumentBuilder do
18
18
  describe '#documents_to_index' do
19
19
  context 'when the document belongs to more than one exhibit' do
20
20
  let(:doc) { SolrDocument.new(id: 'abc123') }
21
- let(:resource) { FactoryGirl.create(:resource) }
22
- let(:resource_alt) { FactoryGirl.create(:resource) }
21
+ let(:resource) { FactoryBot.create(:resource) }
22
+ let(:resource_alt) { FactoryBot.create(:resource) }
23
23
  subject { resource.document_builder }
24
24
 
25
25
  before do
@@ -1,5 +1,5 @@
1
1
  ENV['RAILS_ENV'] ||= 'test'
2
- require 'factory_girl'
2
+ require 'factory_bot'
3
3
  require 'database_cleaner'
4
4
  require 'devise'
5
5
  require 'engine_cart'
@@ -12,6 +12,7 @@ require 'rspec/collection_matchers'
12
12
  require 'rspec/its'
13
13
  require 'rspec/rails'
14
14
  require 'rspec/active_model/mocks'
15
+ require 'paper_trail/frameworks/rspec'
15
16
 
16
17
  require 'selenium-webdriver'
17
18
 
@@ -45,8 +46,8 @@ Spotlight::Engine.config.exhibit_themes = %w(default modern)
45
46
 
46
47
  Dir['./spec/support/**/*.rb'].sort.each { |f| require f }
47
48
 
48
- FactoryGirl.definition_file_paths = [File.expand_path('../factories', __FILE__)]
49
- FactoryGirl.find_definitions
49
+ FactoryBot.definition_file_paths = [File.expand_path('../factories', __FILE__)]
50
+ FactoryBot.find_definitions
50
51
 
51
52
  FIXTURES_PATH = File.expand_path('../fixtures', __FILE__)
52
53
 
@@ -72,8 +73,6 @@ RSpec.configure do |config|
72
73
  DatabaseCleaner.clean
73
74
  end
74
75
 
75
- config.filter_run_excluding js: true if ENV['CI']
76
-
77
76
  if defined? Devise::Test::ControllerHelpers
78
77
  config.include Devise::Test::ControllerHelpers, type: :controller
79
78
  config.include Devise::Test::ControllerHelpers, type: :view
@@ -24,10 +24,10 @@ module Spotlight
24
24
  def click_add_widget
25
25
  unless all('.st-block-replacer').present?
26
26
  expect(page).to have_css('.st-block-addition')
27
- first('.st-block-addition').trigger('click')
27
+ first('.st-block-addition').click
28
28
  end
29
29
  expect(page).to have_css('.st-block-replacer')
30
- first('.st-block-replacer').trigger('click')
30
+ first('.st-block-replacer').click
31
31
  end
32
32
 
33
33
  def save_page
@@ -1,5 +1,5 @@
1
1
  describe Spotlight::FeaturedImageUploader do
2
- let(:mounter) { FactoryGirl.create(:featured_image) }
2
+ let(:mounter) { FactoryBot.create(:featured_image) }
3
3
  subject(:featured_image_uploader) { described_class.new(mounter, 'mounted_as') }
4
4
 
5
5
  describe '#extension_whitelist' do
@@ -1,5 +1,5 @@
1
1
  describe '_user_util_links', type: :view do
2
- let(:current_exhibit) { FactoryGirl.create(:exhibit) }
2
+ let(:current_exhibit) { FactoryBot.create(:exhibit) }
3
3
  before do
4
4
  allow(view).to receive(:blacklight_config).and_return(Blacklight::Configuration.new)
5
5
  allow(view).to receive(:current_user).and_return(current_user)
@@ -1,9 +1,9 @@
1
1
  describe 'shared/_exhibit_navbar', type: :view do
2
- let(:current_exhibit) { FactoryGirl.create(:exhibit) }
3
- let(:feature_page) { FactoryGirl.create(:feature_page, exhibit: current_exhibit) }
4
- let(:unpublished_feature_page) { FactoryGirl.create(:feature_page, published: false, exhibit: current_exhibit) }
5
- let(:about_page) { FactoryGirl.create(:about_page, exhibit: current_exhibit) }
6
- let(:unpublished_about_page) { FactoryGirl.create(:about_page, published: false, exhibit: current_exhibit) }
2
+ let(:current_exhibit) { FactoryBot.create(:exhibit) }
3
+ let(:feature_page) { FactoryBot.create(:feature_page, exhibit: current_exhibit) }
4
+ let(:unpublished_feature_page) { FactoryBot.create(:feature_page, published: false, exhibit: current_exhibit) }
5
+ let(:about_page) { FactoryBot.create(:about_page, exhibit: current_exhibit) }
6
+ let(:unpublished_about_page) { FactoryBot.create(:about_page, published: false, exhibit: current_exhibit) }
7
7
 
8
8
  before do
9
9
  allow(view).to receive_messages(resource_masthead?: false)
@@ -38,7 +38,7 @@ describe 'shared/_exhibit_navbar', type: :view do
38
38
 
39
39
  it 'provides a dropdown of multiple feature pages' do
40
40
  feature_page
41
- another_page = FactoryGirl.create(:feature_page, exhibit: current_exhibit)
41
+ another_page = FactoryBot.create(:feature_page, exhibit: current_exhibit)
42
42
  render
43
43
  expect(response).to have_selector '.dropdown .dropdown-toggle', text: 'Curated Features'
44
44
  expect(response).to have_link feature_page.title, visible: false, href: spotlight.exhibit_feature_page_path(current_exhibit, feature_page)
@@ -57,13 +57,13 @@ describe 'shared/_exhibit_navbar', type: :view do
57
57
  end
58
58
 
59
59
  it "links to the browse index if there's a published search" do
60
- FactoryGirl.create :published_search, exhibit: current_exhibit
60
+ FactoryBot.create :published_search, exhibit: current_exhibit
61
61
  render
62
62
  expect(response).to have_link 'Browse', href: spotlight.exhibit_browse_index_path(current_exhibit)
63
63
  end
64
64
 
65
65
  it "marks the browse button as active if we're on a browse page" do
66
- FactoryGirl.create :published_search, exhibit: current_exhibit
66
+ FactoryBot.create :published_search, exhibit: current_exhibit
67
67
  allow(view).to receive_messages(on_browse_page?: true)
68
68
  render
69
69
  expect(response).to have_selector 'li.active', text: 'Browse'
@@ -75,7 +75,7 @@ describe 'shared/_exhibit_navbar', type: :view do
75
75
  end
76
76
 
77
77
  it 'does not link to the browse index if only private categories are defined' do
78
- FactoryGirl.create :search, exhibit: current_exhibit
78
+ FactoryBot.create :search, exhibit: current_exhibit
79
79
  render
80
80
  expect(response).not_to have_link 'Browse'
81
81
  end