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,251 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe Spotlight::FeaturePagesController, type: :controller, versioning: true do
|
4
|
-
routes { Spotlight::Engine.routes }
|
5
|
-
|
6
|
-
let(:valid_attributes) { { 'title' => 'MyString', thumbnail_attributes: { iiif_url: '' } } }
|
7
|
-
|
8
|
-
describe 'when not logged in' do
|
9
|
-
let(:exhibit) { FactoryBot.create(:exhibit) }
|
10
|
-
|
11
|
-
describe 'GET clone' do
|
12
|
-
let(:page) { FactoryBot.create(:feature_page, exhibit: exhibit) }
|
13
|
-
|
14
|
-
it 'is not allowed' do
|
15
|
-
get :clone, params: { exhibit_id: exhibit.id, id: page.id, language: 'es' }
|
16
|
-
expect(flash['alert']).to eq 'You need to sign in or sign up before continuing.'
|
17
|
-
expect(response).to redirect_to main_app.new_user_session_path
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
# This should return the minimal set of attributes required to create a valid
|
23
|
-
# Page. As you add validations to Page, be sure to
|
24
|
-
# adjust the attributes here as well.
|
25
|
-
|
26
|
-
describe 'when signed in as a curator' do
|
27
|
-
let(:exhibit) { FactoryBot.create(:exhibit) }
|
28
|
-
let(:user) { FactoryBot.create(:exhibit_curator, exhibit: exhibit) }
|
29
|
-
|
30
|
-
before { sign_in user }
|
31
|
-
|
32
|
-
describe 'GET index' do
|
33
|
-
let!(:page) { FactoryBot.create(:feature_page, exhibit: exhibit) }
|
34
|
-
|
35
|
-
it 'assigns all feature pages as @pages' do
|
36
|
-
expect(controller).to receive(:add_breadcrumb).with('Home', exhibit_root_path(exhibit))
|
37
|
-
expect(controller).to receive(:add_breadcrumb).with('Curation', exhibit_dashboard_path(exhibit))
|
38
|
-
expect(controller).to receive(:add_breadcrumb).with('Feature pages', exhibit_feature_pages_path(exhibit))
|
39
|
-
get :index, params: { exhibit_id: exhibit }
|
40
|
-
expect(assigns(:pages)).to include page
|
41
|
-
expect(assigns(:exhibit)).to eq exhibit
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
describe 'GET show' do
|
46
|
-
describe 'on a top level page' do
|
47
|
-
let(:page) { FactoryBot.create(:feature_page, exhibit: exhibit) }
|
48
|
-
|
49
|
-
it 'assigns the requested page as @page' do
|
50
|
-
expect(controller).to receive(:add_breadcrumb).with('Home', exhibit_root_path(exhibit))
|
51
|
-
expect(controller).to receive(:add_breadcrumb).with(page.title, [a_kind_of(ActionDispatch::Routing::RoutesProxy), exhibit, page])
|
52
|
-
get :show, params: { exhibit_id: page.exhibit.id, id: page }
|
53
|
-
expect(assigns(:page)).to eq(page)
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
describe 'on a sub-page' do
|
58
|
-
let(:page) { FactoryBot.create(:feature_subpage, exhibit: exhibit) }
|
59
|
-
|
60
|
-
it 'assigns the requested page as @page' do
|
61
|
-
expect(controller).to receive(:add_breadcrumb).with('Home', exhibit_root_path(exhibit))
|
62
|
-
expect(controller).to receive(:add_breadcrumb).with(
|
63
|
-
page.parent_page.title, [a_kind_of(ActionDispatch::Routing::RoutesProxy), exhibit, page.parent_page]
|
64
|
-
)
|
65
|
-
expect(controller).to receive(:add_breadcrumb).with(page.title, [a_kind_of(ActionDispatch::Routing::RoutesProxy), exhibit, page])
|
66
|
-
get :show, params: { exhibit_id: page.exhibit, id: page }
|
67
|
-
expect(assigns(:page)).to eq(page)
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
describe 'when "switching" locales for pages that have updated their title/slug' do
|
72
|
-
let(:page) { FactoryBot.create(:feature_page, exhibit: exhibit) }
|
73
|
-
let!(:page_es) do
|
74
|
-
FactoryBot.create(
|
75
|
-
:feature_page,
|
76
|
-
exhibit: exhibit,
|
77
|
-
title: 'Page in spanish',
|
78
|
-
locale: 'es',
|
79
|
-
default_locale_page: page
|
80
|
-
)
|
81
|
-
end
|
82
|
-
|
83
|
-
it 'redirects from the spanish slug to the english page when the english locale is selected' do
|
84
|
-
expect(page_es.slug).not_to eq page.slug # Ensure the slugs are different
|
85
|
-
get :show, params: { exhibit_id: exhibit.id, id: page_es.slug, locale: 'en' }
|
86
|
-
expect(response).to redirect_to(exhibit_feature_page_path(exhibit, page))
|
87
|
-
end
|
88
|
-
|
89
|
-
it 'redirects from the english slug to the spanish page when the spanish locale is selected' do
|
90
|
-
expect(page_es.slug).not_to eq page.slug # Ensure the slugs are different
|
91
|
-
get :show, params: { exhibit_id: exhibit.id, id: page.slug, locale: 'es' }
|
92
|
-
expect(response).to redirect_to(exhibit_feature_page_path(exhibit, page_es))
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
context 'when the sidebar is set to not display' do
|
97
|
-
let(:page) { FactoryBot.create(:feature_page, exhibit: exhibit, published: true) }
|
98
|
-
|
99
|
-
before { page.update(display_sidebar: false) }
|
100
|
-
|
101
|
-
it 'injects custom classes into the gallery view' do
|
102
|
-
get :show, params: { exhibit_id: exhibit.id, id: page.id }
|
103
|
-
expect(assigns(:exhibit).blacklight_config.view.gallery.classes).to eq 'row-cols-2 row-cols-md-4'
|
104
|
-
end
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
describe 'GET new' do
|
109
|
-
it 'assigns a new page as @page' do
|
110
|
-
get :new, params: { exhibit_id: exhibit }
|
111
|
-
expect(assigns(:page)).to be_a_new(Spotlight::FeaturePage)
|
112
|
-
expect(assigns(:page).exhibit).to eq exhibit
|
113
|
-
end
|
114
|
-
end
|
115
|
-
|
116
|
-
describe 'GET edit' do
|
117
|
-
let(:page) { FactoryBot.create(:feature_subpage, exhibit: exhibit) }
|
118
|
-
|
119
|
-
it 'assigns the requested page as @page' do
|
120
|
-
expect(controller).to receive(:add_breadcrumb).with('Home', exhibit_root_path(exhibit))
|
121
|
-
expect(controller).to receive(:add_breadcrumb).with('Feature pages', exhibit_feature_pages_path(exhibit))
|
122
|
-
expect(controller).to receive(:add_breadcrumb).with(
|
123
|
-
page.parent_page.title, [a_kind_of(ActionDispatch::Routing::RoutesProxy), exhibit, page.parent_page]
|
124
|
-
)
|
125
|
-
expect(controller).to receive(:add_breadcrumb).with(page.title, [:edit, exhibit, page])
|
126
|
-
get :edit, params: { exhibit_id: page.exhibit.id, id: page.id }
|
127
|
-
expect(assigns(:page)).to eq page
|
128
|
-
end
|
129
|
-
end
|
130
|
-
|
131
|
-
describe 'POST create' do
|
132
|
-
describe 'with valid params' do
|
133
|
-
it 'creates a new Page' do
|
134
|
-
expect do
|
135
|
-
post :create, params: { feature_page: { title: 'MyString' }, exhibit_id: exhibit }
|
136
|
-
end.to change(Spotlight::FeaturePage, :count).by(1)
|
137
|
-
end
|
138
|
-
|
139
|
-
it 'assigns a newly created page as @page' do
|
140
|
-
post :create, params: { feature_page: { title: 'MyString' }, exhibit_id: exhibit }
|
141
|
-
expect(assigns(:page)).to be_a(Spotlight::FeaturePage)
|
142
|
-
expect(assigns(:page)).to be_persisted
|
143
|
-
end
|
144
|
-
|
145
|
-
it 'redirects to the feature page index' do
|
146
|
-
post :create, params: { feature_page: { title: 'MyString' }, exhibit_id: exhibit }
|
147
|
-
expect(response).to redirect_to(exhibit_feature_pages_path(Spotlight::FeaturePage.last.exhibit))
|
148
|
-
end
|
149
|
-
end
|
150
|
-
|
151
|
-
describe 'with invalid params' do
|
152
|
-
it 'assigns a newly created but unsaved page as @page' do
|
153
|
-
# Trigger the behavior that occurs when invalid params are submitted
|
154
|
-
allow_any_instance_of(Spotlight::FeaturePage).to receive(:save).and_return(false)
|
155
|
-
post :create, params: { feature_page: { 'title' => 'invalid value' }, exhibit_id: exhibit }
|
156
|
-
expect(assigns(:page)).to be_a_new(Spotlight::FeaturePage)
|
157
|
-
end
|
158
|
-
|
159
|
-
it "re-renders the 'new' template" do
|
160
|
-
# Trigger the behavior that occurs when invalid params are submitted
|
161
|
-
allow_any_instance_of(Spotlight::FeaturePage).to receive(:save).and_return(false)
|
162
|
-
post :create, params: { feature_page: { 'title' => 'invalid value' }, exhibit_id: exhibit }
|
163
|
-
expect(response).to render_template('new')
|
164
|
-
end
|
165
|
-
end
|
166
|
-
end
|
167
|
-
|
168
|
-
describe 'PUT update' do
|
169
|
-
let(:page) { FactoryBot.create(:feature_page, exhibit: exhibit) }
|
170
|
-
|
171
|
-
describe 'with valid params' do
|
172
|
-
it 'updates the requested page' do
|
173
|
-
expect_any_instance_of(Spotlight::FeaturePage).to receive(:update)
|
174
|
-
put :update, params: { id: page, exhibit_id: page.exhibit.id, feature_page: valid_attributes }
|
175
|
-
end
|
176
|
-
|
177
|
-
it 'assigns the requested page as @page' do
|
178
|
-
put :update, params: { id: page, exhibit_id: page.exhibit.id, feature_page: valid_attributes }
|
179
|
-
expect(assigns(:page)).to eq(page)
|
180
|
-
end
|
181
|
-
|
182
|
-
it 'redirects to the feature page' do
|
183
|
-
put :update, params: { id: page, exhibit_id: page.exhibit.id, feature_page: valid_attributes }
|
184
|
-
page.reload
|
185
|
-
expect(response).to redirect_to(exhibit_feature_page_path(page.exhibit, page))
|
186
|
-
expect(flash[:notice]).to have_link 'Undo changes'
|
187
|
-
end
|
188
|
-
end
|
189
|
-
|
190
|
-
describe 'with invalid params' do
|
191
|
-
it 'assigns the page as @page' do
|
192
|
-
# Trigger the behavior that occurs when invalid params are submitted
|
193
|
-
allow_any_instance_of(Spotlight::FeaturePage).to receive(:save).and_return(false)
|
194
|
-
put :update, params: { id: page, exhibit_id: page.exhibit.id, feature_page: { 'title' => 'invalid value' } }
|
195
|
-
expect(assigns(:page)).to eq(page)
|
196
|
-
end
|
197
|
-
|
198
|
-
it "re-renders the 'edit' template" do
|
199
|
-
# Trigger the behavior that occurs when invalid params are submitted
|
200
|
-
allow_any_instance_of(Spotlight::FeaturePage).to receive(:save).and_return(false)
|
201
|
-
put :update, params: { id: page, exhibit_id: page.exhibit.id, feature_page: { 'title' => 'invalid value' } }
|
202
|
-
expect(response).to render_template('edit')
|
203
|
-
end
|
204
|
-
end
|
205
|
-
end
|
206
|
-
|
207
|
-
describe 'POST update_all' do
|
208
|
-
let!(:page1) { FactoryBot.create(:feature_page, exhibit: exhibit) }
|
209
|
-
let!(:page2) { FactoryBot.create(:feature_page, exhibit: page1.exhibit) }
|
210
|
-
let!(:page3) { FactoryBot.create(:feature_page, exhibit: page1.exhibit, parent_page_id: page1.id) }
|
211
|
-
|
212
|
-
before { request.env['HTTP_REFERER'] = '/whatever' }
|
213
|
-
|
214
|
-
it 'updates the parent/child relationship' do
|
215
|
-
post :update_all, params: { exhibit_id: page1.exhibit, exhibit: { feature_pages_attributes: [{ id: page2.id, parent_page_id: page1.id }] } }
|
216
|
-
expect(response).to redirect_to end_with('/whatever')
|
217
|
-
expect(flash[:notice]).to eq 'Feature pages were successfully updated.'
|
218
|
-
expect(page1.parent_page).to be_nil
|
219
|
-
expect(page1.child_pages).to include page2
|
220
|
-
expect(page3.parent_page).to eq page1 # should remain untouched since in wasn't present
|
221
|
-
end
|
222
|
-
end
|
223
|
-
|
224
|
-
describe 'DELETE destroy' do
|
225
|
-
let!(:page) { FactoryBot.create(:feature_page, exhibit: exhibit) }
|
226
|
-
|
227
|
-
it 'destroys the requested page' do
|
228
|
-
expect do
|
229
|
-
delete :destroy, params: { id: page, exhibit_id: page.exhibit.id }
|
230
|
-
end.to change(Spotlight::FeaturePage, :count).by(-1)
|
231
|
-
end
|
232
|
-
|
233
|
-
it 'redirects to the pages list' do
|
234
|
-
delete :destroy, params: { id: page, exhibit_id: page.exhibit.id }
|
235
|
-
expect(response).to redirect_to(exhibit_feature_pages_path(page.exhibit))
|
236
|
-
end
|
237
|
-
end
|
238
|
-
|
239
|
-
describe 'GET clone' do
|
240
|
-
let!(:page) { FactoryBot.create(:feature_page, exhibit: exhibit) }
|
241
|
-
|
242
|
-
it 'calls the CloneTranslatedPageFromLocale service' do
|
243
|
-
expect(
|
244
|
-
Spotlight::CloneTranslatedPageFromLocale
|
245
|
-
).to receive(:call).with(locale: 'es', page: page).and_call_original
|
246
|
-
|
247
|
-
get :clone, params: { exhibit_id: exhibit.id, id: page.id, language: 'es' }
|
248
|
-
end
|
249
|
-
end
|
250
|
-
end
|
251
|
-
end
|
@@ -1,77 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe Spotlight::FeaturedImagesController, type: :controller do
|
4
|
-
routes { Spotlight::Engine.routes }
|
5
|
-
|
6
|
-
describe 'when the user is not authorized' do
|
7
|
-
before do
|
8
|
-
sign_in FactoryBot.create(:exhibit_visitor)
|
9
|
-
end
|
10
|
-
|
11
|
-
describe 'POST create' do
|
12
|
-
it 'denies access' do
|
13
|
-
expect do
|
14
|
-
post :create, params: {
|
15
|
-
featured_image: {
|
16
|
-
image: fixture_file_upload('spec/fixtures/800x600.png', 'image/png')
|
17
|
-
}
|
18
|
-
}
|
19
|
-
end.not_to change(Spotlight::FeaturedImage, :count)
|
20
|
-
|
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 signed in as a site admin' do
|
28
|
-
let(:user) { FactoryBot.create(:site_admin) }
|
29
|
-
|
30
|
-
before { sign_in user }
|
31
|
-
|
32
|
-
describe 'POST create a thumbnail' do
|
33
|
-
it 'is successful' do
|
34
|
-
expect do
|
35
|
-
post :create, params: {
|
36
|
-
featured_image: {
|
37
|
-
image: fixture_file_upload('spec/fixtures/800x600.png', 'image/png')
|
38
|
-
}
|
39
|
-
}
|
40
|
-
end.to change(Spotlight::FeaturedImage, :count).by(1)
|
41
|
-
|
42
|
-
expect(response).to be_successful
|
43
|
-
expect(response.body).to match %r{\{"tilesource":"http://test\.host/images/\d+-.+/info\.json","id":\d+\}}
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
describe 'POST create a masthead' do
|
48
|
-
it 'is successful' do
|
49
|
-
expect do
|
50
|
-
post :create, params: {
|
51
|
-
featured_image: {
|
52
|
-
image: fixture_file_upload('spec/fixtures/800x600.png', 'image/png')
|
53
|
-
}
|
54
|
-
}
|
55
|
-
end.to change(Spotlight::FeaturedImage, :count).by(1)
|
56
|
-
|
57
|
-
expect(response).to be_successful
|
58
|
-
expect(response.body).to match %r{\{"tilesource":"http://test\.host/images/\d+-.+/info\.json","id":\d+\}}
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
describe 'POST create an avatar' do
|
63
|
-
it 'is successful' do
|
64
|
-
expect do
|
65
|
-
post :create, params: {
|
66
|
-
featured_image: {
|
67
|
-
image: fixture_file_upload('spec/fixtures/800x600.png', 'image/png')
|
68
|
-
}
|
69
|
-
}
|
70
|
-
end.to change(Spotlight::FeaturedImage, :count).by(1)
|
71
|
-
|
72
|
-
expect(response).to be_successful
|
73
|
-
expect(response.body).to match %r{\{"tilesource":"http://test\.host/images/\d+-.+/info\.json","id":\d+\}}
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|
@@ -1,72 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe Spotlight::FiltersController do
|
4
|
-
routes { Spotlight::Engine.routes }
|
5
|
-
|
6
|
-
describe '#create' do
|
7
|
-
let(:exhibit) { FactoryBot.create(:exhibit) }
|
8
|
-
|
9
|
-
before do
|
10
|
-
allow(Spotlight::Engine.config).to receive(:filter_resources_by_exhibit).and_return(false)
|
11
|
-
end
|
12
|
-
|
13
|
-
context 'when not signed in' do
|
14
|
-
it 'is not successful' do
|
15
|
-
post :create, params: { exhibit_id: exhibit, filter: { field: 'foo_ssi', value: 'bar_ssi' } }
|
16
|
-
expect(response).to redirect_to main_app.new_user_session_path
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
context 'when signed in as a site admin' do
|
21
|
-
before { sign_in user }
|
22
|
-
|
23
|
-
let(:user) { FactoryBot.create(:site_admin) }
|
24
|
-
|
25
|
-
it 'is successful' do
|
26
|
-
post :create, params: { exhibit_id: exhibit, filter: { field: 'foo_ssi', value: 'bar' } }
|
27
|
-
expect(response).to redirect_to edit_exhibit_path(exhibit, tab: 'filter')
|
28
|
-
expect(assigns[:exhibit].solr_data).to eq('foo_ssi' => 'bar')
|
29
|
-
end
|
30
|
-
|
31
|
-
it 'valids filter values' do
|
32
|
-
post :create, params: { exhibit_id: exhibit, filter: { field: 'foo_ssi', value: '' } }
|
33
|
-
expect(response).to redirect_to edit_exhibit_path(exhibit, tab: 'filter')
|
34
|
-
expect(flash[:alert]).to include "Value can't be blank"
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
describe '#update' do
|
40
|
-
let(:exhibit) { FactoryBot.create(:exhibit) }
|
41
|
-
let(:exhibit_filter) { exhibit.filters.first }
|
42
|
-
|
43
|
-
before do
|
44
|
-
allow(Spotlight::Engine.config).to receive(:filter_resources_by_exhibit).and_return(true)
|
45
|
-
end
|
46
|
-
|
47
|
-
context 'when not signed in' do
|
48
|
-
it 'is not successful' do
|
49
|
-
patch :update, params: { exhibit_id: exhibit, id: exhibit_filter, filter: { field: 'foo_ssi', value: 'bar_ssi' } }
|
50
|
-
expect(response).to redirect_to main_app.new_user_session_path
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
context 'when signed in as a site admin' do
|
55
|
-
before { sign_in user }
|
56
|
-
|
57
|
-
let(:user) { FactoryBot.create(:site_admin) }
|
58
|
-
|
59
|
-
it 'is successful' do
|
60
|
-
patch :update, params: { exhibit_id: exhibit, id: exhibit_filter, filter: { field: 'foo_ssi', value: 'bar' } }
|
61
|
-
expect(response).to redirect_to edit_exhibit_path(exhibit, tab: 'filter')
|
62
|
-
expect(assigns[:exhibit].solr_data).to eq('foo_ssi' => 'bar')
|
63
|
-
end
|
64
|
-
|
65
|
-
it 'valids filter values' do
|
66
|
-
patch :update, params: { exhibit_id: exhibit, id: exhibit_filter, filter: { field: 'foo_ssi', value: '' } }
|
67
|
-
expect(response).to redirect_to edit_exhibit_path(exhibit, tab: 'filter')
|
68
|
-
expect(flash[:alert]).to include "Value can't be blank"
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
@@ -1,103 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe Spotlight::GroupsController, type: :controller do
|
4
|
-
routes { Spotlight::Engine.routes }
|
5
|
-
let(:exhibit) { FactoryBot.create(:exhibit) }
|
6
|
-
let!(:group) { FactoryBot.create(:group, exhibit: exhibit) }
|
7
|
-
|
8
|
-
describe 'when the user is not authorized' do
|
9
|
-
before do
|
10
|
-
sign_in FactoryBot.create(:exhibit_visitor)
|
11
|
-
end
|
12
|
-
|
13
|
-
describe 'GET index' do
|
14
|
-
it 'returns authorized groups (none)' do
|
15
|
-
get :index, params: { exhibit_id: exhibit }, format: :json
|
16
|
-
expect(response).to be_successful
|
17
|
-
expect(JSON.parse(response.body).length).to eq 0
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
describe 'POST create' do
|
22
|
-
it 'denies access' do
|
23
|
-
post :create, params: { exhibit_id: exhibit, group: { title: 'Hello' } }
|
24
|
-
expect(response).to redirect_to main_app.root_path
|
25
|
-
expect(flash[:alert]).to be_present
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
describe 'PUT update' do
|
30
|
-
it 'denies access' do
|
31
|
-
patch :update, params: { exhibit_id: exhibit, id: group.id }
|
32
|
-
expect(response).to redirect_to main_app.root_path
|
33
|
-
expect(flash[:alert]).to be_present
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
describe 'when the user is a curator' do
|
39
|
-
before do
|
40
|
-
sign_in FactoryBot.create(:exhibit_curator, exhibit: exhibit)
|
41
|
-
end
|
42
|
-
|
43
|
-
describe 'GET index' do
|
44
|
-
it 'returns json response of groups' do
|
45
|
-
get :index, params: { exhibit_id: exhibit }, format: :json
|
46
|
-
expect(JSON.parse(response.body).length).to eq 1
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
describe 'POST create' do
|
51
|
-
it 'creates a saved search' do
|
52
|
-
post :create, params: { exhibit_id: exhibit, group: { title: 'Hello' } }
|
53
|
-
expect(response).to redirect_to spotlight.exhibit_searches_path(exhibit, anchor: 'browse-groups')
|
54
|
-
expect(flash[:notice]).to eq 'The browse group was created.'
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
describe 'PATCH update' do
|
59
|
-
it 'shows edit page' do
|
60
|
-
patch :update, params: {
|
61
|
-
id: group.id,
|
62
|
-
exhibit_id: group.exhibit,
|
63
|
-
group: {
|
64
|
-
title: 'Hello world'
|
65
|
-
}
|
66
|
-
}
|
67
|
-
|
68
|
-
expect(group.reload.title).to eq 'Hello world'
|
69
|
-
expect(response).to redirect_to exhibit_searches_path(exhibit, anchor: 'browse-groups')
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
describe 'PATCH update_all' do
|
74
|
-
let!(:group2) { FactoryBot.create(:group, exhibit: exhibit, published: true) }
|
75
|
-
let!(:group3) { FactoryBot.create(:group, exhibit: exhibit, published: true) }
|
76
|
-
|
77
|
-
it 'shows edit page' do
|
78
|
-
patch :update_all, params: {
|
79
|
-
exhibit_id: group.exhibit,
|
80
|
-
exhibit: {
|
81
|
-
groups_attributes: [
|
82
|
-
{ id: group.id, published: true, weight: '1' },
|
83
|
-
{ id: group2.id, published: false, weight: '0' }
|
84
|
-
]
|
85
|
-
}
|
86
|
-
}
|
87
|
-
|
88
|
-
expect(group.reload.weight).to eq 1
|
89
|
-
expect(group2.reload.published).to be false
|
90
|
-
expect(response).to redirect_to exhibit_searches_path(exhibit, anchor: 'browse-groups')
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
describe 'DELETE delete' do
|
95
|
-
it 'removes the group' do
|
96
|
-
group
|
97
|
-
expect do
|
98
|
-
delete :destroy, params: { id: group.id, exhibit_id: group.exhibit }
|
99
|
-
end.to change(Spotlight::Group, :count).by(-1)
|
100
|
-
end
|
101
|
-
end
|
102
|
-
end
|
103
|
-
end
|
@@ -1,126 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe Spotlight::HomePagesController, type: :controller, versioning: true do
|
4
|
-
routes { Spotlight::Engine.routes }
|
5
|
-
let(:valid_attributes) { { 'title' => 'MyString', thumbnail: { iiif_url: '' } } }
|
6
|
-
let(:exhibit) { FactoryBot.create(:exhibit) }
|
7
|
-
let(:page) { exhibit.home_page }
|
8
|
-
|
9
|
-
describe 'when signed in as a curator' do
|
10
|
-
let(:user) { FactoryBot.create(:exhibit_curator, exhibit: exhibit) }
|
11
|
-
|
12
|
-
before do
|
13
|
-
sign_in user
|
14
|
-
end
|
15
|
-
|
16
|
-
describe 'GET edit' do
|
17
|
-
describe "when the page title isn't set" do
|
18
|
-
before do
|
19
|
-
page.title = nil
|
20
|
-
end
|
21
|
-
|
22
|
-
it 'shows breadcrumbs' do
|
23
|
-
expect(controller).to receive(:add_breadcrumb).with('Home', exhibit_root_path(exhibit))
|
24
|
-
expect(controller).to receive(:add_breadcrumb).with('Feature pages', exhibit_feature_pages_path(exhibit))
|
25
|
-
expect(controller).to receive(:add_breadcrumb).with('Exhibit home', [:edit, exhibit, page])
|
26
|
-
get :edit, params: { id: page, exhibit_id: page.exhibit }
|
27
|
-
expect(response).to be_successful
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
it 'shows breadcrumbs' do
|
32
|
-
expect(controller).to receive(:add_breadcrumb).with('Home', exhibit_root_path(exhibit))
|
33
|
-
expect(controller).to receive(:add_breadcrumb).with('Feature pages', exhibit_feature_pages_path(exhibit))
|
34
|
-
expect(controller).to receive(:add_breadcrumb).with(page.title, [:edit, exhibit, page])
|
35
|
-
get :edit, params: { id: page, exhibit_id: page.exhibit }
|
36
|
-
expect(response).to be_successful
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
describe 'PUT update' do
|
41
|
-
it 'redirects to the feature page index action' do
|
42
|
-
put :update, params: { id: page, exhibit_id: page.exhibit.id, home_page: valid_attributes }
|
43
|
-
page.reload
|
44
|
-
expect(response).to redirect_to(exhibit_home_page_path(page.exhibit))
|
45
|
-
expect(flash[:notice]).to have_link 'Undo changes'
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
describe 'GET show' do
|
51
|
-
it 'gets search results for display facets' do
|
52
|
-
allow(controller).to receive_messages(search_results: [double, double])
|
53
|
-
get :show, params: { exhibit_id: exhibit }
|
54
|
-
expect(assigns[:response]).not_to be_blank
|
55
|
-
expect(assigns[:document_list]).not_to be_blank
|
56
|
-
expect(assigns[:page]).to eq exhibit.home_page
|
57
|
-
end
|
58
|
-
|
59
|
-
it 'does not render breadcrumbs' do
|
60
|
-
expect(controller).not_to receive(:add_breadcrumb)
|
61
|
-
allow(controller).to receive_messages(search_results: [double, double])
|
62
|
-
get :show, params: { exhibit_id: exhibit }
|
63
|
-
expect(response).to be_successful
|
64
|
-
end
|
65
|
-
|
66
|
-
it 'does not do the search when the sidebar is hidden' do
|
67
|
-
page.display_sidebar = false
|
68
|
-
page.save
|
69
|
-
allow(controller).to receive_messages(search_results: [double, double])
|
70
|
-
get :show, params: { exhibit_id: exhibit }
|
71
|
-
expect(assigns).not_to have_key :response
|
72
|
-
expect(assigns).not_to have_key :document_list
|
73
|
-
end
|
74
|
-
|
75
|
-
context 'when a non-default locale version of the page exists' do
|
76
|
-
let!(:page) { exhibit.home_page }
|
77
|
-
let!(:page_es) { FactoryBot.create(:home_page, exhibit: exhibit, locale: 'es') }
|
78
|
-
|
79
|
-
it 'is loaded' do
|
80
|
-
get :show, params: { exhibit_id: exhibit, locale: 'es' }
|
81
|
-
expect(assigns[:page]).to eq page_es
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
context 'when the exhibit is not published' do
|
86
|
-
before do
|
87
|
-
exhibit.update(published: false)
|
88
|
-
end
|
89
|
-
|
90
|
-
it 'redirects an anonymous user to the signin path' do
|
91
|
-
get :show, params: { exhibit_id: exhibit }
|
92
|
-
expect(response).to redirect_to(main_app.new_user_session_path)
|
93
|
-
end
|
94
|
-
|
95
|
-
it 'redirects an unauthorized user to the signin path' do
|
96
|
-
user = FactoryBot.create(:exhibit_curator)
|
97
|
-
sign_in user
|
98
|
-
expect do
|
99
|
-
get :show, params: { exhibit_id: exhibit }
|
100
|
-
end.to raise_error ActionController::RoutingError
|
101
|
-
end
|
102
|
-
|
103
|
-
it 'redirects an authorized user to the signin path' do
|
104
|
-
user = FactoryBot.create(:exhibit_curator, exhibit: exhibit)
|
105
|
-
sign_in user
|
106
|
-
get :show, params: { exhibit_id: exhibit }
|
107
|
-
expect(response).to be_successful
|
108
|
-
end
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
|
-
describe 'GET clone' do
|
113
|
-
let(:user) { FactoryBot.create(:exhibit_curator, exhibit: exhibit) }
|
114
|
-
let(:page) { exhibit.home_page }
|
115
|
-
|
116
|
-
before { sign_in user }
|
117
|
-
|
118
|
-
it 'calls the CloneTranslatedPageFromLocale service' do
|
119
|
-
expect(
|
120
|
-
Spotlight::CloneTranslatedPageFromLocale
|
121
|
-
).to receive(:call).with(locale: 'es', page: page).and_call_original
|
122
|
-
|
123
|
-
get :clone, params: { exhibit_id: exhibit.id, id: page.id, language: 'es' }
|
124
|
-
end
|
125
|
-
end
|
126
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe Spotlight::JobTrackersController, type: :controller do
|
4
|
-
routes { Spotlight::Engine.routes }
|
5
|
-
let(:job_tracker) { FactoryBot.create(:job_tracker, on: exhibit) }
|
6
|
-
let(:exhibit) { FactoryBot.create(:exhibit) }
|
7
|
-
|
8
|
-
describe 'when the user is not authorized' do
|
9
|
-
before do
|
10
|
-
sign_in FactoryBot.create(:exhibit_visitor)
|
11
|
-
end
|
12
|
-
|
13
|
-
describe 'GET show' do
|
14
|
-
it 'denies access' do
|
15
|
-
get :show, params: { exhibit_id: exhibit, id: job_tracker }
|
16
|
-
expect(response).to redirect_to main_app.root_path
|
17
|
-
expect(flash[:alert]).to be_present
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
describe 'when signed in' do
|
23
|
-
let(:user) { FactoryBot.create(:exhibit_admin, exhibit: exhibit) }
|
24
|
-
|
25
|
-
before { sign_in user }
|
26
|
-
|
27
|
-
describe 'GET show' do
|
28
|
-
it 'assigns breadcrumbs' do
|
29
|
-
expect(controller).to receive(:add_breadcrumb).with('Home', exhibit)
|
30
|
-
expect(controller).to receive(:add_breadcrumb).with('Dashboard', exhibit_dashboard_path(exhibit))
|
31
|
-
expect(controller).to receive(:add_breadcrumb).with('Job status', [exhibit, job_tracker])
|
32
|
-
get :show, params: { exhibit_id: exhibit, id: job_tracker }
|
33
|
-
expect(response).to be_successful
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|