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,552 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe Spotlight::CatalogController, type: :controller do
|
4
|
-
include ActiveJob::TestHelper
|
5
|
-
routes { Spotlight::Engine.routes }
|
6
|
-
let(:exhibit) { FactoryBot.create(:exhibit) }
|
7
|
-
|
8
|
-
it { is_expected.to be_a_kind_of ::CatalogController }
|
9
|
-
it { is_expected.to be_a_kind_of Spotlight::Concerns::ApplicationController }
|
10
|
-
its(:view_context) { is_expected.to be_a_kind_of Spotlight::ApplicationHelper }
|
11
|
-
|
12
|
-
describe 'when the user is not authenticated' do
|
13
|
-
describe 'GET admin' do
|
14
|
-
it 'redirects to the login page' do
|
15
|
-
get :admin, params: { exhibit_id: exhibit }
|
16
|
-
expect(response).to redirect_to main_app.new_user_session_path
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
describe 'GET edit' do
|
21
|
-
it 'is not allowed' do
|
22
|
-
get :edit, params: { exhibit_id: exhibit, id: 'dq287tq6352' }
|
23
|
-
expect(response).to redirect_to main_app.new_user_session_path
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
describe 'GET show' do
|
28
|
-
let(:document) { SolrDocument.new(id: 'dq287tq6352') }
|
29
|
-
let(:search) { FactoryBot.create(:search, exhibit: exhibit) }
|
30
|
-
|
31
|
-
it 'shows the item' do
|
32
|
-
expect(controller).to receive(:add_breadcrumb).with('Home', exhibit_path(exhibit))
|
33
|
-
expect(controller).to receive(:add_breadcrumb).with('L'AMERIQUE', exhibit_solr_document_path(exhibit, document))
|
34
|
-
get :show, params: { exhibit_id: exhibit, id: 'dq287tq6352' }
|
35
|
-
expect(response).to be_successful
|
36
|
-
end
|
37
|
-
|
38
|
-
it 'shows the item with breadcrumbs to the browse page' do
|
39
|
-
allow(controller).to receive_messages(current_browse_category: search)
|
40
|
-
|
41
|
-
expect(controller).to receive(:add_breadcrumb).with('Home', exhibit_path(exhibit))
|
42
|
-
expect(controller).to receive(:add_breadcrumb).with('Browse', exhibit_browse_index_path(exhibit))
|
43
|
-
expect(controller).to receive(:add_breadcrumb).with(search.title, exhibit_browse_path(exhibit, search))
|
44
|
-
expect(controller).to receive(:add_breadcrumb).with('L'AMERIQUE', exhibit_solr_document_path(exhibit, document))
|
45
|
-
get :show, params: { exhibit_id: exhibit, id: 'dq287tq6352' }
|
46
|
-
expect(response).to be_successful
|
47
|
-
end
|
48
|
-
|
49
|
-
it 'shows the item with breadcrumbs to the feature page' do
|
50
|
-
feature_page = FactoryBot.create(:feature_page, exhibit: exhibit)
|
51
|
-
allow(controller).to receive_messages(current_page_context: feature_page)
|
52
|
-
|
53
|
-
expect(controller).to receive(:add_breadcrumb).with('Home', exhibit_path(exhibit))
|
54
|
-
expect(controller).to receive(:add_breadcrumb).with(feature_page.title, [exhibit, feature_page])
|
55
|
-
expect(controller).to receive(:add_breadcrumb).with('L'AMERIQUE', exhibit_solr_document_path(exhibit, document))
|
56
|
-
get :show, params: { exhibit_id: exhibit, id: 'dq287tq6352' }
|
57
|
-
expect(response).to be_successful
|
58
|
-
end
|
59
|
-
|
60
|
-
it 'shows the item with breadcrumbs from the home page' do
|
61
|
-
home_page = FactoryBot.create(:home_page)
|
62
|
-
allow(controller).to receive_messages(current_page_context: home_page)
|
63
|
-
|
64
|
-
expect(controller).to receive(:add_breadcrumb).with('Home', exhibit_path(exhibit))
|
65
|
-
expect(controller).to receive(:add_breadcrumb).with('L'AMERIQUE', exhibit_solr_document_path(exhibit, document))
|
66
|
-
get :show, params: { exhibit_id: exhibit, id: 'dq287tq6352' }
|
67
|
-
expect(response).to be_successful
|
68
|
-
end
|
69
|
-
|
70
|
-
it 'adds the curation widget' do
|
71
|
-
get :show, params: { exhibit_id: exhibit, id: 'dq287tq6352' }
|
72
|
-
expect(controller.blacklight_config.show.partials.first).to eq 'curation_mode_toggle'
|
73
|
-
end
|
74
|
-
|
75
|
-
it 'does not have a solr_json serialization' do
|
76
|
-
get :show, params: { exhibit_id: exhibit, id: 'dq287tq6352', format: :solr_json }
|
77
|
-
expect(response).not_to be_successful
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
describe 'GET index' do
|
82
|
-
it 'shows the index when there are parameters' do
|
83
|
-
expect(controller).to receive(:add_breadcrumb).with('Home', exhibit_path(exhibit))
|
84
|
-
expect(controller).to receive(:add_breadcrumb).with('Search results', search_exhibit_catalog_path(exhibit, q: 'map'), current: true)
|
85
|
-
get :index, params: { exhibit_id: exhibit, q: 'map' }
|
86
|
-
expect(response).to be_successful
|
87
|
-
end
|
88
|
-
|
89
|
-
it 'redirects to the exhibit home page when there are no parameters' do
|
90
|
-
get :index, params: { exhibit_id: exhibit }
|
91
|
-
expect(response).to redirect_to(exhibit_root_path(exhibit))
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
describe 'GET autocomplete' do
|
96
|
-
it 'has partial matches for title' do
|
97
|
-
# Testing with ps921pn8250 because it has html escapable characters in the title (c'estadire)
|
98
|
-
get :autocomplete, params: { exhibit_id: exhibit, q: 'PLANIS', format: 'json' }
|
99
|
-
expect(assigns[:document_list].first.id).to eq 'ps921pn8250'
|
100
|
-
expect(response).to be_successful
|
101
|
-
json = JSON.parse(response.body)
|
102
|
-
doc = json['docs'].first
|
103
|
-
expect(doc).to include 'id', 'title', 'description', 'thumbnail', 'url'
|
104
|
-
expect(doc['id']).to eq 'ps921pn8250'
|
105
|
-
expect(doc['description']).to eq 'ps921pn8250'
|
106
|
-
expect(doc['title']).to eq "PLANISPHERE URANO-GEOGRAPHIQUE c'estadire LES SPHERES CELESTE et TERRESTRE mises en plan."
|
107
|
-
expect(doc['thumbnail']).to eq assigns[:document_list].first.first(:thumbnail_url_ssm)
|
108
|
-
expect(doc['url']).to eq exhibit_solr_document_path(exhibit, id: 'ps921pn8250')
|
109
|
-
end
|
110
|
-
|
111
|
-
it 'has partial matches for id' do
|
112
|
-
get :autocomplete, params: { exhibit_id: exhibit, q: 'dx157', format: 'json' }
|
113
|
-
expect(assigns[:document_list].first.id).to eq 'dx157dh4345'
|
114
|
-
expect(response).to be_successful
|
115
|
-
json = JSON.parse(response.body)
|
116
|
-
expect(json['docs'].first['id']).to eq 'dx157dh4345'
|
117
|
-
expect(json['docs'].first['title']).to eq 'KAART der REYZE van drie Schepen naar het ZUYDLAND in de Jaaren 1721 en 1722'
|
118
|
-
end
|
119
|
-
end
|
120
|
-
|
121
|
-
describe 'GET manifest' do
|
122
|
-
context 'document is an uploaded resource' do
|
123
|
-
let(:uploaded_resource) { FactoryBot.create(:uploaded_resource) }
|
124
|
-
|
125
|
-
it 'returns the json manifest produced by Spotlight::IiifManifestPresenter, based on the retrieved document and the controller' do
|
126
|
-
compound_id = uploaded_resource.compound_id
|
127
|
-
slug = uploaded_resource.exhibit.slug
|
128
|
-
|
129
|
-
perform_enqueued_jobs do
|
130
|
-
uploaded_resource.save_and_index
|
131
|
-
end
|
132
|
-
|
133
|
-
get :manifest, params: { exhibit_id: uploaded_resource.exhibit, id: compound_id }
|
134
|
-
|
135
|
-
expect(response).to be_successful
|
136
|
-
|
137
|
-
json = JSON.parse(response.body)
|
138
|
-
expect(json['@context']).to eq 'http://iiif.io/api/presentation/2/context.json'
|
139
|
-
expect(json['@id']).to eq "http://test.host/spotlight/#{slug}/catalog/#{compound_id}/manifest"
|
140
|
-
expect(json['@type']).to eq 'sc:Manifest'
|
141
|
-
|
142
|
-
canvas = json['sequences'].first['canvases'].first
|
143
|
-
expect(canvas['@id']).to eq "http://test.host/spotlight/#{slug}/catalog/#{compound_id}/manifest/canvas/#{compound_id}"
|
144
|
-
expect(canvas['@type']).to eq 'sc:Canvas'
|
145
|
-
|
146
|
-
image = canvas['images'].first
|
147
|
-
expect(image['resource']['@id']).to eq compound_id
|
148
|
-
expect(image['resource']['format']).to eq 'image/jpeg'
|
149
|
-
|
150
|
-
ensure
|
151
|
-
# clean up solr document created by save_and_index above
|
152
|
-
Blacklight.default_index.connection.delete_by_id uploaded_resource.compound_id
|
153
|
-
Blacklight.default_index.connection.commit
|
154
|
-
end
|
155
|
-
end
|
156
|
-
|
157
|
-
context 'document is not an uploaded resource' do
|
158
|
-
it 'returns a 404 when called on something other than an uploaded resource' do
|
159
|
-
get :manifest, params: { exhibit_id: exhibit, id: 'dx157dh4345' }
|
160
|
-
expect(response).not_to be_successful
|
161
|
-
expect(response.status).to eq(404)
|
162
|
-
end
|
163
|
-
end
|
164
|
-
end
|
165
|
-
end
|
166
|
-
|
167
|
-
describe 'when the user is not authorized' do
|
168
|
-
before do
|
169
|
-
sign_in FactoryBot.create(:exhibit_visitor)
|
170
|
-
end
|
171
|
-
|
172
|
-
describe 'GET admin' do
|
173
|
-
it 'denies access' do
|
174
|
-
get :admin, params: { exhibit_id: exhibit }
|
175
|
-
expect(response).to redirect_to main_app.root_path
|
176
|
-
expect(flash[:alert]).to be_present
|
177
|
-
end
|
178
|
-
end
|
179
|
-
|
180
|
-
describe 'GET edit' do
|
181
|
-
it 'is not allowed' do
|
182
|
-
get :edit, params: { exhibit_id: exhibit, id: 'dq287tq6352' }
|
183
|
-
expect(response).to redirect_to main_app.root_path
|
184
|
-
expect(flash[:alert]).to eq 'You are not authorized to access this page.'
|
185
|
-
end
|
186
|
-
end
|
187
|
-
|
188
|
-
describe 'GET show with private item' do
|
189
|
-
it 'is not allowed' do
|
190
|
-
allow_any_instance_of(::SolrDocument).to receive(:private?).and_return(true)
|
191
|
-
get :show, params: { exhibit_id: exhibit, id: 'dq287tq6352' }
|
192
|
-
expect(response).to redirect_to main_app.root_path
|
193
|
-
expect(flash[:alert]).to eq 'You are not authorized to access this page.'
|
194
|
-
end
|
195
|
-
end
|
196
|
-
|
197
|
-
describe 'PUT make_public' do
|
198
|
-
it 'is not allowed' do
|
199
|
-
put :make_public, params: { exhibit_id: exhibit, id: 'dq287tq6352' }
|
200
|
-
|
201
|
-
expect(response).to redirect_to main_app.root_path
|
202
|
-
expect(flash[:alert]).to eq 'You are not authorized to access this page.'
|
203
|
-
end
|
204
|
-
end
|
205
|
-
|
206
|
-
describe 'DELETE make_private' do
|
207
|
-
it 'is not allowed' do
|
208
|
-
delete :make_private, params: { exhibit_id: exhibit, id: 'dq287tq6352' }
|
209
|
-
expect(response).to redirect_to main_app.root_path
|
210
|
-
expect(flash[:alert]).to eq 'You are not authorized to access this page.'
|
211
|
-
end
|
212
|
-
end
|
213
|
-
end
|
214
|
-
|
215
|
-
describe 'when the user is a curator' do
|
216
|
-
before { sign_in FactoryBot.create(:exhibit_curator, exhibit: exhibit) }
|
217
|
-
|
218
|
-
it 'shows all the items' do
|
219
|
-
expect(controller).to receive(:add_breadcrumb).with('Home', exhibit_path(exhibit))
|
220
|
-
expect(controller).to receive(:add_breadcrumb).with('Curation', exhibit_dashboard_path(exhibit))
|
221
|
-
expect(controller).to receive(:add_breadcrumb).with('Items', admin_exhibit_catalog_path(exhibit))
|
222
|
-
get :admin, params: { exhibit_id: exhibit }
|
223
|
-
expect(response).to be_successful
|
224
|
-
expect(assigns[:document_list]).to be_a Array
|
225
|
-
expect(assigns[:exhibit]).to eq exhibit
|
226
|
-
expect(response).to render_template 'spotlight/catalog/admin'
|
227
|
-
expect(controller.blacklight_config.view.admin_table.document_actions).to be_empty
|
228
|
-
end
|
229
|
-
|
230
|
-
it 'uses the admin table view and hide the document actions' do
|
231
|
-
get :admin, params: { exhibit_id: exhibit }
|
232
|
-
|
233
|
-
expect(controller.blacklight_config.view.to_h.keys).to match_array [:admin_table]
|
234
|
-
expect(controller.blacklight_config.view.admin_table.document_actions).to be_empty
|
235
|
-
end
|
236
|
-
|
237
|
-
describe 'GET edit' do
|
238
|
-
it 'is successful' do
|
239
|
-
get :edit, params: { exhibit_id: exhibit, id: 'dq287tq6352' }
|
240
|
-
expect(response).to be_successful
|
241
|
-
expect(assigns[:exhibit]).to eq exhibit
|
242
|
-
expect(assigns[:document]).to be_kind_of SolrDocument
|
243
|
-
end
|
244
|
-
end
|
245
|
-
|
246
|
-
describe 'PATCH update' do
|
247
|
-
it 'is successful' do
|
248
|
-
expect do
|
249
|
-
patch :update, params: { exhibit_id: exhibit, id: 'dq287tq6352', solr_document: { exhibit_tag_list: 'one, two' } }
|
250
|
-
end.to change { exhibit.owned_taggings.count }.by(2)
|
251
|
-
end
|
252
|
-
|
253
|
-
it 'can update non-readonly fields' do
|
254
|
-
field = FactoryBot.create(:custom_field, exhibit: exhibit)
|
255
|
-
patch :update, params: { exhibit_id: exhibit, id: 'dq287tq6352', solr_document: { sidecar: { data: { field.field => 'no' } } } }
|
256
|
-
expect(assigns[:document].sidecar(exhibit).data).to eq(field.field => 'no')
|
257
|
-
end
|
258
|
-
|
259
|
-
it "can't update readonly fields" do
|
260
|
-
field = FactoryBot.create(:custom_field, exhibit: exhibit, readonly_field: true)
|
261
|
-
patch :update, params: { exhibit_id: exhibit, id: 'dq287tq6352', solr_document: { sidecar: { data: { field.field => 'no' } } } }
|
262
|
-
expect(assigns[:document].sidecar(exhibit).data).to eq({})
|
263
|
-
end
|
264
|
-
|
265
|
-
it 'can update multivalued fields' do
|
266
|
-
field = FactoryBot.create(:custom_field, exhibit: exhibit, is_multiple: true)
|
267
|
-
patch :update, params: { exhibit_id: exhibit, id: 'dq287tq6352', solr_document: { sidecar: { data: { field.field => %w[1 2 3] } } } }
|
268
|
-
expect(assigns[:document].sidecar(exhibit).data).to eq(field.field => %w[1 2 3])
|
269
|
-
end
|
270
|
-
end
|
271
|
-
|
272
|
-
describe 'PUT make_public' do
|
273
|
-
before do
|
274
|
-
request.env['HTTP_REFERER'] = '/where_i_came_from'
|
275
|
-
allow_any_instance_of(::SolrDocument).to receive(:reindex)
|
276
|
-
end
|
277
|
-
|
278
|
-
it 'is successful' do
|
279
|
-
expect_any_instance_of(::SolrDocument).to receive(:reindex)
|
280
|
-
expect_any_instance_of(::SolrDocument).to receive(:make_public!).with(exhibit)
|
281
|
-
put :make_public, params: { exhibit_id: exhibit, id: 'dq287tq6352' }
|
282
|
-
expect(response).to redirect_to end_with('/where_i_came_from')
|
283
|
-
end
|
284
|
-
end
|
285
|
-
|
286
|
-
describe 'DELETE make_private' do
|
287
|
-
before do
|
288
|
-
request.env['HTTP_REFERER'] = '/where_i_came_from'
|
289
|
-
allow_any_instance_of(::SolrDocument).to receive(:reindex)
|
290
|
-
end
|
291
|
-
|
292
|
-
it 'is successful' do
|
293
|
-
expect_any_instance_of(::SolrDocument).to receive(:reindex)
|
294
|
-
expect_any_instance_of(::SolrDocument).to receive(:make_private!).with(exhibit)
|
295
|
-
delete :make_private, params: { exhibit_id: exhibit, id: 'dq287tq6352' }
|
296
|
-
expect(response).to redirect_to end_with('/where_i_came_from')
|
297
|
-
end
|
298
|
-
end
|
299
|
-
end
|
300
|
-
|
301
|
-
describe 'when the user is a site admin' do
|
302
|
-
before { sign_in FactoryBot.create(:site_admin) }
|
303
|
-
|
304
|
-
describe 'GET show' do
|
305
|
-
it 'has a solr_json serialization' do
|
306
|
-
get :show, params: { exhibit_id: exhibit, id: 'dq287tq6352', format: :solr_json }
|
307
|
-
expect(response).to be_successful
|
308
|
-
data = JSON.parse(response.body).with_indifferent_access
|
309
|
-
expect(data).to include id: 'dq287tq6352'
|
310
|
-
expect(data).to include exhibit.solr_data
|
311
|
-
end
|
312
|
-
end
|
313
|
-
end
|
314
|
-
|
315
|
-
describe '.exhibit_search_facet_path' do
|
316
|
-
before do
|
317
|
-
allow(subject).to receive(:current_exhibit).and_return(exhibit)
|
318
|
-
end
|
319
|
-
|
320
|
-
it 'routes to the facet page' do
|
321
|
-
url = subject.exhibit_search_facet_path(id: 'x').sub('http://test.host/spotlight/', '/')
|
322
|
-
route = Spotlight::Engine.routes.recognize_path(url)
|
323
|
-
expect(route).to include controller: 'spotlight/catalog',
|
324
|
-
action: 'facet',
|
325
|
-
id: 'x'
|
326
|
-
end
|
327
|
-
|
328
|
-
it 'preserves the current exhibit context' do
|
329
|
-
url = subject.exhibit_search_facet_path(id: 'x').sub('http://test.host/spotlight/', '/')
|
330
|
-
route = Spotlight::Engine.routes.recognize_path(url)
|
331
|
-
expect(route).to include exhibit_id: exhibit.slug
|
332
|
-
end
|
333
|
-
|
334
|
-
context 'with search parameters' do
|
335
|
-
before do
|
336
|
-
allow(subject).to receive(:search_results).and_return([])
|
337
|
-
end
|
338
|
-
|
339
|
-
it 'preserves query parameters' do
|
340
|
-
get :index, params: { q: 'xyz', exhibit_id: exhibit }
|
341
|
-
url = subject.exhibit_search_facet_path(id: 'x')
|
342
|
-
expect(url).to include '?q=xyz'
|
343
|
-
end
|
344
|
-
end
|
345
|
-
end
|
346
|
-
|
347
|
-
describe 'next and previous documents' do
|
348
|
-
before do
|
349
|
-
exhibit.searches.first.update(published: true)
|
350
|
-
allow(controller).to receive(:current_search_session).and_return(search)
|
351
|
-
allow(controller).to receive(:search_session).and_return(search_session)
|
352
|
-
end
|
353
|
-
|
354
|
-
let(:search_session) { { 'counter' => 2 } }
|
355
|
-
|
356
|
-
let(:response) { double(total: 5, documents: [first_doc, nil, last_doc]) }
|
357
|
-
let(:first_doc) { double }
|
358
|
-
let(:last_doc) { double }
|
359
|
-
|
360
|
-
context 'when arriving from a browse page' do
|
361
|
-
let(:search) do
|
362
|
-
Search.new(query_params: { action: 'show', controller: 'spotlight/browse', id: exhibit.searches.first.id }.with_indifferent_access)
|
363
|
-
end
|
364
|
-
|
365
|
-
context 'when published' do
|
366
|
-
before do
|
367
|
-
exhibit.searches.first.update(published: true)
|
368
|
-
allow_any_instance_of(controller.search_service_class).to receive(:previous_and_next_documents_for_search).with(
|
369
|
-
1, exhibit.searches.first.query_params
|
370
|
-
).and_return([response, [first_doc, last_doc]])
|
371
|
-
end
|
372
|
-
|
373
|
-
it 'uses the saved search context' do
|
374
|
-
get :show, params: { exhibit_id: exhibit, id: 'dq287tq6352' }
|
375
|
-
|
376
|
-
expect(assigns(:previous_document)).to eq first_doc
|
377
|
-
expect(assigns(:next_document)).to eq last_doc
|
378
|
-
end
|
379
|
-
end
|
380
|
-
|
381
|
-
context 'when arriving from a private browse page' do
|
382
|
-
before do
|
383
|
-
exhibit.searches.first.update(published: false)
|
384
|
-
end
|
385
|
-
|
386
|
-
it 'ignores the search context' do
|
387
|
-
get :show, params: { exhibit_id: exhibit, id: 'dq287tq6352' }
|
388
|
-
|
389
|
-
expect(assigns(:previous_document)).to be_nil
|
390
|
-
expect(assigns(:next_document)).to be_nil
|
391
|
-
end
|
392
|
-
end
|
393
|
-
end
|
394
|
-
|
395
|
-
context 'when arriving from a feature page' do
|
396
|
-
let(:page) { FactoryBot.create(:feature_page, exhibit: exhibit) }
|
397
|
-
let(:search) do
|
398
|
-
Search.new(query_params: { action: 'show', controller: 'spotlight/feature_pages', id: page.id }.with_indifferent_access)
|
399
|
-
end
|
400
|
-
|
401
|
-
context 'when published' do
|
402
|
-
before do
|
403
|
-
page.update(published: true)
|
404
|
-
end
|
405
|
-
|
406
|
-
it 'uses the page context' do
|
407
|
-
pending 'Waiting to figure out how to construct previous/next documents'
|
408
|
-
get :show, params: { exhibit_id: exhibit, id: 'dq287tq6352' }
|
409
|
-
|
410
|
-
expect(assigns(:previous_document)).to be_a_kind_of SolrDocument
|
411
|
-
expect(assigns(:next_document)).to be_a_kind_of SolrDocument
|
412
|
-
end
|
413
|
-
end
|
414
|
-
|
415
|
-
context 'when unpublished' do
|
416
|
-
before do
|
417
|
-
page.update(published: false)
|
418
|
-
end
|
419
|
-
|
420
|
-
it 'ignores the search context' do
|
421
|
-
get :show, params: { exhibit_id: exhibit, id: 'dq287tq6352' }
|
422
|
-
|
423
|
-
expect(assigns(:previous_document)).to be_nil
|
424
|
-
expect(assigns(:next_document)).to be_nil
|
425
|
-
end
|
426
|
-
end
|
427
|
-
end
|
428
|
-
end
|
429
|
-
|
430
|
-
describe '#field_enabled?' do
|
431
|
-
let(:field) { FactoryBot.create(:custom_field) }
|
432
|
-
|
433
|
-
before do
|
434
|
-
controller.extend(Blacklight::Catalog)
|
435
|
-
allow(controller).to receive(:document_index_view_type).and_return(nil)
|
436
|
-
allow(field).to receive(:enabled).and_return(true)
|
437
|
-
end
|
438
|
-
|
439
|
-
context 'for sort fields' do
|
440
|
-
let(:field) { Blacklight::Configuration::SortField.new enabled: true }
|
441
|
-
|
442
|
-
it 'uses the enabled property for sort fields' do
|
443
|
-
expect(controller.field_enabled?(field)).to eq true
|
444
|
-
end
|
445
|
-
end
|
446
|
-
|
447
|
-
context 'for search fields' do
|
448
|
-
let(:field) { Blacklight::Configuration::SearchField.new enabled: true }
|
449
|
-
|
450
|
-
it 'uses the enabled property for search fields' do
|
451
|
-
expect(controller.field_enabled?(field)).to eq true
|
452
|
-
end
|
453
|
-
end
|
454
|
-
|
455
|
-
it 'returns the value of field#show if the action_name is "show"' do
|
456
|
-
allow(field).to receive(:show).and_return(:value)
|
457
|
-
allow(controller).to receive(:action_name).and_return('show')
|
458
|
-
expect(controller.field_enabled?(field)).to eq :value
|
459
|
-
end
|
460
|
-
|
461
|
-
it 'returns the value of field#show if the action_name is "edit"' do
|
462
|
-
allow(field).to receive(:show).and_return(:value)
|
463
|
-
allow(controller).to receive(:action_name).and_return('edit')
|
464
|
-
expect(controller.field_enabled?(field)).to eq :value
|
465
|
-
end
|
466
|
-
|
467
|
-
it 'returns the value of the original if condition' do
|
468
|
-
allow(field).to receive(:original).and_return false
|
469
|
-
expect(controller.field_enabled?(field)).to eq false
|
470
|
-
end
|
471
|
-
end
|
472
|
-
|
473
|
-
describe '#enabled_in_spotlight_view_type_configuration?' do
|
474
|
-
let(:view) { OpenStruct.new }
|
475
|
-
|
476
|
-
before do
|
477
|
-
controller.extend(Blacklight::Catalog)
|
478
|
-
end
|
479
|
-
|
480
|
-
it 'respects the original if condition' do
|
481
|
-
view.original = false
|
482
|
-
expect(controller.enabled_in_spotlight_view_type_configuration?(view)).to eq false
|
483
|
-
end
|
484
|
-
|
485
|
-
it 'is true if there is no exhibit context' do
|
486
|
-
allow(controller).to receive(:current_exhibit).and_return(nil)
|
487
|
-
expect(controller.enabled_in_spotlight_view_type_configuration?(view)).to eq true
|
488
|
-
end
|
489
|
-
|
490
|
-
it "is true if we're in a page context" do
|
491
|
-
allow(controller).to receive(:current_exhibit).and_return(nil)
|
492
|
-
allow(controller).to receive(:is_a?).with(Spotlight::PagesController).and_return(true)
|
493
|
-
expect(controller.enabled_in_spotlight_view_type_configuration?(view)).to eq true
|
494
|
-
end
|
495
|
-
end
|
496
|
-
|
497
|
-
describe 'save_search rendering' do
|
498
|
-
let(:current_exhibit) { FactoryBot.create(:exhibit) }
|
499
|
-
|
500
|
-
before { allow(controller).to receive_messages(current_exhibit: current_exhibit) }
|
501
|
-
|
502
|
-
describe 'render_curator_actions?' do
|
503
|
-
it 'returns false if we are on the items admin screen' do
|
504
|
-
allow(controller).to receive(:can?).with(:curate, current_exhibit).and_return(true)
|
505
|
-
allow(controller).to receive(:params).and_return(controller: 'spotlight/catalog', action: 'admin')
|
506
|
-
expect(controller).not_to be_render_curator_actions
|
507
|
-
end
|
508
|
-
|
509
|
-
it 'returns true if we are not on the items admin screen' do
|
510
|
-
allow(controller).to receive(:can?).with(:curate, current_exhibit).and_return(true)
|
511
|
-
allow(controller).to receive(:params).and_return(controller: 'spotlight/catalog', action: 'index')
|
512
|
-
expect(controller).to be_render_curator_actions
|
513
|
-
end
|
514
|
-
|
515
|
-
it 'returns false if a user cannot curate the object' do
|
516
|
-
allow(controller).to receive(:can?).with(:curate, current_exhibit).and_return(false)
|
517
|
-
expect(controller).not_to be_render_curator_actions
|
518
|
-
end
|
519
|
-
end
|
520
|
-
end
|
521
|
-
|
522
|
-
describe '#setup_next_and_previous_documents_from_browse_category' do
|
523
|
-
let(:search_session) { { 'counter' => '1' } }
|
524
|
-
let(:current_browse_category) { FactoryBot.create(:search, exhibit: exhibit, query_params: { q: 'Search String' }) }
|
525
|
-
|
526
|
-
before do
|
527
|
-
allow(controller).to receive_messages(
|
528
|
-
current_exhibit: exhibit,
|
529
|
-
search_session: search_session,
|
530
|
-
current_browse_category: current_browse_category
|
531
|
-
)
|
532
|
-
end
|
533
|
-
|
534
|
-
it 'sends the current browse category\'s query params to #previous_and_next_documents_for_search' do
|
535
|
-
expect_any_instance_of(controller.search_service_class).to receive(:previous_and_next_documents_for_search).with(
|
536
|
-
0, current_browse_category.query_params
|
537
|
-
)
|
538
|
-
|
539
|
-
controller.send(:setup_next_and_previous_documents_from_browse_category)
|
540
|
-
end
|
541
|
-
|
542
|
-
it 'sets instance variables for the previous and next documents based on the return of previous_and_next_documents_for_search' do
|
543
|
-
allow_any_instance_of(controller.search_service_class).to receive(:previous_and_next_documents_for_search).with(
|
544
|
-
0, current_browse_category.query_params
|
545
|
-
).and_return([instance_double('SolrResponse', total: '100'), [nil, SolrDocument.new]])
|
546
|
-
|
547
|
-
controller.send(:setup_next_and_previous_documents_from_browse_category)
|
548
|
-
expect(controller.instance_variable_get(:@previous_document)).to be_nil
|
549
|
-
expect(controller.instance_variable_get(:@next_document)).to an_instance_of SolrDocument
|
550
|
-
end
|
551
|
-
end
|
552
|
-
end
|
@@ -1,38 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe Spotlight::ConfirmationsController, type: :controller do
|
4
|
-
routes { Spotlight::Engine.routes }
|
5
|
-
before do
|
6
|
-
# rubocop:disable RSpec/InstanceVariable
|
7
|
-
@request.env['devise.mapping'] = Devise.mappings[:contact_email]
|
8
|
-
# rubocop:enable RSpec/InstanceVariable
|
9
|
-
end
|
10
|
-
|
11
|
-
describe 'GET new' do
|
12
|
-
it 'exists' do
|
13
|
-
get :new
|
14
|
-
expect(response).to be_successful
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
describe 'GET show' do
|
19
|
-
let(:exhibit) { FactoryBot.create(:exhibit) }
|
20
|
-
let(:contact_email) { FactoryBot.create(:contact_email, email: 'justin@example.com', exhibit: exhibit) }
|
21
|
-
let(:raw_token) { contact_email.instance_variable_get(:@raw_confirmation_token) }
|
22
|
-
|
23
|
-
describe 'when the token is invalid' do
|
24
|
-
it 'gives reset instructions' do
|
25
|
-
get :show
|
26
|
-
expect(response).to be_successful
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
describe 'when the token is valid' do
|
31
|
-
it 'updates the user' do
|
32
|
-
get :show, params: { confirmation_token: raw_token }
|
33
|
-
expect(contact_email.reload).to be_confirmed
|
34
|
-
expect(response).to redirect_to main_app.new_user_session_path
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
@@ -1,65 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe Spotlight::ContactEmailController, type: :controller do
|
4
|
-
routes { Spotlight::Engine.routes }
|
5
|
-
let(:contact_email) { FactoryBot.create(:contact_email) }
|
6
|
-
|
7
|
-
context 'when not logged in' do
|
8
|
-
describe 'DELETE destroy' do
|
9
|
-
it 'redirects to the login page' do
|
10
|
-
# note about odd behavior: it was discovered in testing that if format: :json is explicitly specified here, the user is redirected
|
11
|
-
# to login on rails 4, but gets a 401 on rails 5. we suspect differing CanCan behavior, but didn't investigate in depth.
|
12
|
-
delete :destroy, params: { id: contact_email, exhibit_id: contact_email.exhibit }
|
13
|
-
# custom logic in ApplicationController redirects user to app login page on CanCan::AccessDenied if user can't read current exhibit
|
14
|
-
expect(response).to redirect_to main_app.new_user_session_path
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
context 'when logged in' do
|
20
|
-
before { sign_in user }
|
21
|
-
|
22
|
-
context 'as a visitor' do
|
23
|
-
let(:user) { FactoryBot.create(:exhibit_visitor) }
|
24
|
-
|
25
|
-
describe 'DELETE destroy' do
|
26
|
-
it 'redirects to the home page' do
|
27
|
-
delete :destroy, params: { id: contact_email, exhibit_id: contact_email.exhibit }
|
28
|
-
# custom logic in ApplicationController redirects user to app root on CanCan::AccessDenied if user's allowed to view current exhibit
|
29
|
-
expect(response).to redirect_to main_app.root_path
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
context 'as an exhibit curator' do
|
35
|
-
let(:user) { FactoryBot.create(:exhibit_curator, exhibit: contact_email.exhibit) }
|
36
|
-
|
37
|
-
describe 'DELETE destroy' do
|
38
|
-
it 'redirects to the home page' do
|
39
|
-
delete :destroy, params: { id: contact_email, exhibit_id: contact_email.exhibit }
|
40
|
-
# custom logic in ApplicationController redirects user to app root on CanCan::AccessDenied if user's allowed to view current exhibit
|
41
|
-
expect(response).to redirect_to main_app.root_path
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
context 'as an exhibit admin' do
|
47
|
-
let(:user) { FactoryBot.create(:exhibit_admin, exhibit: contact_email.exhibit) }
|
48
|
-
|
49
|
-
describe 'DELETE destroy' do
|
50
|
-
it 'is successful when the record exists' do
|
51
|
-
delete :destroy, params: { id: contact_email, exhibit_id: contact_email.exhibit }
|
52
|
-
expect(response).to be_successful
|
53
|
-
expect(JSON.parse(response.body)).to eq('success' => true, 'error' => nil)
|
54
|
-
end
|
55
|
-
|
56
|
-
it 'gives a 404 with appropriate message when the record no longer exists' do
|
57
|
-
contact_email.destroy
|
58
|
-
delete :destroy, params: { id: contact_email, exhibit_id: contact_email.exhibit }
|
59
|
-
expect(response.status).to eq 404
|
60
|
-
expect(JSON.parse(response.body)).to eq('success' => false, 'error' => 'Not Found')
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|