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,5 +1,5 @@
1
1
  describe Spotlight::AboutPage, type: :model do
2
- let(:page) { described_class.create! exhibit: FactoryGirl.create(:exhibit) }
2
+ let(:page) { described_class.create! exhibit: FactoryBot.create(:exhibit) }
3
3
  it { is_expected.not_to be_feature_page }
4
4
  it { is_expected.to be_about_page }
5
5
  it 'displays the sidebar' do
@@ -14,7 +14,7 @@ describe Spotlight::AccessControlsEnforcementSearchBuilder do
14
14
  end
15
15
 
16
16
  subject { MockSearchBuilder.new blacklight_params, scope }
17
- let(:exhibit) { FactoryGirl.create(:exhibit) }
17
+ let(:exhibit) { FactoryBot.create(:exhibit) }
18
18
  let(:scope) { double(current_exhibit: exhibit) }
19
19
  let(:solr_request) { Blacklight::Solr::Request.new }
20
20
  let(:blacklight_params) { Hash.new }
@@ -12,7 +12,11 @@ describe Spotlight::BlacklightConfiguration, type: :model do
12
12
  config.add_sort_field 'identifier', sort: 'id asc', label: 'Identifier'
13
13
  end
14
14
  allow(subject).to receive_messages default_blacklight_config: blacklight_config
15
- subject.exhibit = FactoryGirl.create(:exhibit)
15
+ subject.exhibit = FactoryBot.create(:exhibit)
16
+ end
17
+
18
+ it 'is expected to be versioned' do
19
+ is_expected.to be_versioned
16
20
  end
17
21
 
18
22
  it 'touches the exhibit' do
@@ -336,6 +340,11 @@ describe Spotlight::BlacklightConfiguration, type: :model do
336
340
  expect(subject.blacklight_config.sort_fields.select { |_k, v| v.enabled == true }).to include('a', 'c')
337
341
  expect(subject.blacklight_config.sort_fields.select { |_k, v| v.enabled == true }).not_to include('b', 'd')
338
342
  end
343
+
344
+ it 'is disabled when enabled = false' do
345
+ blacklight_config.add_sort_field 'a', enabled: false
346
+ expect(subject.blacklight_config.sort_fields['a'].enabled).to eq false
347
+ end
339
348
  end
340
349
 
341
350
  describe 'search fields' do
@@ -369,6 +378,11 @@ describe Spotlight::BlacklightConfiguration, type: :model do
369
378
  blacklight_config.add_search_field 'a', if: false
370
379
  expect(subject.blacklight_config.search_fields['a'].if).to eq false
371
380
  end
381
+
382
+ it 'is disabled when enabled = false' do
383
+ blacklight_config.add_search_field 'a', enabled: false
384
+ expect(subject.blacklight_config.search_fields['a'].enabled).to eq false
385
+ end
372
386
  end
373
387
 
374
388
  describe 'per page' do
@@ -1,5 +1,5 @@
1
1
  describe Spotlight::ContactEmail, type: :model do
2
- let(:exhibit) { FactoryGirl.create(:exhibit) }
2
+ let(:exhibit) { FactoryBot.create(:exhibit) }
3
3
  subject { described_class.new(exhibit: exhibit) }
4
4
 
5
5
  it { is_expected.not_to be_valid }
@@ -1,6 +1,6 @@
1
1
  describe Spotlight::ContactForm do
2
2
  subject { described_class.new(name: 'Root', email: 'user@example.com').tap { |c| c.current_exhibit = exhibit } }
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
  context 'with a site-wide contact email' do
@@ -1,5 +1,5 @@
1
1
  describe Spotlight::Contact, type: :model do
2
- let(:exhibit) { FactoryGirl.create(:exhibit) }
2
+ let(:exhibit) { FactoryBot.create(:exhibit) }
3
3
 
4
4
  before do
5
5
  subject.exhibit = exhibit
@@ -7,7 +7,7 @@ describe Spotlight::CustomField, type: :model do
7
7
  end
8
8
 
9
9
  describe 'when the exhibit has a config' do
10
- let(:exhibit) { FactoryGirl.create(:exhibit) }
10
+ let(:exhibit) { FactoryBot.create(:exhibit) }
11
11
  before { subject.exhibit = exhibit }
12
12
  describe 'that overrides the label' do
13
13
  before do
@@ -29,7 +29,7 @@ describe Spotlight::CustomField, type: :model do
29
29
  end
30
30
 
31
31
  describe 'when the exhibit has a config' do
