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,30 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe ApplicationController, type: :controller do
|
4
|
-
routes { Spotlight::Engine.routes }
|
5
|
-
let(:exhibit) { FactoryBot.create(:exhibit) }
|
6
|
-
|
7
|
-
it { is_expected.to be_a_kind_of Spotlight::Controller }
|
8
|
-
|
9
|
-
describe 'exhibit-specific routing' do
|
10
|
-
context 'with a current exhibit' do
|
11
|
-
before do
|
12
|
-
allow(controller).to receive(:current_exhibit).and_return(exhibit)
|
13
|
-
end
|
14
|
-
|
15
|
-
describe '#search_action_url' do
|
16
|
-
it 'is a path within the current exhibit' do
|
17
|
-
expected = { controller: 'spotlight/catalog', action: 'index', exhibit_id: exhibit.slug }
|
18
|
-
expect(get: controller.search_action_url(only_path: true).gsub('/spotlight', '')).to route_to expected
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
describe '#search_facet_path' do
|
23
|
-
it 'is a path within the current exhibit' do
|
24
|
-
expected = { controller: 'spotlight/catalog', action: 'facet', id: 'some-facet', exhibit_id: exhibit.slug }
|
25
|
-
expect(get: controller.search_facet_path(id: 'some-facet', only_path: true).gsub('/spotlight', '')).to route_to expected
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
@@ -1,239 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe Spotlight::AboutPagesController, type: :controller, versioning: true do
|
4
|
-
routes { Spotlight::Engine.routes }
|
5
|
-
let(:valid_attributes) { { 'title' => 'MyString', thumbnail: { iiif_url: '' } } }
|
6
|
-
|
7
|
-
after do
|
8
|
-
I18n.locale = I18n.default_locale
|
9
|
-
end
|
10
|
-
|
11
|
-
describe 'when not logged in' do
|
12
|
-
let(:exhibit) { FactoryBot.create(:exhibit) }
|
13
|
-
|
14
|
-
describe 'POST update_all' do
|
15
|
-
it 'is not allowed' do
|
16
|
-
post :update_all, params: { exhibit_id: exhibit }
|
17
|
-
expect(response).to redirect_to main_app.new_user_session_path
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
describe 'GET clone' do
|
22
|
-
let(:page) { FactoryBot.create(:about_page, exhibit: exhibit) }
|
23
|
-
|
24
|
-
it 'is not allowed' do
|
25
|
-
get :clone, params: { exhibit_id: exhibit.id, id: page.id, language: 'es' }
|
26
|
-
expect(flash['alert']).to eq 'You need to sign in or sign up before continuing.'
|
27
|
-
expect(response).to redirect_to main_app.new_user_session_path
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
describe 'when signed in as a curator' do
|
33
|
-
let(:exhibit) { FactoryBot.create(:exhibit) }
|
34
|
-
let(:user) { FactoryBot.create(:exhibit_curator, exhibit: exhibit) }
|
35
|
-
|
36
|
-
before { sign_in user }
|
37
|
-
|
38
|
-
describe 'GET show' do
|
39
|
-
let(:page) { FactoryBot.create(:about_page, weight: 0, exhibit: exhibit) }
|
40
|
-
let(:page2) { FactoryBot.create(:about_page, weight: 5, exhibit: exhibit) }
|
41
|
-
|
42
|
-
describe 'on the main about page' do
|
43
|
-
it 'is successful' do
|
44
|
-
expect(controller).to receive(:add_breadcrumb).with('Home', exhibit_root_path(exhibit))
|
45
|
-
expect(controller).to receive(:add_breadcrumb).with('About', [a_kind_of(ActionDispatch::Routing::RoutesProxy), exhibit, page])
|
46
|
-
get :show, params: { id: page, exhibit_id: exhibit }
|
47
|
-
expect(assigns(:page)).to eq page
|
48
|
-
expect(assigns(:exhibit)).to eq exhibit
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
describe 'on a different about page' do
|
53
|
-
it 'is successful' do
|
54
|
-
expect(controller).to receive(:add_breadcrumb).with('Home', exhibit_root_path(exhibit))
|
55
|
-
expect(controller).to receive(:add_breadcrumb).with('About', [a_kind_of(ActionDispatch::Routing::RoutesProxy), exhibit, page])
|
56
|
-
expect(controller).to receive(:add_breadcrumb).with(page2.title, [exhibit, page2])
|
57
|
-
get :show, params: { id: page2, exhibit_id: exhibit }
|
58
|
-
expect(assigns(:page)).to eq page2
|
59
|
-
expect(assigns(:exhibit)).to eq exhibit
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
describe 'under a non-default locale' do
|
64
|
-
let!(:page_es) do
|
65
|
-
FactoryBot.create(
|
66
|
-
:about_page,
|
67
|
-
title: page.title,
|
68
|
-
weight: 0,
|
69
|
-
exhibit: exhibit,
|
70
|
-
locale: 'es',
|
71
|
-
default_locale_page: page
|
72
|
-
)
|
73
|
-
end
|
74
|
-
|
75
|
-
it 'renders the locale specific page' do
|
76
|
-
get :show, params: { exhibit_id: exhibit.id, id: page.slug, locale: 'es' }
|
77
|
-
|
78
|
-
expect(assigns[:page]).to eq page_es
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
describe 'when "switching" locales for pages that have updated their title/slug' do
|
83
|
-
let(:page) { FactoryBot.create(:about_page, exhibit: exhibit) }
|
84
|
-
let!(:page_es) do
|
85
|
-
FactoryBot.create(
|
86
|
-
:about_page,
|
87
|
-
exhibit: exhibit,
|
88
|
-
title: 'Page in spanish',
|
89
|
-
locale: 'es',
|
90
|
-
default_locale_page: page
|
91
|
-
)
|
92
|
-
end
|
93
|
-
|
94
|
-
it 'redirects from the spanish slug to the english page when the english locale is selected' do
|
95
|
-
expect(page_es.slug).not_to eq page.slug # Ensure the slugs are different
|
96
|
-
get :show, params: { exhibit_id: exhibit.id, id: page_es.slug, locale: 'en' }
|
97
|
-
expect(response).to redirect_to(exhibit_about_page_path(exhibit, page))
|
98
|
-
end
|
99
|
-
|
100
|
-
it 'redirects from the english slug to the spanish page when the spanish locale is selected' do
|
101
|
-
expect(page_es.slug).not_to eq page.slug # Ensure the slugs are different
|
102
|
-
get :show, params: { exhibit_id: exhibit.id, id: page.slug, locale: 'es' }
|
103
|
-
expect(response).to redirect_to(exhibit_about_page_path(exhibit, page_es))
|
104
|
-
end
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
describe 'GET edit' do
|
109
|
-
let!(:page) { FactoryBot.create(:about_page, weight: 0, exhibit: exhibit) }
|
110
|
-
let!(:page2) { FactoryBot.create(:about_page, weight: 5, exhibit: exhibit) }
|
111
|
-
|
112
|
-
describe 'on the main about page' do
|
113
|
-
it 'is successful' do
|
114
|
-
expect(controller).to receive(:add_breadcrumb).with('Home', exhibit_root_path(exhibit))
|
115
|
-
expect(controller).to receive(:add_breadcrumb).with('About pages', exhibit_about_pages_path(exhibit))
|
116
|
-
get :edit, params: { id: page, exhibit_id: exhibit }
|
117
|
-
expect(assigns(:page)).to eq page
|
118
|
-
expect(assigns(:exhibit)).to eq exhibit
|
119
|
-
end
|
120
|
-
end
|
121
|
-
|
122
|
-
describe 'on a different about page' do
|
123
|
-
it 'is successful' do
|
124
|
-
expect(controller).to receive(:add_breadcrumb).with('Home', exhibit_root_path(exhibit))
|
125
|
-
expect(controller).to receive(:add_breadcrumb).with('About pages', exhibit_about_pages_path(exhibit))
|
126
|
-
expect(controller).to receive(:add_breadcrumb).with(page2.title, [:edit, exhibit, page2])
|
127
|
-
get :edit, params: { id: page2, exhibit_id: exhibit }
|
128
|
-
expect(assigns(:page)).to eq page2
|
129
|
-
expect(assigns(:exhibit)).to eq exhibit
|
130
|
-
end
|
131
|
-
end
|
132
|
-
end
|
133
|
-
|
134
|
-
describe 'GET index' do
|
135
|
-
let!(:page) { FactoryBot.create(:about_page, exhibit: exhibit) }
|
136
|
-
|
137
|
-
it 'is successful' do
|
138
|
-
expect(controller).to receive(:add_breadcrumb).with('Home', exhibit_root_path(exhibit))
|
139
|
-
expect(controller).to receive(:add_breadcrumb).with('Curation', exhibit_dashboard_path(exhibit))
|
140
|
-
expect(controller).to receive(:add_breadcrumb).with('About pages', exhibit_about_pages_path(exhibit))
|
141
|
-
get :index, params: { exhibit_id: exhibit }
|
142
|
-
expect(assigns(:page)).to be_kind_of Spotlight::Page
|
143
|
-
expect(assigns(:page)).to be_new_record
|
144
|
-
expect(assigns(:pages)).to include page
|
145
|
-
expect(assigns(:exhibit)).to eq exhibit
|
146
|
-
end
|
147
|
-
end
|
148
|
-
|
149
|
-
describe 'POST create' do
|
150
|
-
it 'redirects to the about page index' do
|
151
|
-
post :create, params: { about_page: { title: 'MyString' }, exhibit_id: exhibit }
|
152
|
-
expect(response).to redirect_to(exhibit_about_pages_path(exhibit))
|
153
|
-
end
|
154
|
-
end
|
155
|
-
|
156
|
-
describe 'PUT update' do
|
157
|
-
let!(:page) { FactoryBot.create(:about_page, exhibit: exhibit) }
|
158
|
-
|
159
|
-
it 'redirects to the about page' do
|
160
|
-
put :update, params: { id: page, exhibit_id: page.exhibit.id, about_page: valid_attributes }
|
161
|
-
page.reload
|
162
|
-
expect(response).to redirect_to(exhibit_about_page_path(page.exhibit, page))
|
163
|
-
expect(flash[:notice]).to have_link 'Undo changes'
|
164
|
-
end
|
165
|
-
end
|
166
|
-
|
167
|
-
describe 'POST update_all' do
|
168
|
-
let!(:page1) { FactoryBot.create(:about_page, exhibit: exhibit) }
|
169
|
-
let!(:page2) { FactoryBot.create(:about_page, exhibit: exhibit, published: true) }
|
170
|
-
let!(:page3) { FactoryBot.create(:about_page, exhibit: exhibit, published: true) }
|
171
|
-
|
172
|
-
it 'updates whether they are on the landing page' do
|
173
|
-
post :update_all, params: {
|
174
|
-
exhibit_id: page1.exhibit,
|
175
|
-
exhibit: {
|
176
|
-
about_pages_attributes: [
|
177
|
-
{ id: page1.id, published: true, title: 'This is a new title!' },
|
178
|
-
{ id: page2.id, published: false }
|
179
|
-
]
|
180
|
-
}
|
181
|
-
}
|
182
|
-
expect(response).to redirect_to end_with('/dashboard')
|
183
|
-
expect(flash[:notice]).to eq 'About pages were successfully updated.'
|
184
|
-
expect(page1.reload.published).to be_truthy
|
185
|
-
expect(page1.title).to eq 'This is a new title!'
|
186
|
-
expect(page2.reload.published).to be_falsey
|
187
|
-
expect(page3.reload.published).to be_truthy # should remain untouched since it wasn't in present[]
|
188
|
-
end
|
189
|
-
end
|
190
|
-
|
191
|
-
describe 'PATCH update_contacts' do
|
192
|
-
let!(:contact1) { FactoryBot.create(:contact, name: 'Aphra Behn', exhibit: exhibit) }
|
193
|
-
let!(:contact2) { FactoryBot.create(:contact, exhibit: exhibit) }
|
194
|
-
|
195
|
-
it 'updates contacts' do
|
196
|
-
patch :update_contacts, params: {
|
197
|
-
exhibit_id: exhibit,
|
198
|
-
exhibit: {
|
199
|
-
contacts_attributes: [
|
200
|
-
{ 'show_in_sidebar' => '1', 'id' => contact1.id, weight: 1 },
|
201
|
-
{ 'show_in_sidebar' => '0', 'id' => contact2.id, weight: 2 }
|
202
|
-
]
|
203
|
-
}
|
204
|
-
}
|
205
|
-
expect(response).to redirect_to exhibit_about_pages_path(exhibit)
|
206
|
-
expect(flash[:notice]).to eq 'Contacts were successfully updated.'
|
207
|
-
expect(exhibit.contacts.size).to eq 2
|
208
|
-
expect(exhibit.contacts.published.map(&:name)).to eq ['Aphra Behn']
|
209
|
-
expect(contact1.reload.weight).to eq 1
|
210
|
-
expect(contact2.reload.weight).to eq 2
|
211
|
-
end
|
212
|
-
|
213
|
-
it 'shows index on failure' do
|
214
|
-
expect_any_instance_of(Spotlight::Exhibit).to receive(:update).and_return(false)
|
215
|
-
patch :update_contacts, params: {
|
216
|
-
exhibit_id: exhibit,
|
217
|
-
exhibit: { contacts_attributes: [
|
218
|
-
{ 'show_in_sidebar' => '1', 'name' => 'Justin Coyne', 'email' => 'jcoyne@justincoyne.com', 'title' => '', 'location' => 'US' },
|
219
|
-
{ 'show_in_sidebar' => '0', 'name' => '', 'email' => '', 'title' => '', 'location' => '' },
|
220
|
-
{ 'show_in_sidebar' => '0', 'name' => '', 'email' => '', 'title' => 'Librarian', 'location' => '' }
|
221
|
-
] }
|
222
|
-
}
|
223
|
-
expect(response).to render_template('index')
|
224
|
-
end
|
225
|
-
end
|
226
|
-
|
227
|
-
describe 'GET clone' do
|
228
|
-
let(:page) { FactoryBot.create(:about_page, exhibit: exhibit) }
|
229
|
-
|
230
|
-
it 'calls the CloneTranslatedPageFromLocale service' do
|
231
|
-
expect(
|
232
|
-
Spotlight::CloneTranslatedPageFromLocale
|
233
|
-
).to receive(:call).with(locale: 'es', page: page).and_call_original
|
234
|
-
|
235
|
-
get :clone, params: { exhibit_id: exhibit.id, id: page.id, language: 'es' }
|
236
|
-
end
|
237
|
-
end
|
238
|
-
end
|
239
|
-
end
|
@@ -1,53 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
RSpec.describe Spotlight::AdminUsersController, type: :controller do
|
4
|
-
routes { Spotlight::Engine.routes }
|
5
|
-
|
6
|
-
before { sign_in(user) }
|
7
|
-
|
8
|
-
context 'by a non-admin' do
|
9
|
-
let(:user) { FactoryBot.create(:exhibit_visitor) }
|
10
|
-
|
11
|
-
it 'redirects with an error message' do
|
12
|
-
get :index
|
13
|
-
expect(response).to redirect_to '/'
|
14
|
-
expect(flash[:alert]).to eq 'You are not authorized to access this page.'
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
context 'by an admin user' do
|
19
|
-
before { request.env['HTTP_REFERER'] = 'http://example.com' }
|
20
|
-
|
21
|
-
let(:user) { FactoryBot.create(:site_admin) }
|
22
|
-
|
23
|
-
describe 'GET index' do
|
24
|
-
it 'is successful' do
|
25
|
-
get :index
|
26
|
-
expect(response).to be_successful
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
describe 'DELETE destroy' do
|
31
|
-
let(:user) { FactoryBot.create(:user) }
|
32
|
-
let!(:admin_role) { FactoryBot.create(:role, role: 'admin', user: user, resource: Spotlight::Site.instance) }
|
33
|
-
|
34
|
-
it 'removes the site admin role from the given user' do
|
35
|
-
delete :destroy, params: { id: user.id }
|
36
|
-
expect(response).to redirect_to(admin_users_path)
|
37
|
-
expect(flash[:notice]).to eq 'User removed from site adminstrator role'
|
38
|
-
expect(Spotlight::Site.instance.roles.where(user_id: user.id)).to be_none
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
describe 'PATCH update' do
|
43
|
-
let(:non_admin) { FactoryBot.create(:exhibit_visitor) }
|
44
|
-
|
45
|
-
it 'adds the site admin role to the given user' do
|
46
|
-
patch :update, params: { id: non_admin.id }
|
47
|
-
expect(response).to redirect_to(admin_users_path)
|
48
|
-
expect(flash[:notice]).to eq 'Added user as an adminstrator'
|
49
|
-
expect(non_admin.roles.map(&:role)).to eq ['admin']
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
@@ -1,88 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe Spotlight::AppearancesController, type: :controller do
|
4
|
-
routes { Spotlight::Engine.routes }
|
5
|
-
let(:exhibit) { FactoryBot.create(:exhibit) }
|
6
|
-
|
7
|
-
describe 'when the user is not authorized' do
|
8
|
-
before do
|
9
|
-
sign_in FactoryBot.create(:exhibit_visitor)
|
10
|
-
end
|
11
|
-
|
12
|
-
describe 'GET edit' do
|
13
|
-
it 'denies access' do
|
14
|
-
get :edit, params: { exhibit_id: exhibit }
|
15
|
-
expect(response).to redirect_to main_app.root_path
|
16
|
-
expect(flash[:alert]).to be_present
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
describe 'when not logged in' do
|
22
|
-
describe 'PATCH update' do
|
23
|
-
it 'is not allowed' do
|
24
|
-
patch :update, params: { exhibit_id: exhibit }
|
25
|
-
expect(response).to redirect_to main_app.new_user_session_path
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
describe 'when signed in' do
|
31
|
-
let(:user) { FactoryBot.create(:exhibit_admin, exhibit: exhibit) }
|
32
|
-
|
33
|
-
before { sign_in user }
|
34
|
-
|
35
|
-
describe 'GET edit' do
|
36
|
-
it 'is successful' do
|
37
|
-
expect(controller).to receive(:add_breadcrumb).with('Home', exhibit)
|
38
|
-
expect(controller).to receive(:add_breadcrumb).with('Configuration', exhibit_dashboard_path(exhibit))
|
39
|
-
expect(controller).to receive(:add_breadcrumb).with('Appearance', edit_exhibit_appearance_path(exhibit))
|
40
|
-
get :edit, params: { exhibit_id: exhibit }
|
41
|
-
expect(response).to be_successful
|
42
|
-
expect(assigns[:exhibit]).to be_kind_of Spotlight::Exhibit
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
describe 'PATCH update' do
|
47
|
-
let(:first_nav) { exhibit.main_navigations.first }
|
48
|
-
let(:last_nav) { exhibit.main_navigations.last }
|
49
|
-
let(:submitted) do
|
50
|
-
{
|
51
|
-
exhibit_id: exhibit,
|
52
|
-
exhibit: {
|
53
|
-
masthead_attributes: {
|
54
|
-
iiif_tilesource: 'http://test.host/1/foo',
|
55
|
-
iiif_region: '0,0,2000,200'
|
56
|
-
},
|
57
|
-
thumbnail_attributes: {
|
58
|
-
iiif_tilesource: 'http://test.host/2/foo',
|
59
|
-
iiif_region: '0,0,600,600'
|
60
|
-
},
|
61
|
-
main_navigations_attributes: main_navigation_attributes
|
62
|
-
}
|
63
|
-
}
|
64
|
-
end
|
65
|
-
let(:main_navigation_attributes) do
|
66
|
-
{
|
67
|
-
0 => { id: first_nav.id, label: 'Some Label', weight: 500 },
|
68
|
-
1 => { id: last_nav.id, display: false }
|
69
|
-
}
|
70
|
-
end
|
71
|
-
|
72
|
-
it 'updates the navigation' do
|
73
|
-
patch :update, params: submitted
|
74
|
-
expect(flash[:notice]).to eq 'The exhibit was successfully updated.'
|
75
|
-
expect(response).to redirect_to edit_exhibit_appearance_path(exhibit)
|
76
|
-
assigns[:exhibit].tap do |saved|
|
77
|
-
expect(saved.main_navigations.find(first_nav.id).label).to eq 'Some Label'
|
78
|
-
expect(saved.main_navigations.find(first_nav.id).weight).to eq 500
|
79
|
-
expect(saved.main_navigations.find(last_nav.id)).not_to be_displayable
|
80
|
-
expect(saved.masthead.iiif_tilesource).to eq 'http://test.host/1/foo'
|
81
|
-
expect(saved.thumbnail.iiif_region).to eq '0,0,600,600'
|
82
|
-
expect(saved.masthead.iiif_url).to eq 'http://test.host/1/foo/0,0,2000,200/1800,180/0/default.jpg'
|
83
|
-
expect(saved.thumbnail.iiif_url).to eq 'http://test.host/2/foo/0,0,600,600/400,400/0/default.jpg'
|
84
|
-
end
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|
88
|
-
end
|
@@ -1,11 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe Spotlight::ApplicationController, type: :controller do
|
4
|
-
routes { Spotlight::Engine.routes }
|
5
|
-
let(:exhibit) { FactoryBot.create(:exhibit) }
|
6
|
-
|
7
|
-
it 'provides a search_action_url override' do
|
8
|
-
allow(controller).to receive_messages(current_exhibit: exhibit)
|
9
|
-
expect(controller.search_action_url(q: 'query')).to eq search_exhibit_catalog_url(exhibit, q: 'query')
|
10
|
-
end
|
11
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe Spotlight::AttachmentsController, type: :controller do
|
4
|
-
routes { Spotlight::Engine.routes }
|
5
|
-
let(:exhibit) { FactoryBot.create(:exhibit) }
|
6
|
-
|
7
|
-
describe 'when not logged in' do
|
8
|
-
describe 'GET edit' do
|
9
|
-
it 'is successful' do
|
10
|
-
post :create, params: { exhibit_id: exhibit }
|
11
|
-
expect(response).to redirect_to main_app.new_user_session_path
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
describe 'when signed in as a curator' do
|
17
|
-
let(:user) { FactoryBot.create(:exhibit_curator, exhibit: exhibit) }
|
18
|
-
|
19
|
-
before { sign_in user }
|
20
|
-
|
21
|
-
describe 'POST create' do
|
22
|
-
it 'is successful' do
|
23
|
-
post :create, params: { exhibit_id: exhibit, attachment: { name: 'xyz' } }
|
24
|
-
expect(response).to be_successful
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
@@ -1,133 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe Spotlight::BrowseController, type: :controller do
|
4
|
-
routes { Spotlight::Engine.routes }
|
5
|
-
let(:exhibit) { FactoryBot.create(:exhibit) }
|
6
|
-
let!(:search) { FactoryBot.create(:published_search, exhibit: exhibit) }
|
7
|
-
let(:group) { FactoryBot.create(:group, published: true, title: 'Good group', exhibit: exhibit, searches: [search]) }
|
8
|
-
let(:group_unpublished) { FactoryBot.create(:group, title: 'Secret group', exhibit: exhibit, searches: [search]) }
|
9
|
-
let!(:unpublished) { FactoryBot.create(:search, exhibit: exhibit) }
|
10
|
-
let(:admin) { FactoryBot.create(:site_admin) }
|
11
|
-
|
12
|
-
describe 'protected methods' do
|
13
|
-
it 'uses the blacklight.browse configuration for the document actions when additional configuration layers are not defined' do
|
14
|
-
expect(controller).to receive(:view_available?).and_return true
|
15
|
-
expect(controller.send(:document_index_view_type)).to equal :gallery
|
16
|
-
end
|
17
|
-
|
18
|
-
it 'uses the blacklight_config view configuration when there are no params' do
|
19
|
-
allow(controller).to receive(:current_exhibit).and_return exhibit
|
20
|
-
expect(controller).to receive(:view_available?).and_return false
|
21
|
-
expect(controller.send(:document_index_view_type)).to equal :list
|
22
|
-
end
|
23
|
-
|
24
|
-
it 'returns document_index_view_type from a search object' do
|
25
|
-
allow(controller).to receive(:current_exhibit).and_return exhibit
|
26
|
-
expect(controller).to receive(:view_available?).and_return true
|
27
|
-
search.default_index_view_type = 'gallery'
|
28
|
-
controller.instance_variable_set(:@search, search)
|
29
|
-
expect(controller.send(:default_document_index_view_type)).to equal :gallery
|
30
|
-
end
|
31
|
-
|
32
|
-
it 'returns default_document_index_view_type from super when there is no view available' do
|
33
|
-
allow(controller).to receive(:current_exhibit).and_return exhibit
|
34
|
-
expect(controller).to receive(:view_available?).and_return false
|
35
|
-
expect(controller.send(:default_document_index_view_type)).to equal :list
|
36
|
-
end
|
37
|
-
|
38
|
-
it 'returns the default_browse_index_view_type from exhibit configuration' do
|
39
|
-
allow(controller).to receive(:current_exhibit).and_return exhibit
|
40
|
-
expect(controller.send(:default_browse_index_view_type)).to equal :gallery
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
describe 'when authenticated as an admin' do
|
45
|
-
before { sign_in admin }
|
46
|
-
|
47
|
-
describe 'GET index' do
|
48
|
-
it 'does not show unpublished categories' do
|
49
|
-
expect(controller).to receive(:add_breadcrumb).with('Home', exhibit)
|
50
|
-
expect(controller).to receive(:add_breadcrumb).with('Browse', exhibit_browse_index_path(exhibit))
|
51
|
-
get :index, params: { exhibit_id: exhibit }
|
52
|
-
expect(response).to be_successful
|
53
|
-
expect(assigns[:searches]).to eq [search]
|
54
|
-
expect(assigns[:searches]).not_to include unpublished
|
55
|
-
expect(assigns[:exhibit]).to eq exhibit
|
56
|
-
expect(response).to render_template 'spotlight/browse/index'
|
57
|
-
end
|
58
|
-
|
59
|
-
it 'includes the browse groups' do
|
60
|
-
expect(controller).to receive(:add_breadcrumb).with('Home', exhibit)
|
61
|
-
expect(controller).to receive(:add_breadcrumb).with('Browse', exhibit_browse_index_path(exhibit))
|
62
|
-
expect(controller).to receive(:add_breadcrumb).with('Good group', exhibit_browse_groups_path(exhibit, group))
|
63
|
-
get :index, params: { exhibit_id: exhibit, group_id: group.id }
|
64
|
-
expect(response).to be_successful
|
65
|
-
expect(assigns[:groups]).to eq [group]
|
66
|
-
expect(response).to render_template 'spotlight/browse/index'
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
describe 'when unauthenticated' do
|
72
|
-
describe 'GET index' do
|
73
|
-
it 'shows the list of browse categories' do
|
74
|
-
expect(controller).to receive(:add_breadcrumb).with('Home', exhibit)
|
75
|
-
expect(controller).to receive(:add_breadcrumb).with('Browse', exhibit_browse_index_path(exhibit))
|
76
|
-
get :index, params: { exhibit_id: exhibit }
|
77
|
-
expect(response).to be_successful
|
78
|
-
expect(assigns[:searches]).to eq [search]
|
79
|
-
expect(assigns[:searches]).not_to include unpublished
|
80
|
-
expect(assigns[:exhibit]).to eq exhibit
|
81
|
-
expect(response).to render_template 'spotlight/browse/index'
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
describe 'GET show' do
|
86
|
-
let(:mock_response) { double aggregations: {} }
|
87
|
-
let(:document_list) { double }
|
88
|
-
|
89
|
-
before do
|
90
|
-
allow(controller).to receive_messages(search_service: double(search_results: [mock_response, document_list]))
|
91
|
-
end
|
92
|
-
|
93
|
-
it 'shows the items in the category' do
|
94
|
-
expect(controller).to receive(:add_breadcrumb).with('Home', exhibit)
|
95
|
-
expect(controller).to receive(:add_breadcrumb).with('Browse', exhibit_browse_index_path(exhibit))
|
96
|
-
expect(controller).to receive(:add_breadcrumb).with(search.title, exhibit_browse_path(exhibit, search))
|
97
|
-
get :show, params: { id: search, exhibit_id: exhibit }
|
98
|
-
expect(response).to be_successful
|
99
|
-
expect(assigns[:search]).to be_a Spotlight::Search
|
100
|
-
expect(assigns[:response]).to eq mock_response
|
101
|
-
expect(assigns[:document_list]).to eq document_list
|
102
|
-
expect(response).to render_template 'spotlight/browse/show'
|
103
|
-
end
|
104
|
-
|
105
|
-
it 'includes the browse group when a group_id is provided' do
|
106
|
-
expect(controller).to receive(:add_breadcrumb).with('Home', exhibit)
|
107
|
-
expect(controller).to receive(:add_breadcrumb).with('Browse', exhibit_browse_index_path(exhibit))
|
108
|
-
expect(controller).to receive(:add_breadcrumb).with('Good group', exhibit_browse_groups_path(exhibit, group))
|
109
|
-
expect(controller).to receive(:add_breadcrumb).with(search.title, exhibit_browse_group_path(exhibit, group, search))
|
110
|
-
get :show, params: { id: search, exhibit_id: exhibit, group_id: group.id }
|
111
|
-
expect(response).to be_successful
|
112
|
-
expect(assigns[:group]).to eq group
|
113
|
-
expect(response).to render_template 'spotlight/browse/show'
|
114
|
-
end
|
115
|
-
|
116
|
-
it 'removes all the document actions' do
|
117
|
-
get :show, params: { id: search, exhibit_id: exhibit }
|
118
|
-
expect(controller.blacklight_config.index.document_actions).to be_blank
|
119
|
-
end
|
120
|
-
|
121
|
-
it 'uses the blacklight.browse configuration for the document actions' do
|
122
|
-
config = Blacklight::Configuration.new do |c|
|
123
|
-
c.browse.document_actions = %i[a b c]
|
124
|
-
end
|
125
|
-
|
126
|
-
allow(controller).to receive(:blacklight_config).and_return(config)
|
127
|
-
|
128
|
-
get :show, params: { id: search, exhibit_id: exhibit }
|
129
|
-
expect(controller.blacklight_config.index.document_actions).to match_array %i[a b c]
|
130
|
-
end
|
131
|
-
end
|
132
|
-
end
|
133
|
-
end
|