blacklight-spotlight 3.4.0 → 3.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/spotlight/roles_controller.rb +1 -1
- data/lib/spotlight/version.rb +1 -1
- metadata +6 -610
- data/spec/controllers/application_controller_spec.rb +0 -30
- data/spec/controllers/spotlight/about_pages_controller_spec.rb +0 -239
- data/spec/controllers/spotlight/admin_users_controller_spec.rb +0 -53
- data/spec/controllers/spotlight/appearances_controller_spec.rb +0 -88
- data/spec/controllers/spotlight/application_controller_spec.rb +0 -11
- data/spec/controllers/spotlight/attachments_controller_spec.rb +0 -28
- data/spec/controllers/spotlight/browse_controller_spec.rb +0 -133
- data/spec/controllers/spotlight/bulk_actions_controller_spec.rb +0 -124
- data/spec/controllers/spotlight/bulk_updates_controller_spec.rb +0 -77
- data/spec/controllers/spotlight/catalog_controller_spec.rb +0 -552
- data/spec/controllers/spotlight/confirmations_controller_spec.rb +0 -38
- data/spec/controllers/spotlight/contact_email_controller_spec.rb +0 -65
- data/spec/controllers/spotlight/contact_forms_controller_spec.rb +0 -38
- data/spec/controllers/spotlight/contacts_controller_spec.rb +0 -103
- data/spec/controllers/spotlight/custom_fields_controller_spec.rb +0 -62
- data/spec/controllers/spotlight/custom_search_fields_controller_spec.rb +0 -62
- data/spec/controllers/spotlight/dashboards_controller_spec.rb +0 -68
- data/spec/controllers/spotlight/exhibits_controller_spec.rb +0 -216
- data/spec/controllers/spotlight/feature_pages_controller_spec.rb +0 -251
- data/spec/controllers/spotlight/featured_images_controller_spec.rb +0 -77
- data/spec/controllers/spotlight/filters_controller_spec.rb +0 -72
- data/spec/controllers/spotlight/groups_controller_spec.rb +0 -103
- data/spec/controllers/spotlight/home_pages_controller_spec.rb +0 -126
- data/spec/controllers/spotlight/job_trackers_controller_spec.rb +0 -37
- data/spec/controllers/spotlight/languages_controller_spec.rb +0 -70
- data/spec/controllers/spotlight/metadata_configurations_controller_spec.rb +0 -93
- data/spec/controllers/spotlight/pages_controller_spec.rb +0 -50
- data/spec/controllers/spotlight/resources/csv_upload_controller_spec.rb +0 -71
- data/spec/controllers/spotlight/resources/upload_controller_spec.rb +0 -55
- data/spec/controllers/spotlight/resources_controller_spec.rb +0 -85
- data/spec/controllers/spotlight/roles_controller_spec.rb +0 -141
- data/spec/controllers/spotlight/search_configurations_controller_spec.rb +0 -141
- data/spec/controllers/spotlight/searches_controller_spec.rb +0 -195
- data/spec/controllers/spotlight/sites_controller_spec.rb +0 -67
- data/spec/controllers/spotlight/solr_controller_spec.rb +0 -116
- data/spec/controllers/spotlight/tags_controller_spec.rb +0 -56
- data/spec/controllers/spotlight/translations_controller_spec.rb +0 -132
- data/spec/controllers/spotlight/versions_controller_spec.rb +0 -56
- data/spec/controllers/spotlight/view_configurations_controller_spec.rb +0 -35
- data/spec/examples.txt +0 -1515
- data/spec/factories/bulk_updates.rb +0 -21
- data/spec/factories/contact_emails.rb +0 -8
- data/spec/factories/contact_images.rb +0 -8
- data/spec/factories/contacts.rb +0 -11
- data/spec/factories/custom_fields.rb +0 -9
- data/spec/factories/custom_search_fields.rb +0 -9
- data/spec/factories/exhibit_thumbnails.rb +0 -8
- data/spec/factories/exhibits.rb +0 -17
- data/spec/factories/featured_images.rb +0 -16
- data/spec/factories/group.rb +0 -17
- data/spec/factories/job_trackers.rb +0 -11
- data/spec/factories/language.rb +0 -8
- data/spec/factories/main_navigation.rb +0 -9
- data/spec/factories/pages.rb +0 -34
- data/spec/factories/resources.rb +0 -14
- data/spec/factories/roles.rb +0 -9
- data/spec/factories/searches.rb +0 -33
- data/spec/factories/tags.rb +0 -14
- data/spec/factories/translation.rb +0 -8
- data/spec/factories/users.rb +0 -50
- data/spec/features/about_page_spec.rb +0 -46
- data/spec/features/add_contacts_spec.rb +0 -63
- data/spec/features/add_custom_field_metadata_spec.rb +0 -88
- data/spec/features/add_iiif_manifest_spec.rb +0 -46
- data/spec/features/add_items_spec.rb +0 -135
- data/spec/features/autocomplete_typeahead_spec.rb +0 -89
- data/spec/features/browse_category_admin_spec.rb +0 -163
- data/spec/features/browse_category_navigation_spec.rb +0 -44
- data/spec/features/browse_category_spec.rb +0 -158
- data/spec/features/bulk_actions_spec.rb +0 -72
- data/spec/features/catalog_spec.rb +0 -57
- data/spec/features/confirm_email_spec.rb +0 -21
- data/spec/features/create_exhibit_spec.rb +0 -65
- data/spec/features/create_page_spec.rb +0 -21
- data/spec/features/dashboard_spec.rb +0 -34
- data/spec/features/edit_contact_spec.rb +0 -21
- data/spec/features/edit_search_fields_spec.rb +0 -79
- data/spec/features/exhibit_masthead_spec.rb +0 -112
- data/spec/features/exhibit_themes_spec.rb +0 -30
- data/spec/features/exhibits/add_tags_spec.rb +0 -35
- data/spec/features/exhibits/administration_spec.rb +0 -141
- data/spec/features/exhibits/custom_metadata_fields_spec.rb +0 -97
- data/spec/features/exhibits/custom_search_fields_spec.rb +0 -55
- data/spec/features/exhibits/edit_metadata_fields_spec.rb +0 -49
- data/spec/features/exhibits/language_create_edit_spec.rb +0 -59
- data/spec/features/exhibits/translation_editing_spec.rb +0 -463
- data/spec/features/exhibits_index_spec.rb +0 -55
- data/spec/features/feature_page_spec.rb +0 -155
- data/spec/features/home_page_spec.rb +0 -102
- data/spec/features/import_exhibit_spec.rb +0 -58
- data/spec/features/item_admin_spec.rb +0 -59
- data/spec/features/javascript/about_page_admin_spec.rb +0 -21
- data/spec/features/javascript/block_controls_spec.rb +0 -42
- data/spec/features/javascript/blocks/browse_group_categories_block_spec.rb +0 -64
- data/spec/features/javascript/blocks/featured_browse_categories_block_spec.rb +0 -46
- data/spec/features/javascript/blocks/featured_pages_block_spec.rb +0 -61
- data/spec/features/javascript/blocks/link_to_search_block_spec.rb +0 -46
- data/spec/features/javascript/blocks/rule_block_spec.rb +0 -23
- data/spec/features/javascript/blocks/search_result_block_spec.rb +0 -47
- data/spec/features/javascript/blocks/solr_documents_block_spec.rb +0 -232
- data/spec/features/javascript/blocks/solr_documents_carousel_block_spec.rb +0 -29
- data/spec/features/javascript/blocks/uploaded_items_block_spec.rb +0 -94
- data/spec/features/javascript/browse_group_admin_spec.rb +0 -45
- data/spec/features/javascript/edit_in_place_spec.rb +0 -93
- data/spec/features/javascript/feature_page_admin_spec.rb +0 -140
- data/spec/features/javascript/home_page_edit_spec.rb +0 -34
- data/spec/features/javascript/locale_selector_spec.rb +0 -66
- data/spec/features/javascript/metadata_admin_spec.rb +0 -41
- data/spec/features/javascript/multi_image_select_spec.rb +0 -50
- data/spec/features/javascript/reindex_monitor_spec.rb +0 -23
- data/spec/features/javascript/roles_admin_spec.rb +0 -38
- data/spec/features/javascript/search_config_admin_spec.rb +0 -140
- data/spec/features/javascript/search_context_spec.rb +0 -88
- data/spec/features/main_navigation_spec.rb +0 -96
- data/spec/features/metadata_admin_spec.rb +0 -18
- data/spec/features/report_a_problem_spec.rb +0 -62
- data/spec/features/site_masthead_spec.rb +0 -91
- data/spec/features/site_users_management_spec.rb +0 -74
- data/spec/features/slideshow_spec.rb +0 -21
- data/spec/features/translation_scope_spec.rb +0 -27
- data/spec/fixtures/800x600.png +0 -0
- data/spec/fixtures/avatar.png +0 -0
- data/spec/fixtures/bulk-update-template.csv +0 -57
- data/spec/fixtures/csv-upload-fixture.csv +0 -4
- data/spec/fixtures/gk446cj2442-manifest.json +0 -58
- data/spec/fixtures/iiif_responses.rb +0 -312
- data/spec/fixtures/json-upload-fixture.json +0 -3
- data/spec/fixtures/sample_solr_documents.yml +0 -9385
- data/spec/fixtures/updated-bulk-update-template-no-cols.csv +0 -4
- data/spec/fixtures/updated-bulk-update-template-w-tags.csv +0 -4
- data/spec/fixtures/updated-bulk-update-template.csv +0 -4
- data/spec/helpers/spotlight/application_helper_spec.rb +0 -196
- data/spec/helpers/spotlight/browse_helper_spec.rb +0 -13
- data/spec/helpers/spotlight/crop_helper_spec.rb +0 -11
- data/spec/helpers/spotlight/crud_link_helpers_spec.rb +0 -163
- data/spec/helpers/spotlight/languages_helper_spec.rb +0 -79
- data/spec/helpers/spotlight/main_app_helpers_spec.rb +0 -101
- data/spec/helpers/spotlight/masthead_helper_spec.rb +0 -51
- data/spec/helpers/spotlight/meta_helper_spec.rb +0 -33
- data/spec/helpers/spotlight/navbar_helper_spec.rb +0 -24
- data/spec/helpers/spotlight/pages_helper_spec.rb +0 -123
- data/spec/helpers/spotlight/roles_helper_spec.rb +0 -7
- data/spec/helpers/spotlight/search_configurations_helper_spec.rb +0 -23
- data/spec/helpers/spotlight/title_helper_spec.rb +0 -64
- data/spec/helpers/spotlight/translations_helper_spec.rb +0 -16
- data/spec/i18n_spec.rb +0 -27
- data/spec/jobs/spotlight/add_tags_job_spec.rb +0 -34
- data/spec/jobs/spotlight/add_uploads_from_csv_spec.rb +0 -58
- data/spec/jobs/spotlight/change_visibility_job_spec.rb +0 -30
- data/spec/jobs/spotlight/default_thumbnail_job_spec.rb +0 -14
- data/spec/jobs/spotlight/process_bulk_updates_csv_job_spec.rb +0 -86
- data/spec/jobs/spotlight/reindex_exhibit_job_spec.rb +0 -43
- data/spec/jobs/spotlight/reindex_job_spec.rb +0 -79
- data/spec/jobs/spotlight/remove_tags_job_spec.rb +0 -39
- data/spec/jobs/spotlight/rename_sidecar_field_job_spec.rb +0 -33
- data/spec/lib/migration/iiif_spec.rb +0 -91
- data/spec/lib/migration/page_language_spec.rb +0 -25
- data/spec/lib/spotlight/catalog_spec.rb +0 -0
- data/spec/lib/spotlight/controller_spec.rb +0 -102
- data/spec/lib/spotlight/upload_field_config_spec.rb +0 -40
- data/spec/mailers/spotlight/indexing_complete_mailer_spec.rb +0 -42
- data/spec/models/sir_trevor_rails/block_spec.rb +0 -72
- data/spec/models/sir_trevor_rails/blocks/browse_block_spec.rb +0 -42
- data/spec/models/sir_trevor_rails/blocks/browse_group_categories_block_spec.rb +0 -41
- data/spec/models/sir_trevor_rails/blocks/featured_pages_block_spec.rb +0 -50
- data/spec/models/sir_trevor_rails/blocks/search_results_block_spec.rb +0 -23
- data/spec/models/sir_trevor_rails/blocks/solr_documents_block_spec.rb +0 -59
- data/spec/models/sir_trevor_rails/blocks/textable_spec.rb +0 -42
- data/spec/models/solr_document_spec.rb +0 -214
- data/spec/models/spotlight/ability_spec.rb +0 -118
- data/spec/models/spotlight/about_page_spec.rb +0 -19
- data/spec/models/spotlight/access_controls_enforcement_search_builder_spec.rb +0 -82
- data/spec/models/spotlight/analytics/ga_spec.rb +0 -22
- data/spec/models/spotlight/background_job_progress_spec.rb +0 -137
- data/spec/models/spotlight/blacklight_configuration_spec.rb +0 -649
- data/spec/models/spotlight/browse_category_search_builder_spec.rb +0 -51
- data/spec/models/spotlight/contact_email_spec.rb +0 -48
- data/spec/models/spotlight/contact_form_spec.rb +0 -94
- data/spec/models/spotlight/contact_image_spec.rb +0 -11
- data/spec/models/spotlight/contact_spec.rb +0 -38
- data/spec/models/spotlight/custom_field_spec.rb +0 -204
- data/spec/models/spotlight/custom_search_field_spec.rb +0 -56
- data/spec/models/spotlight/custom_translation_extension_spec.rb +0 -24
- data/spec/models/spotlight/exhibit_spec.rb +0 -383
- data/spec/models/spotlight/exhibit_thumbnail_spec.rb +0 -10
- data/spec/models/spotlight/feature_page_spec.rb +0 -87
- data/spec/models/spotlight/featured_image_spec.rb +0 -110
- data/spec/models/spotlight/field_metadata_spec.rb +0 -58
- data/spec/models/spotlight/filter_spec.rb +0 -19
- data/spec/models/spotlight/group_spec.rb +0 -19
- data/spec/models/spotlight/home_page_spec.rb +0 -38
- data/spec/models/spotlight/language_spec.rb +0 -42
- data/spec/models/spotlight/main_navigation_spec.rb +0 -19
- data/spec/models/spotlight/masthead_spec.rb +0 -45
- data/spec/models/spotlight/page_configurations_spec.rb +0 -45
- data/spec/models/spotlight/page_spec.rb +0 -293
- data/spec/models/spotlight/resource_spec.rb +0 -137
- data/spec/models/spotlight/resources/iiif_harvester_spec.rb +0 -52
- data/spec/models/spotlight/resources/iiif_manifest_spec.rb +0 -178
- data/spec/models/spotlight/resources/iiif_service_spec.rb +0 -57
- data/spec/models/spotlight/resources/upload_spec.rb +0 -71
- data/spec/models/spotlight/resources/web_spec.rb +0 -25
- data/spec/models/spotlight/role_spec.rb +0 -51
- data/spec/models/spotlight/search_spec.rb +0 -125
- data/spec/models/spotlight/site_spec.rb +0 -9
- data/spec/models/spotlight/sitemap_spec.rb +0 -113
- data/spec/models/spotlight/solr_document/atomic_updates_spec.rb +0 -56
- data/spec/models/spotlight/solr_document/uploaded_resource_spec.rb +0 -38
- data/spec/models/spotlight/solr_document_sidecar_spec.rb +0 -48
- data/spec/models/spotlight/user_spec.rb +0 -26
- data/spec/models/translation_spec.rb +0 -26
- data/spec/presenters/spotlight/iiif_manifest_presenter_spec.rb +0 -132
- data/spec/routing/spotlight/exhibit_catalog_spec.rb +0 -34
- data/spec/routing/spotlight/featured_images_spec.rb +0 -23
- data/spec/routing/spotlight/pages_routing_spec.rb +0 -42
- data/spec/services/spotlight/bulk_updates_csv_template_service_spec.rb +0 -26
- data/spec/services/spotlight/carrierwave_file_resolver_spec.rb +0 -16
- data/spec/services/spotlight/clone_translated_page_from_locale_spec.rb +0 -30
- data/spec/services/spotlight/etl/context_spec.rb +0 -66
- data/spec/services/spotlight/etl/executor_spec.rb +0 -149
- data/spec/services/spotlight/etl/pipeline_spec.rb +0 -22
- data/spec/services/spotlight/etl/solr_loader_spec.rb +0 -76
- data/spec/services/spotlight/etl/step_spec.rb +0 -70
- data/spec/services/spotlight/exhibit_import_export_service_spec.rb +0 -569
- data/spec/services/spotlight/iiif_resource_resolver_spec.rb +0 -94
- data/spec/services/spotlight/invite_users_service_spec.rb +0 -47
- data/spec/spec_helper.rb +0 -146
- data/spec/support/controllers/engine_helpers.rb +0 -9
- data/spec/support/disable_friendly_id_deprecation_warnings.rb +0 -11
- data/spec/support/features/capybara_default_max_wait_metadata_helper.rb +0 -20
- data/spec/support/features/test_features_helpers.rb +0 -92
- data/spec/support/helpers/controller_level_helpers.rb +0 -25
- data/spec/support/stub_iiif_response.rb +0 -26
- data/spec/support/views/test_view_helpers.rb +0 -21
- data/spec/test_app_templates/Gemfile.extra +0 -2
- data/spec/test_app_templates/carrierwave.rb +0 -8
- data/spec/test_app_templates/catalog_controller.rb +0 -108
- data/spec/test_app_templates/fixture.css +0 -0
- data/spec/test_app_templates/fixture.png +0 -0
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +0 -71
- data/spec/test_app_templates/spotlight_test.rake +0 -14
- data/spec/uploaders/spotlight/attachment_uploader_spec.rb +0 -27
- data/spec/uploaders/spotlight/featured_image_uploader_spec.rb +0 -33
- data/spec/views/shared/_analytics.html.erb_spec.rb +0 -17
- data/spec/views/shared/_exhibit_navbar.html.erb_spec.rb +0 -127
- data/spec/views/shared/_header_navbar.html.erb_spec.rb +0 -12
- data/spec/views/shared/_masthead.html.erb_spec.rb +0 -91
- data/spec/views/shared/_user_util_links.html.erb_spec.rb +0 -102
- data/spec/views/spotlight/about_pages/_empty.html.erb_spec.rb +0 -28
- data/spec/views/spotlight/about_pages/_sidebar.html.erb_spec.rb +0 -24
- data/spec/views/spotlight/about_pages/index.html.erb_spec.rb +0 -69
- data/spec/views/spotlight/browse/_search.html.erb_spec.rb +0 -30
- data/spec/views/spotlight/browse/index.html.erb_spec.rb +0 -22
- data/spec/views/spotlight/browse/show.html.erb_spec.rb +0 -65
- data/spec/views/spotlight/catalog/_edit_default.html.erb_spec.rb +0 -63
- data/spec/views/spotlight/catalog/admin.html.erb_spec.rb +0 -39
- data/spec/views/spotlight/catalog/edit.html.erb_spec.rb +0 -20
- data/spec/views/spotlight/contacts/edit.html.erb_spec.rb +0 -43
- data/spec/views/spotlight/dashboards/_analytics.html.erb_spec.rb +0 -45
- data/spec/views/spotlight/dashboards/_reindexing_activity.html.erb_spec.rb +0 -94
- data/spec/views/spotlight/dashboards/analytics.html.erb_spec.rb +0 -33
- data/spec/views/spotlight/exhibits/_exhibit_card.html.erb_spec.rb +0 -46
- data/spec/views/spotlight/exhibits/_form.html.erb_spec.rb +0 -38
- data/spec/views/spotlight/exhibits/edit.html.erb_spec.rb +0 -29
- data/spec/views/spotlight/exhibits/index.html.erb_spec.rb +0 -140
- data/spec/views/spotlight/feature_pages/_empty.html.erb_spec.rb +0 -28
- data/spec/views/spotlight/feature_pages/_sidebar.html.erb_spec.rb +0 -45
- data/spec/views/spotlight/featured_images/_form.html.erb_spec.rb +0 -32
- data/spec/views/spotlight/featured_images/_upload_form.html.erb_spec.rb +0 -32
- data/spec/views/spotlight/home_pages/_empty.html.erb_spec.rb +0 -28
- data/spec/views/spotlight/home_pages/_sidebar.html.erb_spec.rb +0 -12
- data/spec/views/spotlight/job_trackers/show.html.erb_spec.rb +0 -65
- data/spec/views/spotlight/metadata_configurations/_metadata_field.html.erb_spec.rb +0 -30
- data/spec/views/spotlight/metadata_configurations/edit.html.erb_spec.rb +0 -23
- data/spec/views/spotlight/pages/_form.html.erb_spec.rb +0 -20
- data/spec/views/spotlight/pages/edit.html.erb_spec.rb +0 -68
- data/spec/views/spotlight/pages/index.html.erb_spec.rb +0 -42
- data/spec/views/spotlight/pages/new.html.erb_spec.rb +0 -21
- data/spec/views/spotlight/pages/show.html.erb_spec.rb +0 -84
- data/spec/views/spotlight/resources/_external_resources_form.html.erb_spec.rb +0 -36
- data/spec/views/spotlight/resources/new.html.erb_spec.rb +0 -30
- data/spec/views/spotlight/roles/index.html.erb_spec.rb +0 -30
- data/spec/views/spotlight/search_configurations/_facet_metadata.html.erb_spec.rb +0 -58
- data/spec/views/spotlight/search_configurations/_facets.html.erb_spec.rb +0 -54
- data/spec/views/spotlight/search_configurations/_search_fields.html.erb_spec.rb +0 -54
- data/spec/views/spotlight/search_configurations/_sort.html.erb_spec.rb +0 -40
- data/spec/views/spotlight/searches/_search.html.erb_spec.rb +0 -37
- data/spec/views/spotlight/searches/edit.html.erb_spec.rb +0 -40
- data/spec/views/spotlight/searches/index.html.erb_spec.rb +0 -33
- data/spec/views/spotlight/sir_trevor/blocks/_browse_block.html.erb_spec.rb +0 -20
- data/spec/views/spotlight/sir_trevor/blocks/_iframe_block.html.erb_spec.rb +0 -20
- data/spec/views/spotlight/sir_trevor/blocks/_link_to_search_block.html.erb_spec.rb +0 -20
- data/spec/views/spotlight/sir_trevor/blocks/_rule_block.html.erb_spec.rb +0 -10
- data/spec/views/spotlight/sir_trevor/blocks/_solr_documents_block.html.erb_spec.rb +0 -43
- data/spec/views/spotlight/sir_trevor/blocks/_solr_documents_carousel_block.html.erb_spec.rb +0 -34
- data/spec/views/spotlight/sir_trevor/blocks/_solr_documents_embed_block.html.erb_spec.rb +0 -53
- data/spec/views/spotlight/sir_trevor/blocks/_solr_documents_features_block.html.erb_spec.rb +0 -54
- data/spec/views/spotlight/sir_trevor/blocks/_solr_documents_grid_block.html.erb_spec.rb +0 -42
- data/spec/views/spotlight/sites/edit_exhibits.html.erb_spec.rb +0 -25
- data/spec/views/spotlight/tags/index.html.erb_spec.rb +0 -27
- data/spec/views/spotlight/translations/_import.html.erb_spec.rb +0 -24
- data/spec/views/spotlight/translations/_page.html.erb_spec.rb +0 -76
@@ -1,38 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe Spotlight::ContactFormsController, type: :controller do
|
4
|
-
routes { Spotlight::Engine.routes }
|
5
|
-
let(:exhibit) { FactoryBot.create(:exhibit) }
|
6
|
-
let(:honeypot_field_name) { Spotlight::Engine.config.spambot_honeypot_email_field }
|
7
|
-
|
8
|
-
before do
|
9
|
-
request.env['HTTP_REFERER'] = '/whatever'
|
10
|
-
exhibit.contact_emails_attributes = [{ 'email' => 'test@example.com' }, { 'email' => 'test2@example.com' }]
|
11
|
-
exhibit.save!
|
12
|
-
exhibit.contact_emails.first.tap do |e|
|
13
|
-
if e.respond_to? :confirm
|
14
|
-
e.confirm
|
15
|
-
else
|
16
|
-
e.confirm!
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
describe 'POST create' do
|
22
|
-
it 'sends an email' do
|
23
|
-
expect do
|
24
|
-
post :create, params: { exhibit_id: exhibit.id, contact_form: { name: 'Joe Doe', email: 'jdoe@example.com', honeypot_field_name => '' } }
|
25
|
-
end.to change { ActionMailer::Base.deliveries.count }.by(1)
|
26
|
-
end
|
27
|
-
|
28
|
-
it 'redirects back' do
|
29
|
-
post :create, params: { exhibit_id: exhibit.id, contact_form: { name: 'Joe Doe', email: 'jdoe@example.com', honeypot_field_name => '' } }
|
30
|
-
expect(response).to redirect_to end_with('/whatever')
|
31
|
-
end
|
32
|
-
|
33
|
-
it 'sets a flash message' do
|
34
|
-
post :create, params: { exhibit_id: exhibit.id, contact_form: { name: 'Joe Doe', email: 'jdoe@example.com', honeypot_field_name => '' } }
|
35
|
-
expect(flash[:notice]).to eq 'Thanks. Your feedback has been sent.'
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
@@ -1,103 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe Spotlight::ContactsController, type: :controller do
|
4
|
-
routes { Spotlight::Engine.routes }
|
5
|
-
describe 'when not logged in' do
|
6
|
-
describe 'GET edit' do
|
7
|
-
let(:contact) { FactoryBot.create(:contact) }
|
8
|
-
|
9
|
-
it 'is successful' do
|
10
|
-
get :edit, params: { id: contact, exhibit_id: contact.exhibit }
|
11
|
-
expect(response).to redirect_to main_app.new_user_session_path
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
describe 'when signed in as a curator' do
|
17
|
-
let(:user) { FactoryBot.create(:exhibit_curator, exhibit: exhibit) }
|
18
|
-
let(:exhibit) { FactoryBot.create(:exhibit) }
|
19
|
-
let(:contact) { FactoryBot.create(:contact, exhibit: exhibit, name: 'Andrew Carnegie') }
|
20
|
-
|
21
|
-
before { sign_in user }
|
22
|
-
|
23
|
-
describe 'GET edit' do
|
24
|
-
it 'is successful' do
|
25
|
-
expect(controller).to receive(:add_breadcrumb).with('Home', exhibit)
|
26
|
-
expect(controller).to receive(:add_breadcrumb).with('Curation', exhibit_dashboard_path(exhibit))
|
27
|
-
expect(controller).to receive(:add_breadcrumb).with('About pages', exhibit_about_pages_path(exhibit))
|
28
|
-
expect(controller).to receive(:add_breadcrumb).with(contact.name, edit_exhibit_contact_path(exhibit, contact))
|
29
|
-
get :edit, params: { id: contact, exhibit_id: contact.exhibit }
|
30
|
-
expect(response).to be_successful
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
describe 'PATCH update' do
|
35
|
-
it 'is successful' do
|
36
|
-
patch :update, params: { id: contact, contact: { name: 'Chester' }, exhibit_id: contact.exhibit }
|
37
|
-
expect(response).to redirect_to exhibit_about_pages_path(exhibit)
|
38
|
-
expect(contact.reload.name).to eq 'Chester'
|
39
|
-
end
|
40
|
-
|
41
|
-
it 'allows thumbnails to be updated' do
|
42
|
-
contact = FactoryBot.create(:contact, exhibit: exhibit, name: 'Andrew Carnegie')
|
43
|
-
patch :update, params: {
|
44
|
-
id: contact,
|
45
|
-
contact: {
|
46
|
-
avatar_attributes: {
|
47
|
-
iiif_tilesource: 'https://example.com/iiif',
|
48
|
-
iiif_region: '0,0,200,200'
|
49
|
-
}
|
50
|
-
},
|
51
|
-
exhibit_id: contact.exhibit
|
52
|
-
}
|
53
|
-
|
54
|
-
expect(response).to redirect_to exhibit_about_pages_path(exhibit)
|
55
|
-
expect(contact.reload.avatar.iiif_url).to eq 'https://example.com/iiif/0,0,200,200/70,70/0/default.jpg'
|
56
|
-
end
|
57
|
-
|
58
|
-
it 'fails by rendering edit' do
|
59
|
-
expect_any_instance_of(Spotlight::Contact).to receive(:update).and_return(false)
|
60
|
-
patch :update, params: { id: contact, contact: { name: 'Chester' }, exhibit_id: contact.exhibit }
|
61
|
-
expect(response).to render_template 'edit'
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
describe 'DELETE destroy' do
|
66
|
-
it 'is successful' do
|
67
|
-
contact # force contact to be created
|
68
|
-
expect do
|
69
|
-
delete :destroy, params: { id: contact, exhibit_id: contact.exhibit }
|
70
|
-
end.to change(Spotlight::Contact, :count).by(-1)
|
71
|
-
expect(response).to redirect_to exhibit_about_pages_path(exhibit)
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
describe 'GET new' do
|
76
|
-
it 'is successful' do
|
77
|
-
expect(controller).to receive(:add_breadcrumb).with('Home', exhibit)
|
78
|
-
expect(controller).to receive(:add_breadcrumb).with('Curation', exhibit_dashboard_path(exhibit))
|
79
|
-
expect(controller).to receive(:add_breadcrumb).with('About pages', exhibit_about_pages_path(exhibit))
|
80
|
-
expect(controller).to receive(:add_breadcrumb).with('Add contact', new_exhibit_contact_path(exhibit))
|
81
|
-
get :new, params: { exhibit_id: exhibit }
|
82
|
-
expect(response).to be_successful
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
describe 'POST create' do
|
87
|
-
it 'fails by rendering new' do
|
88
|
-
expect_any_instance_of(Spotlight::Contact).to receive(:update).and_return(false)
|
89
|
-
post :create, params: { exhibit_id: exhibit, contact: { name: 'Chester' } }
|
90
|
-
expect(response).to render_template 'new'
|
91
|
-
end
|
92
|
-
|
93
|
-
it 'is successful' do
|
94
|
-
expect do
|
95
|
-
post :create, params: { exhibit_id: exhibit, contact: { name: 'Chester', avatar_attributes: { iiif_tilesource: 'someurl' } } }
|
96
|
-
end.to change(Spotlight::Contact, :count).by(1)
|
97
|
-
expect(response).to redirect_to exhibit_about_pages_path(exhibit)
|
98
|
-
expect(Spotlight::Contact.last.show_in_sidebar).to be_truthy
|
99
|
-
expect(Spotlight::Contact.last.avatar.iiif_url).to be_present
|
100
|
-
end
|
101
|
-
end
|
102
|
-
end
|
103
|
-
end
|
@@ -1,62 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe Spotlight::CustomFieldsController, type: :controller do
|
4
|
-
routes { Spotlight::Engine.routes }
|
5
|
-
let(:exhibit) { FactoryBot.create(:exhibit) }
|
6
|
-
|
7
|
-
describe 'when signed in as an exhibit admin' do
|
8
|
-
let(:user) { FactoryBot.create(:exhibit_admin, exhibit: exhibit) }
|
9
|
-
|
10
|
-
before { sign_in user }
|
11
|
-
|
12
|
-
describe 'GET new' do
|
13
|
-
it 'assigns a new custom field' do
|
14
|
-
expect(controller).to receive(:add_breadcrumb).with('Home', exhibit)
|
15
|
-
expect(controller).to receive(:add_breadcrumb).with('Configuration', exhibit_dashboard_path(exhibit))
|
16
|
-
expect(controller).to receive(:add_breadcrumb).with('Metadata', edit_exhibit_metadata_configuration_path(exhibit))
|
17
|
-
expect(controller).to receive(:add_breadcrumb).with('Add new field', new_exhibit_custom_field_path(exhibit))
|
18
|
-
get :new, params: { exhibit_id: exhibit }
|
19
|
-
expect(assigns(:custom_field)).to be_a_new(Spotlight::CustomField)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
describe 'GET edit' do
|
24
|
-
let(:field) { FactoryBot.create(:custom_field, exhibit: exhibit) }
|
25
|
-
|
26
|
-
it 'assigns the requested custom_field' do
|
27
|
-
expect(controller).to receive(:add_breadcrumb).with('Home', exhibit)
|
28
|
-
expect(controller).to receive(:add_breadcrumb).with('Configuration', exhibit_dashboard_path(exhibit))
|
29
|
-
expect(controller).to receive(:add_breadcrumb).with('Metadata', edit_exhibit_metadata_configuration_path(exhibit))
|
30
|
-
expect(controller).to receive(:add_breadcrumb).with(field.label, edit_exhibit_custom_field_path(exhibit, field))
|
31
|
-
get :edit, params: { exhibit_id: exhibit, id: field }
|
32
|
-
expect(assigns(:custom_field)).to eq field
|
33
|
-
expect(assigns(:exhibit)).to eq exhibit
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
describe 'POST create' do
|
38
|
-
describe 'with valid params' do
|
39
|
-
it 'creates a new Page' do
|
40
|
-
expect do
|
41
|
-
post :create, params: { custom_field: { label: 'MyString' }, exhibit_id: exhibit }
|
42
|
-
end.to change(Spotlight::CustomField, :count).by(1)
|
43
|
-
end
|
44
|
-
|
45
|
-
it 'redirects to the exhibit metadata page' do
|
46
|
-
post :create, params: { custom_field: { label: 'MyString' }, exhibit_id: exhibit }
|
47
|
-
expect(response).to redirect_to(edit_exhibit_metadata_configuration_path(exhibit))
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
describe 'with invalid params' do
|
52
|
-
it "re-renders the 'new' template" do
|
53
|
-
# Trigger the behavior that occurs when invalid params are submitted
|
54
|
-
allow_any_instance_of(Spotlight::CustomField).to receive(:save).and_return(false)
|
55
|
-
post :create, params: { custom_field: { label: 'MyString' }, exhibit_id: exhibit }
|
56
|
-
expect(assigns(:custom_field)).to be_a_new(Spotlight::CustomField)
|
57
|
-
expect(response).to render_template('new')
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
@@ -1,62 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe Spotlight::CustomSearchFieldsController, type: :controller do
|
4
|
-
routes { Spotlight::Engine.routes }
|
5
|
-
let(:exhibit) { FactoryBot.create(:exhibit) }
|
6
|
-
|
7
|
-
describe 'when signed in as an exhibit admin' do
|
8
|
-
let(:user) { FactoryBot.create(:exhibit_admin, exhibit: exhibit) }
|
9
|
-
|
10
|
-
before { sign_in user }
|
11
|
-
|
12
|
-
describe 'GET new' do
|
13
|
-
it 'assigns a new custom field' do
|
14
|
-
expect(controller).to receive(:add_breadcrumb).with('Home', exhibit)
|
15
|
-
expect(controller).to receive(:add_breadcrumb).with('Configuration', exhibit_dashboard_path(exhibit))
|
16
|
-
expect(controller).to receive(:add_breadcrumb).with('Search', edit_exhibit_search_configuration_path(exhibit))
|
17
|
-
expect(controller).to receive(:add_breadcrumb).with('Add new field', new_exhibit_custom_search_field_path(exhibit))
|
18
|
-
get :new, params: { exhibit_id: exhibit }
|
19
|
-
expect(assigns(:custom_search_field)).to be_a_new(Spotlight::CustomSearchField)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
describe 'GET edit' do
|
24
|
-
let(:field) { FactoryBot.create(:custom_search_field, exhibit: exhibit) }
|
25
|
-
|
26
|
-
it 'assigns the requested custom_field' do
|
27
|
-
expect(controller).to receive(:add_breadcrumb).with('Home', exhibit)
|
28
|
-
expect(controller).to receive(:add_breadcrumb).with('Configuration', exhibit_dashboard_path(exhibit))
|
29
|
-
expect(controller).to receive(:add_breadcrumb).with('Search', edit_exhibit_search_configuration_path(exhibit))
|
30
|
-
expect(controller).to receive(:add_breadcrumb).with(field.label, edit_exhibit_custom_search_field_path(exhibit, field))
|
31
|
-
get :edit, params: { exhibit_id: exhibit, id: field }
|
32
|
-
expect(assigns(:custom_search_field)).to eq field
|
33
|
-
expect(assigns(:exhibit)).to eq exhibit
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
describe 'POST create' do
|
38
|
-
describe 'with valid params' do
|
39
|
-
it 'creates a new Page' do
|
40
|
-
expect do
|
41
|
-
post :create, params: { custom_search_field: { label: 'MyString' }, exhibit_id: exhibit }
|
42
|
-
end.to change(Spotlight::CustomSearchField, :count).by(1)
|
43
|
-
end
|
44
|
-
|
45
|
-
it 'redirects to the exhibit metadata page' do
|
46
|
-
post :create, params: { custom_search_field: { label: 'MyString' }, exhibit_id: exhibit }
|
47
|
-
expect(response).to redirect_to(edit_exhibit_search_configuration_path(exhibit))
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
describe 'with invalid params' do
|
52
|
-
it "re-renders the 'new' template" do
|
53
|
-
# Trigger the behavior that occurs when invalid params are submitted
|
54
|
-
allow_any_instance_of(Spotlight::CustomSearchField).to receive(:save).and_return(false)
|
55
|
-
post :create, params: { custom_search_field: { label: 'MyString' }, exhibit_id: exhibit }
|
56
|
-
expect(assigns(:custom_search_field)).to be_a_new(Spotlight::CustomSearchField)
|
57
|
-
expect(response).to render_template('new')
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
@@ -1,68 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe Spotlight::DashboardsController, type: :controller do
|
4
|
-
routes { Spotlight::Engine.routes }
|
5
|
-
let(:exhibit) { FactoryBot.create(:exhibit) }
|
6
|
-
let(:repository) { double }
|
7
|
-
|
8
|
-
before do
|
9
|
-
allow(controller).to receive(:repository).and_return(repository)
|
10
|
-
end
|
11
|
-
|
12
|
-
describe 'when logged in' do
|
13
|
-
let(:curator) { FactoryBot.create(:exhibit_curator, exhibit: exhibit) }
|
14
|
-
|
15
|
-
before { sign_in curator }
|
16
|
-
|
17
|
-
describe 'GET show' do
|
18
|
-
it 'loads the exhibit' do
|
19
|
-
exhibit.blacklight_configuration.index = { timestamp_field: 'timestamp_field' }
|
20
|
-
exhibit.save!
|
21
|
-
# TODO: restore test for: .with(sort: 'timestamp_field desc')
|
22
|
-
expect(controller).to receive(:search_service).and_return(double(search_results: [double(:response), [{ id: 1 }]]))
|
23
|
-
expect(controller).to receive(:add_breadcrumb).with('Home', exhibit)
|
24
|
-
expect(controller).to receive(:add_breadcrumb).with('Dashboard', exhibit_dashboard_path(exhibit))
|
25
|
-
get :show, params: { exhibit_id: exhibit.id }
|
26
|
-
expect(response).to render_template 'spotlight/dashboards/show'
|
27
|
-
expect(assigns[:exhibit]).to eq exhibit
|
28
|
-
expect(assigns[:pages].length).to eq exhibit.pages.length
|
29
|
-
expect(assigns[:solr_documents]).to have(1).item
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
describe 'GET analytics' do
|
34
|
-
it 'loads the exhibit' do
|
35
|
-
expect(controller).to receive(:add_breadcrumb).with('Home', exhibit)
|
36
|
-
expect(controller).to receive(:add_breadcrumb).with('Analytics', analytics_exhibit_dashboard_path(exhibit))
|
37
|
-
get :analytics, params: { exhibit_id: exhibit.id }
|
38
|
-
expect(response).to render_template 'spotlight/dashboards/analytics'
|
39
|
-
expect(assigns[:exhibit]).to eq exhibit
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
describe 'when user does not have access' do
|
45
|
-
before { sign_in FactoryBot.create(:exhibit_visitor) }
|
46
|
-
|
47
|
-
it 'does not allow show' do
|
48
|
-
get :show, params: { exhibit_id: exhibit.id }
|
49
|
-
expect(response).to redirect_to main_app.root_path
|
50
|
-
end
|
51
|
-
|
52
|
-
it 'does not allow analytics' do
|
53
|
-
get :analytics, params: { exhibit_id: exhibit.id }
|
54
|
-
expect(response).to redirect_to main_app.root_path
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
describe 'when not logged in' do
|
59
|
-
describe 'GET show' do
|
60
|
-
it 'redirects to the sign in form' do
|
61
|
-
get :show, params: { exhibit_id: exhibit.id }
|
62
|
-
expect(response).to redirect_to(main_app.new_user_session_path)
|
63
|
-
expect(flash[:alert]).to be_present
|
64
|
-
expect(flash[:alert]).to match(/You need to sign in/)
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
@@ -1,216 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'rack/test'
|
4
|
-
|
5
|
-
describe Spotlight::ExhibitsController, type: :controller do
|
6
|
-
routes { Spotlight::Engine.routes }
|
7
|
-
let(:exhibit) { FactoryBot.create(:exhibit) }
|
8
|
-
|
9
|
-
before do
|
10
|
-
allow(Spotlight::DefaultThumbnailJob).to receive(:perform_later)
|
11
|
-
end
|
12
|
-
|
13
|
-
describe 'when the user is not authorized' do
|
14
|
-
before do
|
15
|
-
sign_in FactoryBot.create(:exhibit_visitor)
|
16
|
-
end
|
17
|
-
|
18
|
-
describe 'GET edit' do
|
19
|
-
it 'denies access' do
|
20
|
-
get :edit, params: { id: exhibit }
|
21
|
-
expect(response).to redirect_to main_app.root_path
|
22
|
-
expect(flash[:alert]).to be_present
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
describe 'when not logged in' do
|
28
|
-
describe 'GET index' do
|
29
|
-
context 'where there are no exhibits' do
|
30
|
-
it 'is allowed' do
|
31
|
-
get :index
|
32
|
-
expect(response).to be_successful
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
context 'when there is one exhibit' do
|
37
|
-
let!(:exhibit) do
|
38
|
-
FactoryBot.create(:exhibit)
|
39
|
-
end
|
40
|
-
|
41
|
-
before do
|
42
|
-
allow(controller).to receive(:redirect_to)
|
43
|
-
end
|
44
|
-
|
45
|
-
it 'is allowed' do
|
46
|
-
get :index
|
47
|
-
expect(controller).to have_received(:redirect_to).with(exhibit, flash: {})
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
describe 'GET new' do
|
53
|
-
it 'is not allowed' do
|
54
|
-
get :new, params: { id: exhibit }
|
55
|
-
expect(response).to redirect_to main_app.new_user_session_path
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
describe 'GET edit' do
|
60
|
-
it 'is not allowed' do
|
61
|
-
get :edit, params: { id: exhibit }
|
62
|
-
expect(response).to redirect_to main_app.new_user_session_path
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
describe 'PATCH update' do
|
67
|
-
it 'is not allowed' do
|
68
|
-
patch :update, params: { id: exhibit }
|
69
|
-
expect(response).to redirect_to main_app.new_user_session_path
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
describe 'PATCH process_import' do
|
74
|
-
it 'is not allowed' do
|
75
|
-
patch :process_import, params: { id: exhibit }
|
76
|
-
expect(response).to redirect_to main_app.new_user_session_path
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
describe 'DELETE destroy' do
|
81
|
-
it 'is not allowed' do
|
82
|
-
delete :destroy, params: { id: exhibit }
|
83
|
-
expect(response).to redirect_to main_app.new_user_session_path
|
84
|
-
end
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
describe 'when signed in as a site admin' do
|
89
|
-
let(:user) { FactoryBot.create(:site_admin) }
|
90
|
-
|
91
|
-
before { sign_in user }
|
92
|
-
|
93
|
-
describe 'GET new' do
|
94
|
-
it 'is successful' do
|
95
|
-
get :new
|
96
|
-
expect(response).to be_successful
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
describe 'POST create' do
|
101
|
-
before do
|
102
|
-
# decouple this test from needing solr running
|
103
|
-
allow_any_instance_of(Spotlight::Search).to receive(:set_default_featured_image)
|
104
|
-
end
|
105
|
-
|
106
|
-
it 'is successful' do
|
107
|
-
expect do
|
108
|
-
post :create, params: { exhibit: { title: 'Some Title', slug: 'custom-slug', tag_list: '2014, R. Buckminster Fuller' } }
|
109
|
-
end.to change(Spotlight::Exhibit, :count).by(1)
|
110
|
-
|
111
|
-
exhibit = Spotlight::Exhibit.last
|
112
|
-
expect(response).to redirect_to(exhibit_dashboard_path(exhibit))
|
113
|
-
|
114
|
-
expect(exhibit.title).to eq 'Some Title'
|
115
|
-
expect(exhibit.slug).to eq 'custom-slug'
|
116
|
-
expect(exhibit.tags.map(&:name)).to eq ['2014', 'R. Buckminster Fuller']
|
117
|
-
|
118
|
-
expect(user.exhibits).to include exhibit
|
119
|
-
end
|
120
|
-
end
|
121
|
-
end
|
122
|
-
|
123
|
-
describe 'when signed in as an exhibit admin' do
|
124
|
-
let(:user) { FactoryBot.create(:exhibit_admin, exhibit: exhibit) }
|
125
|
-
|
126
|
-
before { sign_in user }
|
127
|
-
|
128
|
-
describe 'GET new' do
|
129
|
-
it 'is not allowed' do
|
130
|
-
get :new
|
131
|
-
expect(response).not_to be_successful
|
132
|
-
end
|
133
|
-
end
|
134
|
-
|
135
|
-
describe 'PATCH process_import' do
|
136
|
-
it 'is successful' do
|
137
|
-
expect_any_instance_of(Spotlight::Exhibit).to receive(:reindex_later).and_return(true)
|
138
|
-
f = Tempfile.new('foo')
|
139
|
-
begin
|
140
|
-
f.write '{ "title": "Foo", "subtitle": "Bar"}'
|
141
|
-
f.rewind
|
142
|
-
file = Rack::Test::UploadedFile.new(f.path, 'application/json')
|
143
|
-
patch :process_import, params: { id: exhibit, file: file }
|
144
|
-
ensure
|
145
|
-
f.close
|
146
|
-
f.unlink
|
147
|
-
end
|
148
|
-
expect(response).to be_redirect
|
149
|
-
assigns[:exhibit].tap do |saved|
|
150
|
-
expect(saved.title).to eq 'Foo'
|
151
|
-
expect(saved.subtitle).to eq 'Bar'
|
152
|
-
end
|
153
|
-
end
|
154
|
-
end
|
155
|
-
|
156
|
-
describe 'GET edit' do
|
157
|
-
it 'is successful' do
|
158
|
-
expect(controller).to receive(:add_breadcrumb).with('Home', exhibit)
|
159
|
-
expect(controller).to receive(:add_breadcrumb).with('Configuration', exhibit_dashboard_path(exhibit))
|
160
|
-
expect(controller).to receive(:add_breadcrumb).with('General', edit_exhibit_path(exhibit))
|
161
|
-
get :edit, params: { id: exhibit }
|
162
|
-
expect(response).to be_successful
|
163
|
-
end
|
164
|
-
end
|
165
|
-
|
166
|
-
describe '#update' do
|
167
|
-
it 'is successful' do
|
168
|
-
patch :update, params: {
|
169
|
-
id: exhibit,
|
170
|
-
exhibit: {
|
171
|
-
title: 'Foo',
|
172
|
-
subtitle: 'Bar',
|
173
|
-
description: 'Baz',
|
174
|
-
contact_emails_attributes: { '0' => { email: 'bess@stanford.edu' }, '1' => { email: 'naomi@stanford.edu' } }
|
175
|
-
}
|
176
|
-
}
|
177
|
-
|
178
|
-
expect(flash[:notice]).to eq 'The exhibit was successfully updated.'
|
179
|
-
expect(response).to redirect_to edit_exhibit_path(exhibit)
|
180
|
-
assigns[:exhibit].tap do |saved|
|
181
|
-
expect(saved.title).to eq 'Foo'
|
182
|
-
expect(saved.subtitle).to eq 'Bar'
|
183
|
-
expect(saved.description).to eq 'Baz'
|
184
|
-
expect(saved.contact_emails.pluck(:email)).to eq ['bess@stanford.edu', 'naomi@stanford.edu']
|
185
|
-
end
|
186
|
-
end
|
187
|
-
|
188
|
-
it 'shows errors and ignore blank emails' do
|
189
|
-
patch :update, params: {
|
190
|
-
id: exhibit,
|
191
|
-
exhibit: {
|
192
|
-
title: 'Foo',
|
193
|
-
subtitle: 'Bar',
|
194
|
-
description: 'Baz',
|
195
|
-
contact_emails_attributes: { '0' => { email: 'bess@stanford.edu' }, '1' => { email: 'naomi@' }, '2' => { email: '' } }
|
196
|
-
}
|
197
|
-
}
|
198
|
-
|
199
|
-
expect(response).to be_successful
|
200
|
-
assigns[:exhibit].tap do |obj|
|
201
|
-
expect(obj.contact_emails.last.errors[:email]).to eq ['is not valid']
|
202
|
-
expect(obj.contact_emails.size).to eq 2
|
203
|
-
end
|
204
|
-
end
|
205
|
-
end
|
206
|
-
|
207
|
-
describe '#destroy' do
|
208
|
-
it 'is successful' do
|
209
|
-
delete :destroy, params: { id: exhibit }
|
210
|
-
expect(Spotlight::Exhibit).not_to exist(exhibit.id)
|
211
|
-
expect(flash[:notice]).to eq 'The exhibit was deleted.'
|
212
|
-
expect(response).to redirect_to main_app.root_path
|
213
|
-
end
|
214
|
-
end
|
215
|
-
end
|
216
|
-
end
|