32
- let(:exhibit) { FactoryGirl.create(:exhibit) }
32
+ let(:exhibit) { FactoryBot.create(:exhibit) }
33
33
  before { subject.exhibit = exhibit }
34
34
  describe 'that overrides the label' do
35
35
  before do
@@ -77,7 +77,7 @@ describe Spotlight::CustomField, type: :model do
77
77
  end
78
78
 
79
79
  describe '#solr_field' do
80
- let(:exhibit) { FactoryGirl.create(:exhibit) }
80
+ let(:exhibit) { FactoryBot.create(:exhibit) }
81
81
  let(:custom_field) do
82
82
  described_class.create(exhibit: exhibit, configuration: { 'label' => 'xyz' })
83
83
  end
@@ -110,7 +110,7 @@ describe Spotlight::CustomField, type: :model do
110
110
  end
111
111
 
112
112
  describe '#configured_to_display?' do
113
- let(:exhibit) { FactoryGirl.create(:exhibit) }
113
+ let(:exhibit) { FactoryBot.create(:exhibit) }
114
114
  before do
115
115
  exhibit.blacklight_configuration.blacklight_config.view = { view_name: {} }
116
116
  subject.exhibit = exhibit
@@ -147,7 +147,7 @@ describe Spotlight::CustomField, type: :model do
147
147
  end
148
148
 
149
149
  describe 'changing the field type' do
150
- let(:exhibit) { FactoryGirl.create(:exhibit) }
150
+ let(:exhibit) { FactoryBot.create(:exhibit) }
151
151
  before do
152
152
  subject.label = 'xyz'
153
153
  subject.exhibit = exhibit
@@ -1,5 +1,5 @@
1
1
  describe Spotlight::Exhibit, type: :model do
2
- subject(:exhibit) { FactoryGirl.build(:exhibit, title: 'Sample') }
2
+ subject(:exhibit) { FactoryBot.build(:exhibit, title: 'Sample') }
3
3
 
4
4
  it 'has a title' do
5
5
  subject.title = 'Test title'
@@ -46,7 +46,7 @@ describe Spotlight::Exhibit, type: :model do
46
46
  end
47
47
 
48
48
  describe '#main_navigations' do
49
- subject { FactoryGirl.create(:exhibit, title: 'Sample') }
49
+ subject { FactoryBot.create(:exhibit, title: 'Sample') }
50
50
  it 'has main navigations' do
51
51
  expect(subject.main_navigations).to have(3).main_navigations
52
52
  expect(subject.main_navigations.map(&:label).compact).to be_blank
@@ -86,7 +86,7 @@ describe Spotlight::Exhibit, type: :model do
86
86
  end
87
87
 
88
88
  describe '#blacklight_config' do
89
- subject { FactoryGirl.create(:exhibit) }
89
+ subject { FactoryBot.create(:exhibit) }
90
90
  before do
91
91
  subject.blacklight_configuration.index = { timestamp_field: 'timestamp_field' }
92
92
  subject.save!
@@ -99,7 +99,7 @@ describe Spotlight::Exhibit, type: :model do
99
99
  end
100
100
 
101
101
  describe '#solr_data' do
102
- let(:exhibit) { FactoryGirl.create(:exhibit) }
102
+ let(:exhibit) { FactoryBot.create(:exhibit) }
103
103
  subject { exhibit.solr_data }
104
104
 
105
105
  context 'when not filtering by exhibit' do
@@ -133,7 +133,7 @@ describe Spotlight::Exhibit, type: :model do
133
133
  end
134
134
 
135
135
  describe '#analytics' do
136
- subject { FactoryGirl.create(:exhibit) }
136
+ subject { FactoryBot.create(:exhibit) }
137
137
  let(:ga_data) { OpenStruct.new(pageviews: 123) }
138
138
 
139
139
  before do
@@ -147,7 +147,7 @@ describe Spotlight::Exhibit, type: :model do
147
147
  end
148
148
 
149
149
  describe '#page_analytics' do
150
- subject { FactoryGirl.create(:exhibit) }
150
+ subject { FactoryBot.create(:exhibit) }
151
151
  let(:ga_data) { [OpenStruct.new(pageviews: 123)] }
152
152
 
153
153
  before do
@@ -162,7 +162,7 @@ describe Spotlight::Exhibit, type: :model do
162
162
  end
163
163
 
164
164
  describe '#reindex_later' do
