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,196 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe Spotlight::ApplicationHelper, type: :helper do
|
4
|
-
describe '#application_name' do
|
5
|
-
let(:site) { Spotlight::Site.instance }
|
6
|
-
|
7
|
-
before do
|
8
|
-
allow(helper).to receive(:current_site).and_return(site)
|
9
|
-
end
|
10
|
-
|
11
|
-
it 'includes the exhibit' do
|
12
|
-
allow(helper).to receive_messages(current_exhibit: double(title: 'My Exhibit'))
|
13
|
-
expect(helper.application_name).to eq 'My Exhibit - Blacklight'
|
14
|
-
end
|
15
|
-
|
16
|
-
it "is just the application name if there isn't an exhibit" do
|
17
|
-
allow(helper).to receive_messages(current_exhibit: nil)
|
18
|
-
expect(helper.application_name).to eq 'Blacklight'
|
19
|
-
end
|
20
|
-
|
21
|
-
context 'with a configured site title' do
|
22
|
-
before do
|
23
|
-
site.title = 'Some Title'
|
24
|
-
allow(helper).to receive_messages(current_exhibit: nil)
|
25
|
-
end
|
26
|
-
|
27
|
-
it 'uses the configured name' do
|
28
|
-
expect(helper.application_name).to eq 'Some Title'
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
describe '#site_title' do
|
34
|
-
let(:site) { Spotlight::Site.instance }
|
35
|
-
|
36
|
-
before do
|
37
|
-
allow(helper).to receive(:current_site).and_return(site)
|
38
|
-
end
|
39
|
-
|
40
|
-
context 'with a configured site title' do
|
41
|
-
before do
|
42
|
-
site.title = 'Some Title'
|
43
|
-
end
|
44
|
-
|
45
|
-
it 'uses the configured name' do
|
46
|
-
expect(helper.site_title).to eq 'Some Title'
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
context 'without a configured site title' do
|
51
|
-
it 'is nil' do
|
52
|
-
expect(helper.site_title).to be_nil
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
describe '#url_to_tag_facet' do
|
58
|
-
before do
|
59
|
-
allow(helper).to receive_messages(current_exhibit: FactoryBot.create(:exhibit))
|
60
|
-
allow(helper).to receive_messages(blacklight_config: Blacklight::Configuration.new)
|
61
|
-
|
62
|
-
# controller provided helper.
|
63
|
-
allow(helper).to receive(:search_action_url) do |*args|
|
64
|
-
spotlight.search_exhibit_catalog_path(helper.current_exhibit, *args)
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
it 'is a url for a search with the given tag facet' do
|
69
|
-
expected = spotlight.search_exhibit_catalog_path(exhibit_id: helper.current_exhibit, f: { exhibit_tags: ['tag_value'] })
|
70
|
-
expect(helper.url_to_tag_facet('tag_value')).to eq expected
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
describe 'search block helpers' do
|
75
|
-
describe 'selected_search_block_views' do
|
76
|
-
let(:block) do
|
77
|
-
SirTrevorRails::Block.new({ type: 'xyz', data: { a: 'on', b: 'off', c: false, d: 'on' } }, 'parent')
|
78
|
-
end
|
79
|
-
|
80
|
-
it "returns keys with a value of 'on'" do
|
81
|
-
expect(helper.selected_search_block_views(block)).to eq %w[a d]
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
describe 'blacklight_view_config_for_search_block' do
|
86
|
-
let(:sir_trevor_block) do
|
87
|
-
SirTrevorRails::Block.new({ type: 'xyz', data: { view: %w[list gallery] } }, 'parent')
|
88
|
-
end
|
89
|
-
|
90
|
-
let(:config) do
|
91
|
-
Blacklight::Configuration.new do |config|
|
92
|
-
config.view.list = {}
|
93
|
-
config.view.gallery = {}
|
94
|
-
config.view.slideshow = {}
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
before do
|
99
|
-
allow(helper).to receive_messages(blacklight_config: config)
|
100
|
-
end
|
101
|
-
|
102
|
-
it 'returns a blacklight configuration object that has reduced the views to those that are configured in the block' do
|
103
|
-
new_config = helper.blacklight_view_config_for_search_block(sir_trevor_block)
|
104
|
-
expect(new_config.keys).to eq %i[list gallery]
|
105
|
-
end
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
|
-
describe 'render_document_class' do
|
110
|
-
let(:current_exhibit) { FactoryBot.create(:exhibit) }
|
111
|
-
let(:document) { SolrDocument.new(some_field: 'Some data') }
|
112
|
-
|
113
|
-
before do
|
114
|
-
allow(helper).to receive_messages(current_exhibit: current_exhibit)
|
115
|
-
allow(helper).to receive_messages(blacklight_config: Blacklight::Configuration.new do |config|
|
116
|
-
config.show.display_type_field = :some_field # Blacklight 7.4+
|
117
|
-
config.index.display_type_field = :some_field # pre Blacklight 7.4
|
118
|
-
end)
|
119
|
-
end
|
120
|
-
|
121
|
-
it 'returns blacklight-private when the document is private' do
|
122
|
-
allow(document).to receive(:private?).with(current_exhibit).and_return(true)
|
123
|
-
expect(helper.render_document_class(document)).to include 'blacklight-private'
|
124
|
-
end
|
125
|
-
|
126
|
-
it 'prefixs "blacklight-" to the configured type' do
|
127
|
-
expect(helper.render_document_class(document)).to include 'blacklight-some-data'
|
128
|
-
end
|
129
|
-
end
|
130
|
-
|
131
|
-
describe '#uploaded_field_label' do
|
132
|
-
let(:field) { OpenStruct.new field_name: 'x' }
|
133
|
-
let(:blacklight_config) { Blacklight::Configuration.new }
|
134
|
-
|
135
|
-
before do
|
136
|
-
allow(helper).to receive_messages(blacklight_config: blacklight_config)
|
137
|
-
end
|
138
|
-
|
139
|
-
it 'uses the configuration-provided label' do
|
140
|
-
field.label = 'label x'
|
141
|
-
expect(helper.uploaded_field_label(field)).to eq 'label x'
|
142
|
-
end
|
143
|
-
|
144
|
-
it 'pulls the label from the solr field' do
|
145
|
-
blacklight_config.add_index_field 'x', label: 'solr x'
|
146
|
-
expect(helper.uploaded_field_label(field)).to eq 'solr x'
|
147
|
-
end
|
148
|
-
end
|
149
|
-
|
150
|
-
describe '#available_view_fields' do
|
151
|
-
let(:blacklight_config) { Blacklight::Configuration.new }
|
152
|
-
|
153
|
-
before do
|
154
|
-
allow(helper).to receive_message_chain(:current_exhibit, :blacklight_configuration, default_blacklight_config: blacklight_config)
|
155
|
-
end
|
156
|
-
|
157
|
-
it 'excludes view fields that are never visible (e.g. atom, rss)' do
|
158
|
-
blacklight_config.view.a(if: true)
|
159
|
-
blacklight_config.view.b(if: false)
|
160
|
-
|
161
|
-
expect(helper.available_view_fields).to include :a
|
162
|
-
expect(helper.available_view_fields).not_to include :b
|
163
|
-
end
|
164
|
-
end
|
165
|
-
|
166
|
-
describe '#block_document_index_view_type' do
|
167
|
-
let(:blacklight_config) { Blacklight::Configuration.new }
|
168
|
-
let(:block) { double(view: %w[b c]) }
|
169
|
-
let(:block_with_bad_or_missing_data) { double(view: []) }
|
170
|
-
|
171
|
-
before do
|
172
|
-
# clean out the default views
|
173
|
-
blacklight_config.view.reject! { |_| true }
|
174
|
-
|
175
|
-
blacklight_config.view.a!
|
176
|
-
blacklight_config.view.b!
|
177
|
-
blacklight_config.view.c!
|
178
|
-
allow(helper).to receive(:blacklight_config).and_return(blacklight_config)
|
179
|
-
end
|
180
|
-
|
181
|
-
it 'selects the users chosen view' do
|
182
|
-
allow(helper).to receive(:document_index_view_type).and_return(:c)
|
183
|
-
expect(helper.block_document_index_view_type(block)).to eq :c
|
184
|
-
end
|
185
|
-
|
186
|
-
it 'defaults to the first available blacklight views' do
|
187
|
-
allow(helper).to receive(:document_index_view_type).and_return(:a)
|
188
|
-
expect(helper.block_document_index_view_type(block)).to eq :b
|
189
|
-
end
|
190
|
-
|
191
|
-
it 'falls back to the original default view' do
|
192
|
-
allow(helper).to receive(:document_index_view_type).and_return(:value_not_present)
|
193
|
-
expect(helper.block_document_index_view_type(block_with_bad_or_missing_data)).to eq :a
|
194
|
-
end
|
195
|
-
end
|
196
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe Spotlight::BrowseHelper, type: :helper do
|
4
|
-
it 'defaults to the gallery' do
|
5
|
-
allow(helper).to receive_messages(blacklight_config: double(view: { gallery: true }))
|
6
|
-
expect(helper.default_document_index_view_type).to eq :gallery
|
7
|
-
end
|
8
|
-
|
9
|
-
it "uses the blacklight default if gallery isn't available" do
|
10
|
-
allow(helper).to receive_messages(blacklight_config: double(view: { list: true }))
|
11
|
-
expect(helper.default_document_index_view_type).to eq :list
|
12
|
-
end
|
13
|
-
end
|
@@ -1,11 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe Spotlight::CropHelper do
|
4
|
-
describe '#form_prefix' do
|
5
|
-
let(:form) { double(object_name: 'Spotlight::Exhibit') }
|
6
|
-
|
7
|
-
it 'parameterizes the form object' do
|
8
|
-
expect(helper.form_prefix(form)).to eq 'spotlight_exhibit'
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
@@ -1,163 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe Spotlight::CrudLinkHelpers, type: :helper do
|
4
|
-
let(:exhibit) { FactoryBot.create(:exhibit) }
|
5
|
-
let(:some_model) { Spotlight::FeaturePage.create! exhibit: exhibit }
|
6
|
-
|
7
|
-
describe '#cancel_link' do
|
8
|
-
it 'is a model-specific cancel link' do
|
9
|
-
expect(helper).to receive(:action_default_value).with(:my_model, :cancel).and_return 'Cancel'
|
10
|
-
expect(helper.cancel_link(:my_model, '#')).to have_link 'Cancel', href: '#'
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
describe '#exhibit_view_link' do
|
15
|
-
before do
|
16
|
-
allow(helper).to receive_messages action_default_value: 'View'
|
17
|
-
end
|
18
|
-
|
19
|
-
it 'is a model-specific view link' do
|
20
|
-
expect(helper).to receive(:action_default_value).with(some_model, :view).and_return 'View'
|
21
|
-
expect(helper.exhibit_view_link(some_model)).to have_link 'View', href: spotlight.exhibit_feature_page_path(some_model.exhibit, some_model)
|
22
|
-
end
|
23
|
-
|
24
|
-
it 'accepts an explicit link' do
|
25
|
-
expect(helper.exhibit_view_link(some_model, '#')).to have_link 'View', href: '#'
|
26
|
-
end
|
27
|
-
|
28
|
-
it 'accepts link_to options' do
|
29
|
-
expect(helper.exhibit_view_link(some_model, '#', class: 'btn')).to have_selector 'a.btn'
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
describe '#exhibit_create_link' do
|
34
|
-
let(:some_model) { Spotlight::FeaturePage.new }
|
35
|
-
|
36
|
-
before do
|
37
|
-
allow(helper).to receive_messages(current_exhibit: exhibit)
|
38
|
-
allow(helper).to receive_messages action_default_value: 'Create'
|
39
|
-
end
|
40
|
-
|
41
|
-
it 'is a model-specific view link' do
|
42
|
-
expect(helper).to receive(:action_default_value).with(some_model).and_return 'Create'
|
43
|
-
expect(helper.exhibit_create_link(some_model)).to have_link 'Create', href: spotlight.new_exhibit_feature_page_path(exhibit)
|
44
|
-
end
|
45
|
-
|
46
|
-
it 'accepts an explicit link' do
|
47
|
-
expect(helper.exhibit_create_link(some_model, '#')).to have_link 'Create', href: '#'
|
48
|
-
end
|
49
|
-
|
50
|
-
it 'accepts link_to options' do
|
51
|
-
expect(helper.exhibit_create_link(some_model, '#', class: 'btn')).to have_selector 'a.btn'
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
describe '#exhibit_edit_link' do
|
56
|
-
let(:some_model) { Spotlight::FeaturePage.create! exhibit: exhibit }
|
57
|
-
|
58
|
-
before do
|
59
|
-
allow(helper).to receive_messages(current_exhibit: exhibit)
|
60
|
-
allow(helper).to receive_messages action_default_value: 'Edit'
|
61
|
-
end
|
62
|
-
|
63
|
-
it 'is a model-specific edit link' do
|
64
|
-
expect(helper).to receive(:action_default_value).with(some_model).and_return 'Edit'
|
65
|
-
expect(helper.exhibit_edit_link(some_model)).to have_link 'Edit', href: spotlight.edit_exhibit_feature_page_path(exhibit, some_model)
|
66
|
-
end
|
67
|
-
|
68
|
-
it 'accepts an explicit link' do
|
69
|
-
expect(helper.exhibit_edit_link(some_model, '#')).to have_link 'Edit', href: '#'
|
70
|
-
end
|
71
|
-
|
72
|
-
it 'accepts link_to options' do
|
73
|
-
expect(helper.exhibit_edit_link(some_model, '#', class: 'btn')).to have_selector 'a.btn'
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
describe '#exhibit_delete_link' do
|
78
|
-
before do
|
79
|
-
allow(helper).to receive_messages action_default_value: 'Delete'
|
80
|
-
end
|
81
|
-
|
82
|
-
it 'is a model-specific view link' do
|
83
|
-
expect(helper).to receive(:action_default_value).with(some_model, :destroy).and_return 'Delete'
|
84
|
-
expect(helper.exhibit_delete_link(some_model)).to have_link 'Delete', href: spotlight.exhibit_feature_page_path(some_model.exhibit, some_model)
|
85
|
-
end
|
86
|
-
|
87
|
-
it 'accepts an explicit link' do
|
88
|
-
expect(helper.exhibit_delete_link(some_model, '#')).to have_link 'Delete', href: '#'
|
89
|
-
end
|
90
|
-
|
91
|
-
it 'accepts link_to options' do
|
92
|
-
expect(helper.exhibit_delete_link(some_model, '#', class: 'btn')).to have_selector 'a.btn'
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
describe '#action_label' do
|
97
|
-
it 'returns the label for an action on a model' do
|
98
|
-
some_model = double
|
99
|
-
expect(helper).to receive(:action_default_value).with(some_model, :action).and_return 'xyz'
|
100
|
-
expect(helper.action_label(some_model, :action)).to eq 'xyz'
|
101
|
-
end
|
102
|
-
end
|
103
|
-
|
104
|
-
describe '#action_default_value' do
|
105
|
-
it 'attempts i18n lookups for models' do
|
106
|
-
expect(I18n).to receive(:t).with(:'helpers.action.spotlight/feature_page.edit',
|
107
|
-
model: some_model.class.model_name.human.downcase,
|
108
|
-
default: [:'helpers.action.edit', 'Edit Feature page'])
|
109
|
-
expect(helper.send(:action_default_value, some_model))
|
110
|
-
end
|
111
|
-
|
112
|
-
it 'attempts i18n lookups for unpersisted models' do
|
113
|
-
some_model = Spotlight::FeaturePage.new
|
114
|
-
expect(I18n).to receive(:t).with(:'helpers.action.spotlight/feature_page.create',
|
115
|
-
model: some_model.class.model_name.human.downcase,
|
116
|
-
default: [:'helpers.action.create', 'Create Feature page'])
|
117
|
-
expect(helper.send(:action_default_value, some_model))
|
118
|
-
end
|
119
|
-
|
120
|
-
it 'attempts i18n lookups for models with an explicit action' do
|
121
|
-
expect(I18n).to receive(:t).with(:'helpers.action.spotlight/feature_page.custom_action',
|
122
|
-
model: some_model.class.model_name.human.downcase,
|
123
|
-
default: [:'helpers.action.custom_action', 'Custom action Feature page'])
|
124
|
-
expect(helper.send(:action_default_value, some_model, :custom_action))
|
125
|
-
end
|
126
|
-
|
127
|
-
it 'attempts i18n lookups for symbols' do
|
128
|
-
expect(I18n).to receive(:t).with(:'helpers.action.my_thing.custom_action',
|
129
|
-
model: :my_thing,
|
130
|
-
default: [:'helpers.action.custom_action', 'Custom action my_thing'])
|
131
|
-
expect(helper.send(:action_default_value, :my_thing, :custom_action))
|
132
|
-
end
|
133
|
-
end
|
134
|
-
|
135
|
-
describe '#nav_link' do
|
136
|
-
it 'renders a bootstrap nav link' do
|
137
|
-
rendered = Capybara.string(helper.nav_link('Some link', root_url))
|
138
|
-
expect(rendered).to have_css('li').and(have_link('Some link', href: root_url))
|
139
|
-
end
|
140
|
-
|
141
|
-
it 'renders a bootstrap nav link using the block style' do
|
142
|
-
rendered = Capybara.string(helper.nav_link(root_url) { 'Some link' })
|
143
|
-
expect(rendered).to have_css('li').and(have_link('Some link', href: root_url))
|
144
|
-
end
|
145
|
-
|
146
|
-
it 'adds an active class if it is the current page' do
|
147
|
-
allow(helper).to receive(:current_page?).with(root_url).and_return(true)
|
148
|
-
|
149
|
-
rendered = Capybara.string(helper.nav_link('Some link', root_url))
|
150
|
-
expect(rendered).to have_css('.nav-link.active')
|
151
|
-
end
|
152
|
-
|
153
|
-
it 'accepts an active argument to toggle the active class without regard for the current page' do
|
154
|
-
rendered = Capybara.string(helper.nav_link('Some link', root_url, active: true))
|
155
|
-
expect(rendered).to have_css('.nav-link.active')
|
156
|
-
|
157
|
-
allow(helper).to receive(:current_page?).with(root_url).and_return(true)
|
158
|
-
|
159
|
-
rendered = Capybara.string(helper.nav_link('Some link', root_url, active: false))
|
160
|
-
expect(rendered).not_to have_css('.nav-link.active')
|
161
|
-
end
|
162
|
-
end
|
163
|
-
end
|
@@ -1,79 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe Spotlight::LanguagesHelper, type: :helper do
|
4
|
-
let(:current_exhibit) { FactoryBot.create(:exhibit) }
|
5
|
-
|
6
|
-
describe '#add_exhibit_language_dropdown_options' do
|
7
|
-
it 'returns a sorted Array of locales and their names' do
|
8
|
-
allow(helper).to receive_messages(current_exhibit: current_exhibit)
|
9
|
-
expect(helper.add_exhibit_language_dropdown_options).to match_array(
|
10
|
-
[
|
11
|
-
['Albanian', :sq],
|
12
|
-
['Arabic', :ar],
|
13
|
-
['Chinese', :zh],
|
14
|
-
['Dutch', :nl],
|
15
|
-
['French', :fr],
|
16
|
-
['German', :de],
|
17
|
-
['Hungarian', :hu],
|
18
|
-
['Italian', :it],
|
19
|
-
['Portuguese - Brazil', :'pt-BR'],
|
20
|
-
['Spanish', :es]
|
21
|
-
]
|
22
|
-
)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
describe '#locale_selecter_dropown_options' do
|
27
|
-
before do
|
28
|
-
allow(helper).to receive_messages(current_ability: Ability.new(nil))
|
29
|
-
allow(helper).to receive_messages(current_exhibit: current_exhibit)
|
30
|
-
|
31
|
-
current_exhibit.languages = [
|
32
|
-
FactoryBot.create(:language, public: true, locale: 'es'),
|
33
|
-
FactoryBot.create(:language, public: true, locale: 'de')
|
34
|
-
]
|
35
|
-
current_exhibit.save
|
36
|
-
end
|
37
|
-
|
38
|
-
it 'includes the default locale (when it is not current)' do
|
39
|
-
allow(I18n).to receive(:locale).and_return(:es)
|
40
|
-
expect(helper.locale_selecter_dropown_options.last).to be_a(Spotlight::Language)
|
41
|
-
expect(helper.locale_selecter_dropown_options.last).not_to be_persisted
|
42
|
-
expect(helper.locale_selecter_dropown_options.last.locale).to eq 'en'
|
43
|
-
end
|
44
|
-
|
45
|
-
it 'does not include the current locale' do
|
46
|
-
expect(
|
47
|
-
helper.locale_selecter_dropown_options.map(&:locale)
|
48
|
-
).not_to include(I18n.locale.to_s)
|
49
|
-
end
|
50
|
-
|
51
|
-
it 'sorts by the native translation' do
|
52
|
-
allow(I18n).to receive(:locale).and_return(:it)
|
53
|
-
|
54
|
-
expect(
|
55
|
-
helper.locale_selecter_dropown_options.map(&:to_native)
|
56
|
-
).to eq %w[Deutsch English Español]
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
describe '#default_language?' do
|
61
|
-
context 'when using default locale' do
|
62
|
-
it do
|
63
|
-
expect(helper.default_language?).to eq true
|
64
|
-
end
|
65
|
-
|
66
|
-
it do
|
67
|
-
expect(helper).to receive_messages(params: { locale: :en })
|
68
|
-
expect(helper.default_language?).to eq true
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
context 'when using a different locale' do
|
73
|
-
it do
|
74
|
-
expect(helper).to receive_messages(params: { locale: :it })
|
75
|
-
expect(helper.default_language?).to eq false
|
76
|
-
end
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|
@@ -1,101 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe Spotlight::MainAppHelpers, type: :helper do
|
4
|
-
describe '#show_contact_form?' do
|
5
|
-
subject { helper }
|
6
|
-
|
7
|
-
let(:exhibit) { FactoryBot.create :exhibit }
|
8
|
-
let(:exhibit_with_contacts) { FactoryBot.create :exhibit }
|
9
|
-
|
10
|
-
context 'with an exhibit with confirmed contacts' do
|
11
|
-
before do
|
12
|
-
exhibit_with_contacts.contact_emails.create(email: 'cabeer@stanford.edu').tap do |e|
|
13
|
-
if e.respond_to? :confirm
|
14
|
-
e.confirm
|
15
|
-
else
|
16
|
-
e.confirm!
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
before { allow(helper).to receive_messages current_exhibit: exhibit_with_contacts }
|
22
|
-
|
23
|
-
its(:show_contact_form?) { is_expected.to be_truthy }
|
24
|
-
end
|
25
|
-
|
26
|
-
context 'with an exhibit with only unconfirmed contacts' do
|
27
|
-
before { exhibit_with_contacts.contact_emails.build email: 'cabeer@stanford.edu' }
|
28
|
-
|
29
|
-
before { allow(helper).to receive_messages current_exhibit: exhibit_with_contacts }
|
30
|
-
|
31
|
-
its(:show_contact_form?) { is_expected.to be_falsey }
|
32
|
-
end
|
33
|
-
|
34
|
-
context 'with an exhibit without contacts' do
|
35
|
-
before { allow(helper).to receive_messages current_exhibit: exhibit }
|
36
|
-
|
37
|
-
its(:show_contact_form?) { is_expected.to be_falsey }
|
38
|
-
end
|
39
|
-
|
40
|
-
context 'outside the context of an exhibit' do
|
41
|
-
before { allow(helper).to receive_messages current_exhibit: nil }
|
42
|
-
|
43
|
-
its(:show_contact_form?) { is_expected.to be_falsey }
|
44
|
-
end
|
45
|
-
|
46
|
-
context 'with a default contact address' do
|
47
|
-
before { allow(Spotlight::Engine.config).to receive_messages default_contact_email: 'root@localhost' }
|
48
|
-
|
49
|
-
before { allow(helper).to receive_messages current_exhibit: exhibit }
|
50
|
-
|
51
|
-
its(:show_contact_form?) { is_expected.to be_truthy }
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
describe '#exhibit_stylesheet_link_tag' do
|
56
|
-
let(:exhibit) { FactoryBot.create(:exhibit) }
|
57
|
-
|
58
|
-
before do
|
59
|
-
allow(helper).to receive_messages(current_exhibit: exhibit)
|
60
|
-
end
|
61
|
-
|
62
|
-
context 'without an exhibit context' do
|
63
|
-
let(:exhibit) { nil }
|
64
|
-
|
65
|
-
it 'uses the standard stylesheet' do
|
66
|
-
expect(helper.exhibit_stylesheet_link_tag('application')).to eq helper.stylesheet_link_tag('application')
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
context 'for an exhibit without a selected theme' do
|
71
|
-
before do
|
72
|
-
exhibit.update(theme: nil)
|
73
|
-
end
|
74
|
-
|
75
|
-
it 'uses the standard stylesheet' do
|
76
|
-
expect(helper.exhibit_stylesheet_link_tag('application')).to eq helper.stylesheet_link_tag('application')
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
context 'for an exhibit with an invalid theme' do
|
81
|
-
before do
|
82
|
-
exhibit.update(theme: 'garbage')
|
83
|
-
end
|
84
|
-
|
85
|
-
it 'uses the standard stylesheet' do
|
86
|
-
expect(helper.exhibit_stylesheet_link_tag('application')).to eq helper.stylesheet_link_tag('application')
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
context 'for a themed exhibit' do
|
91
|
-
before do
|
92
|
-
allow(Spotlight::Engine.config).to receive(:exhibit_themes).and_return(%w[default modern])
|
93
|
-
exhibit.update(theme: 'modern')
|
94
|
-
end
|
95
|
-
|
96
|
-
it 'uses a suffixed stylesheet name' do
|
97
|
-
expect(helper.exhibit_stylesheet_link_tag('application')).to eq helper.stylesheet_link_tag('application_modern')
|
98
|
-
end
|
99
|
-
end
|
100
|
-
end
|
101
|
-
end
|
@@ -1,51 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe Spotlight::MastheadHelper, type: :helper do
|
4
|
-
let(:exhibit) { FactoryBot.create(:exhibit) }
|
5
|
-
let(:site) { Spotlight::Site.instance }
|
6
|
-
|
7
|
-
before do
|
8
|
-
allow(helper).to receive(:current_exhibit).and_return(nil)
|
9
|
-
allow(helper).to receive(:current_site).and_return(site)
|
10
|
-
end
|
11
|
-
|
12
|
-
describe '#masthead_heading_content' do
|
13
|
-
context 'when there is a current exhibit' do
|
14
|
-
before { allow(helper).to receive(:current_exhibit).and_return(exhibit) }
|
15
|
-
|
16
|
-
it { expect(helper.masthead_heading_content).to eq exhibit.title }
|
17
|
-
end
|
18
|
-
|
19
|
-
context 'when there is no current exhibit' do
|
20
|
-
it { expect(helper.masthead_heading_content).to eq 'Blacklight' } # the application_name
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
describe '#masthead_subheading_content' do
|
25
|
-
context 'when there is a current exhibit' do
|
26
|
-
before { allow(helper).to receive(:current_exhibit).and_return(exhibit) }
|
27
|
-
|
28
|
-
context 'when the exhibit has a subtitle' do
|
29
|
-
before { exhibit.subtitle = 'MastheadHelper Spec Exhibit' }
|
30
|
-
|
31
|
-
it { expect(helper.masthead_subheading_content).to eq 'MastheadHelper Spec Exhibit' }
|
32
|
-
end
|
33
|
-
|
34
|
-
context 'when the exhibit does not have a subtitle' do
|
35
|
-
it { expect(helper.masthead_subheading_content).to be_nil }
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
context 'when there is no current exhibit' do
|
40
|
-
context 'when the site has a subtitle' do
|
41
|
-
before { site.subtitle = "The site's subtitle" }
|
42
|
-
|
43
|
-
it { expect(helper.masthead_subheading_content).to eq "The site's subtitle" }
|
44
|
-
end
|
45
|
-
|
46
|
-
context 'when the site does not have a subtitle' do
|
47
|
-
it { expect(helper.masthead_subheading_content).to be_nil }
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
@@ -1,33 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe Spotlight::MetaHelper, type: :helper do
|
4
|
-
describe '#add_exhibit_meta_content' do
|
5
|
-
let(:current_exhibit) { FactoryBot.create(:exhibit) }
|
6
|
-
|
7
|
-
before do
|
8
|
-
allow(helper).to receive_messages(current_exhibit: current_exhibit)
|
9
|
-
allow(helper).to receive(:site_title).and_return('some title')
|
10
|
-
current_exhibit.subtitle = 'xyz'
|
11
|
-
current_exhibit.description = 'abc'
|
12
|
-
TopHat.current['twitter_card'] = nil
|
13
|
-
TopHat.current['opengraph'] = nil
|
14
|
-
end
|
15
|
-
|
16
|
-
it 'generates a twitter card for the exhibit' do
|
17
|
-
allow(helper).to receive(:exhibit_root_url).and_return('some/url')
|
18
|
-
allow(current_exhibit).to receive(:thumbnail).and_return(double(iiif_url: 'https://test.host/images/7777/full/400,300/0/default.jpg'))
|
19
|
-
|
20
|
-
helper.add_exhibit_meta_content
|
21
|
-
|
22
|
-
card = helper.twitter_card
|
23
|
-
expect(card).to have_css "meta[name='twitter:card'][value='summary']", visible: false
|
24
|
-
expect(card).to have_css "meta[name='twitter:url'][value='some/url']", visible: false
|
25
|
-
expect(card).to have_css "meta[name='twitter:title'][value='#{current_exhibit.title}']", visible: false
|
26
|
-
expect(card).to have_css "meta[name='twitter:description'][value='#{current_exhibit.subtitle}']", visible: false
|
27
|
-
expect(card).to have_css "meta[name='twitter:image'][value='https://test.host/images/7777/full/400,300/0/default.jpg']", visible: false
|
28
|
-
|
29
|
-
graph = helper.opengraph
|
30
|
-
expect(graph).to have_css "meta[property='og:site_name'][content='some title']", visible: false
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|