165
- subject { FactoryGirl.create(:exhibit) }
165
+ subject { FactoryBot.create(:exhibit) }
166
166
  let(:log_entry) { Spotlight::ReindexingLogEntry.new(exhibit: subject, user: user, items_reindexed_count: 0) }
167
167
 
168
168
  context 'user is omitted' do
@@ -177,7 +177,7 @@ describe Spotlight::Exhibit, type: :model do
177
177
  end
178
178
 
179
179
  context 'non-nil user is provided' do
180
- let(:user) { FactoryGirl.build(:user) }
180
+ let(:user) { FactoryBot.build(:user) }
181
181
 
182
182
  it 'queues a reindex job for the exhibit, with actual user for the log entry' do
183
183
  expect(subject).to receive(:new_reindexing_log_entry).with(user).and_return(log_entry)
@@ -189,7 +189,7 @@ describe Spotlight::Exhibit, type: :model do
189
189
  end
190
190
 
191
191
  describe '#new_reindexing_log_entry' do
192
- let(:user) { FactoryGirl.build(:user) }
192
+ let(:user) { FactoryBot.build(:user) }
193
193
  it 'returns a properly configured Spotlight::ReindexingLogEntry instance' do
194
194
  reindexing_log_entry = subject.send(:new_reindexing_log_entry, user)
195
195
  expect(reindexing_log_entry.exhibit).to eq subject
@@ -259,8 +259,8 @@ describe Spotlight::Exhibit, type: :model do
259
259
 
260
260
  describe '#requested_by' do
261
261
  context 'with multiple exhibit users' do
262
- let!(:exhibit_admin) { FactoryGirl.create(:exhibit_admin, exhibit: subject) }
263
- let!(:another_exhibit_admin) { FactoryGirl.create(:exhibit_admin, exhibit: subject) }
262
+ let!(:exhibit_admin) { FactoryBot.create(:exhibit_admin, exhibit: subject) }
263
+ let!(:another_exhibit_admin) { FactoryBot.create(:exhibit_admin, exhibit: subject) }
264
264
 
265
265
  it 'is the first listed user' do
266
266
  expect(subject.requested_by).to eq exhibit_admin
@@ -277,16 +277,16 @@ describe Spotlight::Exhibit, type: :model do
277
277
  describe '#reindex_progress' do
278
278
  let!(:reindexing_log_entries) do
279
279
  [
280
- FactoryGirl.create(:unstarted_reindexing_log_entry, exhibit: exhibit),
281
- FactoryGirl.create(:reindexing_log_entry, exhibit: exhibit),
280
+ FactoryBot.create(:unstarted_reindexing_log_entry, exhibit: exhibit),
281
+ FactoryBot.create(:reindexing_log_entry, exhibit: exhibit),
282
282
  in_progress_entry,
283
- FactoryGirl.create(:failed_reindexing_log_entry, exhibit: exhibit),
284
- FactoryGirl.create(:unstarted_reindexing_log_entry, exhibit: exhibit)
283
+ FactoryBot.create(:failed_reindexing_log_entry, exhibit: exhibit),
284
+ FactoryBot.create(:unstarted_reindexing_log_entry, exhibit: exhibit)
285
285
  ]
286
286
  end
287
287
 
288
288
  let(:in_progress_entry) do
289
- FactoryGirl.create(:in_progress_reindexing_log_entry, exhibit: exhibit)
289
+ FactoryBot.create(:in_progress_reindexing_log_entry, exhibit: exhibit)
290
290
  end
291
291
 
292
292
  it 'returns the latest log entry that is not unstarted' do
@@ -295,4 +295,8 @@ describe Spotlight::Exhibit, type: :model do
295
295
  expect(reindex_progress.current_log_entry).to eq in_progress_entry
296
296
  end
297
297
  end
298
+
299
+ it 'is expected to be versioned' do
300
+ is_expected.to be_versioned
301
+ end
298
302
  end
@@ -1,19 +1,19 @@
1
1
  describe Spotlight::FeaturePage, type: :model do
2
- let(:exhibit) { FactoryGirl.create(:exhibit) }
2
+ let(:exhibit) { FactoryBot.create(:exhibit) }
3
3
  describe 'default_scope' do
4
- let!(:page1) { FactoryGirl.create(:feature_page, weight: 5, exhibit: exhibit) }
5
- let!(:page2) { FactoryGirl.create(:feature_page, weight: 1, exhibit: exhibit) }
6
- let!(:page3) { FactoryGirl.create(:feature_page, weight: 10, exhibit: exhibit) }
4
+ let!(:page1) { FactoryBot.create(:feature_page, weight: 5, exhibit: exhibit) }
5
+ let!(:page2) { FactoryBot.create(:feature_page, weight: 1, exhibit: exhibit) }
6
+ let!(:page3) { FactoryBot.create(:feature_page, weight: 10, exhibit: exhibit) }
7
7
  it 'orders by weight' do
8
8
  expect(described_class.all.map(&:weight)).to eq [1, 5, 10]
9
9
  end
10
10
  end
11
11
 
12
12
  describe 'display_sidebar?' do
13
- let(:parent) { FactoryGirl.create(:feature_page, exhibit: exhibit) }
14
- let!(:child) { FactoryGirl.create(:feature_page, parent_page: parent, exhibit: exhibit) }
15
- let!(:unpublished_parent) { FactoryGirl.create(:feature_page, published: false, exhibit: exhibit) }
16
- let!(:unpublished_child) { FactoryGirl.create(:feature_page, parent_page: unpublished_parent, published: false, exhibit: exhibit) }
13
+ let(:parent) { FactoryBot.create(:feature_page, exhibit: exhibit) }
14
+ let!(:child) { FactoryBot.create(:feature_page, parent_page: parent, exhibit: exhibit) }
15
+ let!(:unpublished_parent) { FactoryBot.create(:feature_page, published: false, exhibit: exhibit) }
16
+ let!(:unpublished_child) { FactoryBot.create(:feature_page, parent_page: unpublished_parent, published: false, exhibit: exhibit) }
17
17
  before { unpublished_parent.display_sidebar = false }
18
18
  it 'is set to true if the page has a published child' do
19
19
  expect(parent.display_sidebar?).to be_truthy
@@ -32,9 +32,9 @@ describe Spotlight::FeaturePage, type: :model do
32
32
  end
33
33
 
34
34
  describe 'weight' do
35
- let(:good_weight) { FactoryGirl.build(:feature_page, weight: 10, exhibit: exhibit) }
36
- let(:low_weight) { FactoryGirl.build(:feature_page, weight: -1, exhibit: exhibit) }
37
- let(:high_weight) { FactoryGirl.build(:feature_page, weight: 51, exhibit: exhibit) }
35
+ let(:good_weight) { FactoryBot.build(:feature_page, weight: 10, exhibit: exhibit) }
36
+ let(:low_weight) { FactoryBot.build(:feature_page, weight: -1, exhibit: exhibit) }
37
+ let(:high_weight) { FactoryBot.build(:feature_page, weight: 51, exhibit: exhibit) }
38
38
  it 'defaults to 50' do
39
39
  expect(described_class.new.weight).to eq 50
40
40
  end
@@ -56,9 +56,9 @@ describe Spotlight::FeaturePage, type: :model do
56
56
  it { is_expected.not_to be_about_page }
57
57
 
58
58
  describe 'relationships' do
59
- let(:parent) { FactoryGirl.create(:feature_page, exhibit: exhibit) }
60
- let!(:child1) { FactoryGirl.create(:feature_page, parent_page: parent, exhibit: exhibit) }
61
- let!(:child2) { FactoryGirl.create(:feature_page, parent_page: parent, exhibit: exhibit) }
59
+ let(:parent) { FactoryBot.create(:feature_page, exhibit: exhibit) }
60
+ let!(:child1) { FactoryBot.create(:feature_page, parent_page: parent, exhibit: exhibit) }
61
+ let!(:child2) { FactoryBot.create(:feature_page, parent_page: parent, exhibit: exhibit) }
62
62
  it 'child pages should have a parent_page' do
63
63
  [child1, child2].each do |child|
64
64
  expect(child.parent_page).to eq parent
@@ -1,5 +1,5 @@
1
1
  describe Spotlight::FieldMetadata do
2
- let(:exhibit) { FactoryGirl.create(:exhibit) }
2
+ let(:exhibit) { FactoryBot.create(:exhibit) }
3
3
  let(:repository) { double }
4
4
  let(:blacklight_config) do
5
5
  Blacklight::Configuration.new do |config|
@@ -1,5 +1,5 @@
1
1
  describe Spotlight::HomePage, type: :model do
2
- let(:home_page) { FactoryGirl.create(:home_page) }
2
+ let(:home_page) { FactoryBot.create(:home_page) }
3
3
  it { is_expected.not_to be_feature_page }
4
4
  it { is_expected.not_to be_about_page }
5
5
  it 'displays the sidebar' do
@@ -1,6 +1,6 @@
1
1
  describe Spotlight::MainNavigation, type: :model do
2
2
  before do
3
- subject.exhibit = FactoryGirl.create(:exhibit)
3
+ subject.exhibit = FactoryBot.create(:exhibit)
4
4
  end
5
5
 
6
6
  it 'has a default_label' do
@@ -1,5 +1,5 @@
1
1
  describe Spotlight::Page, type: :model do
2
- let(:exhibit) { FactoryGirl.create(:exhibit) }
2
+ let(:exhibit) { FactoryBot.create(:exhibit) }
3
3
  let!(:parent_page) { Spotlight::FeaturePage.create! exhibit: exhibit, published: true }
4
4
  let!(:child_page) { Spotlight::FeaturePage.create! exhibit: exhibit, published: false, parent_page: parent_page }
5
5
 
@@ -15,6 +15,10 @@ describe Spotlight::Page, type: :model do
15
15
  end
16
16
  end
17
17
 
18
+ it 'is expected to be versioned' do
19
+ is_expected.to be_versioned
20
+ end
21
+
18
22
  describe '#top_level_page?' do
19
23
  it 'checks if the page is a top-level page' do
20
24
  expect(parent_page).to be_a_top_level_page
@@ -37,7 +41,7 @@ describe Spotlight::Page, type: :model do
37
41
  end
38
42
  end
39
43
  describe 'should_display_title?' do
40
- let(:page) { FactoryGirl.create(:feature_page) }
44
+ let(:page) { FactoryBot.create(:feature_page) }
41
45
  it 'returns if the title is present or not' do
42
46
  expect(page.title).not_to be_blank
43
47
  expect(page.should_display_title?).to be_truthy
@@ -47,7 +51,7 @@ describe Spotlight::Page, type: :model do
47
51
  end
48
52
 
49
53
  describe '#content=' do
50
- let(:page) { FactoryGirl.create(:feature_page) }
54
+ let(:page) { FactoryBot.create(:feature_page) }
51
55
 
52
56
  it 'works with a serialized JSON array' do
53
57
  page.content = [].to_json
@@ -60,7 +64,7 @@ describe Spotlight::Page, type: :model do
60
64
  end
61
65
 
62
66
  describe '#content?' do
63
- let(:page) { FactoryGirl.create(:feature_page) }
67
+ let(:page) { FactoryBot.create(:feature_page) }
64
68
 
65
69
  it 'does not have content when the page is empty' do
66
70
  page.content = []
@@ -74,7 +78,7 @@ describe Spotlight::Page, type: :model do
74
78
  end
75
79
 
76
80
  describe '#slug' do
77
- let(:page) { FactoryGirl.create(:feature_page) }
81
+ let(:page) { FactoryBot.create(:feature_page) }
78
82
 
79
83
  it 'gets a default slug' do
80
84
  expect(page.slug).not_to be_blank
@@ -86,7 +90,7 @@ describe Spotlight::Page, type: :model do
86
90
  end
87
91
 
88
92
  context 'with a custom slug' do
89
- let(:page) { FactoryGirl.create(:feature_page, slug: 'xyz') }
93
+ let(:page) { FactoryBot.create(:feature_page, slug: 'xyz') }
90
94
 
91
95
  it 'gets a default slug' do
92
96
  expect(page.slug).to eq 'xyz'
@@ -95,8 +99,8 @@ describe Spotlight::Page, type: :model do
95
99
  end
96
100
 
97
101
  describe 'thumbnail_image_url' do
98
- subject(:thumbnail) { FactoryGirl.create(:featured_image) }
99
- subject(:page) { FactoryGirl.create(:feature_page, exhibit: exhibit) }
102
+ subject(:thumbnail) { FactoryBot.create(:featured_image) }
103
+ subject(:page) { FactoryBot.create(:feature_page, exhibit: exhibit) }
100
104
 
101
105
  it 'is nil when there is no thumbnail' do
102
106
  expect(page.thumbnail_image_url).to be_nil
@@ -1,6 +1,6 @@
1
1
  describe Spotlight::ReindexProgress, type: :model do
2
2
  let(:reindexing_log_entry) do
3
- FactoryGirl.create(:failed_reindexing_log_entry, items_reindexed_estimate: 12)
3
+ FactoryBot.create(:failed_reindexing_log_entry, items_reindexed_estimate: 12)
4
4
  end
5
5
 
6
6
  let(:subject) { described_class.new(reindexing_log_entry) }
@@ -64,7 +64,7 @@ describe Spotlight::ReindexProgress, type: :model do
64
64
 
65
65
  describe '#recently_in_progress?' do
66
66
  context 'there is no end_time for current_log_entry' do
67
- let(:reindexing_log_entry) { FactoryGirl.create(:in_progress_reindexing_log_entry) }
67
+ let(:reindexing_log_entry) { FactoryBot.create(:in_progress_reindexing_log_entry) }
68
68
 
69
69
  it 'returns true' do
70
70
  expect(subject).to be_recently_in_progress
@@ -72,7 +72,7 @@ describe Spotlight::ReindexProgress, type: :model do
72
72
  end
73
73
 
74
74
  context 'current_log_entry has an end_time less than Spotlight::Engine.config.reindex_progress_window.minutes.ago' do
75
- let(:reindexing_log_entry) { FactoryGirl.create(:recent_reindexing_log_entry, end_time: Time.zone.now) }
75
+ let(:reindexing_log_entry) { FactoryBot.create(:recent_reindexing_log_entry, end_time: Time.zone.now) }
76
76
 
77
77
  it 'returns true' do
78
78
  expect(subject).to be_recently_in_progress
@@ -80,7 +80,7 @@ describe Spotlight::ReindexProgress, type: :model do
80
80
  end
81
81
 
82
82
  context 'current_log_entry is unstarted ' do
83
- let(:reindexing_log_entry) { FactoryGirl.create(:unstarted_reindexing_log_entry) }
83
+ let(:reindexing_log_entry) { FactoryBot.create(:unstarted_reindexing_log_entry) }
84
84
 
85
85
  it 'returns false' do
86
86
  expect(subject).not_to be_recently_in_progress
@@ -1,11 +1,11 @@
1
1
  describe Spotlight::ReindexingLogEntry, type: :model do
2
- subject { FactoryGirl.build(:reindexing_log_entry) }
2
+ subject { FactoryBot.build(:reindexing_log_entry) }
3
3
 
4
4
  describe 'scope' do
5
5
  before do
6
- (0..10).to_a.each { FactoryGirl.create(:recent_reindexing_log_entry) }
7
- FactoryGirl.create(:unstarted_reindexing_log_entry)
8
- (0..10).to_a.each { FactoryGirl.create(:recent_reindexing_log_entry) }
6
+ (0..10).to_a.each { FactoryBot.create(:recent_reindexing_log_entry) }
7
+ FactoryBot.create(:unstarted_reindexing_log_entry)
8
+ (0..10).to_a.each { FactoryBot.create(:recent_reindexing_log_entry) }
9
9
  end
10
10
 
11
11
  let(:sorted_log_entry_list) do
@@ -37,7 +37,7 @@ describe Spotlight::ReindexingLogEntry, type: :model do
37
37
  end
38
38
 
39
39
  context 'when end_time is not present' do
40
- subject { FactoryGirl.build(:in_progress_reindexing_log_entry) }
40
+ subject { FactoryBot.build(:in_progress_reindexing_log_entry) }
41
41
 
42
42
  it 'is nil' do
43
43
  expect(subject.duration).to be nil
@@ -47,7 +47,7 @@ describe Spotlight::ReindexingLogEntry, type: :model do
47
47
 
48
48
  describe 'state updating methods' do
49
49
  describe '#in_progress!' do
50
- subject { FactoryGirl.build(:unstarted_reindexing_log_entry) }
50
+ subject { FactoryBot.build(:unstarted_reindexing_log_entry) }
51
51
 
52
52
  context 'executes normally' do
53
53
  it 'sets start_time and job_status' do
@@ -73,7 +73,7 @@ describe Spotlight::ReindexingLogEntry, type: :model do
73
73
  end
74
74
 
75
75
  describe '#succeeded!' do
76
- subject { FactoryGirl.build(:in_progress_reindexing_log_entry) }
76
+ subject { FactoryBot.build(:in_progress_reindexing_log_entry) }
77
77
 
78
78
  context 'executes normally' do
79
79
  it 'sets end_time and job_status' do
@@ -99,7 +99,7 @@ describe Spotlight::ReindexingLogEntry, type: :model do
99
99
  end
100
100
 
101
101
  describe '#failed!' do
102
- subject { FactoryGirl.build(:in_progress_reindexing_log_entry) }
102
+ subject { FactoryBot.build(:in_progress_reindexing_log_entry) }
103
103
 
104
104
  context 'executes normally' do
105
105
  it 'sets end_time and job_status' do