blacklight-spotlight 3.4.0 → 3.4.2.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 -579
- 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/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/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,42 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe SirTrevorRails::Blocks::BrowseBlock do
|
4
|
-
subject { described_class.new({ type: '', data: block_data }, page) }
|
5
|
-
|
6
|
-
let(:page) { FactoryBot.create(:feature_page) }
|
7
|
-
let(:block_data) { {} }
|
8
|
-
|
9
|
-
describe '#items' do
|
10
|
-
it 'is the array of items with display set to true' do
|
11
|
-
block_data[:item] = {
|
12
|
-
'0': { id: 'abc123', display: 'true' },
|
13
|
-
'1': { id: 'xyz321', display: 'false' }
|
14
|
-
}
|
15
|
-
expect(subject.items.length).to eq 1
|
16
|
-
expect(subject.items).to eq([{ id: 'abc123', display: 'true' }])
|
17
|
-
end
|
18
|
-
|
19
|
-
it 'is an empty array when there is no browse category' do
|
20
|
-
expect(subject.items).to eq([])
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
describe '#as_json' do
|
25
|
-
context 'when no items are present' do
|
26
|
-
it 'returns an empty items value' do
|
27
|
-
block_data[:item] = nil
|
28
|
-
expect(subject.as_json[:data]).to include item: {}
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
context 'when the id of a browse category does not exist' do
|
33
|
-
it 'is not included the returned items hash' do
|
34
|
-
search = FactoryBot.create(:search, exhibit: page.exhibit)
|
35
|
-
block_data[:item] = { item_0: { 'id' => 'abc123' }, item_1: { 'id' => search.slug } }
|
36
|
-
|
37
|
-
expect(subject.as_json[:data][:item]).not_to have_key :item_0
|
38
|
-
expect(subject.as_json[:data][:item]).to have_key :item_1
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
@@ -1,41 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe SirTrevorRails::Blocks::BrowseGroupCategoriesBlock do
|
4
|
-
subject { described_class.new({ type: '', data: block_data }, page) }
|
5
|
-
|
6
|
-
let!(:exhibit) { FactoryBot.create(:exhibit) }
|
7
|
-
let!(:page) { FactoryBot.create(:feature_page, exhibit: exhibit) }
|
8
|
-
let!(:group1) { FactoryBot.create(:group, exhibit: exhibit, title: 'abc123', published: true) }
|
9
|
-
let!(:group2) { FactoryBot.create(:group, exhibit: exhibit, title: 'xyz321', published: true) }
|
10
|
-
|
11
|
-
let(:block_data) { {} }
|
12
|
-
|
13
|
-
describe '#groups' do
|
14
|
-
it 'is the array of items with display set to true' do
|
15
|
-
block_data[:item] = {
|
16
|
-
'0': { id: 'abc123', display: 'true', weight: '2' },
|
17
|
-
'1': { id: 'xyz321', display: 'true', weight: '1' }
|
18
|
-
}
|
19
|
-
expect(subject.groups.length).to eq 2
|
20
|
-
expect(subject.groups.first.title).to eq 'xyz321'
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
describe '#groups?' do
|
25
|
-
it 'is the array of items with display set to true' do
|
26
|
-
block_data[:item] = {}
|
27
|
-
expect(subject.be_groups).to be_falsy
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
describe '#display_item_counts?' do
|
32
|
-
it do
|
33
|
-
expect(subject).not_to be_display_item_counts
|
34
|
-
end
|
35
|
-
|
36
|
-
it do
|
37
|
-
block_data['display-item-counts'] = 'true'
|
38
|
-
expect(subject).to be_display_item_counts
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
@@ -1,50 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe SirTrevorRails::Blocks::FeaturedPagesBlock do
|
4
|
-
subject { described_class.new({ type: '', data: block_data }, page) }
|
5
|
-
|
6
|
-
let(:page) { FactoryBot.create(:feature_page, exhibit: exhibit) }
|
7
|
-
let(:exhibit) { FactoryBot.create(:exhibit) }
|
8
|
-
let(:block_data) { {} }
|
9
|
-
|
10
|
-
describe '#items' do
|
11
|
-
it 'is the array of items with display set to true' do
|
12
|
-
block_data[:item] = {
|
13
|
-
'0': { id: 'abc123', display: 'true' },
|
14
|
-
'1': { id: 'xyz321', display: 'false' }
|
15
|
-
}
|
16
|
-
expect(subject.items.length).to eq 1
|
17
|
-
expect(subject.items).to eq([{ id: 'abc123', display: 'true' }])
|
18
|
-
end
|
19
|
-
|
20
|
-
it 'is an empty array when there is no browse category' do
|
21
|
-
expect(subject.items).to eq([])
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
describe '#pages' do
|
26
|
-
let!(:page_a) { FactoryBot.create(:feature_page, slug: 'a', exhibit: exhibit) }
|
27
|
-
let!(:translated_page_a) { page_a.clone_for_locale('a').tap { |x| x.update(published: true) && x.save } }
|
28
|
-
let!(:page_b) { FactoryBot.create(:feature_page, slug: 'b', exhibit: exhibit) }
|
29
|
-
|
30
|
-
before do
|
31
|
-
block_data[:item] = {
|
32
|
-
'0': { id: 'a', display: 'true' },
|
33
|
-
'1': { id: 'b', display: 'true' }
|
34
|
-
}
|
35
|
-
end
|
36
|
-
|
37
|
-
it 'retrieves the pages from the default locale' do
|
38
|
-
expect(subject.pages.length).to eq 2
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
describe '#as_json' do
|
43
|
-
context 'when no items are present' do
|
44
|
-
it 'returns an empty items value' do
|
45
|
-
block_data[:item] = nil
|
46
|
-
expect(subject.as_json[:data]).to include item: {}
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe SirTrevorRails::Blocks::SearchResultsBlock do
|
4
|
-
subject { described_class.new({ type: '', data: block_data }, page) }
|
5
|
-
|
6
|
-
let(:page) { FactoryBot.create(:feature_page) }
|
7
|
-
let(:block_data) { {} }
|
8
|
-
|
9
|
-
describe '#items' do
|
10
|
-
it 'is the array of items with display set to true' do
|
11
|
-
block_data[:item] = {
|
12
|
-
'0': { id: 'abc123', display: 'true' },
|
13
|
-
'1': { id: 'xyz321', display: 'false' }
|
14
|
-
}
|
15
|
-
expect(subject.items.length).to eq 1
|
16
|
-
expect(subject.items).to eq([{ id: 'abc123', display: 'true' }])
|
17
|
-
end
|
18
|
-
|
19
|
-
it 'is an empty array when there is no browse category' do
|
20
|
-
expect(subject.items).to eq([])
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
@@ -1,59 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe SirTrevorRails::Blocks::SolrDocumentsBlock do
|
4
|
-
subject { described_class.new({ type: '', data: block_data }, page) }
|
5
|
-
|
6
|
-
let(:page) { FactoryBot.create(:feature_page) }
|
7
|
-
let(:block_data) { {} }
|
8
|
-
|
9
|
-
describe '#text' do
|
10
|
-
it "is the block's text data" do
|
11
|
-
block_data[:text] = 'abc'
|
12
|
-
|
13
|
-
expect(subject.text).to eq 'abc'
|
14
|
-
end
|
15
|
-
|
16
|
-
it "squelches sir-trevor's placeholder values" do
|
17
|
-
block_data[:text] = '<p><br></p>'
|
18
|
-
expect(subject.text).to be_blank
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
describe '#primary_caption?' do
|
23
|
-
it 'is false if the primary caption field is not configured' do
|
24
|
-
block_data['show-primary-caption'] = 'true'
|
25
|
-
expect(subject.primary_caption?).to eq false
|
26
|
-
end
|
27
|
-
|
28
|
-
it 'is false if the field is configured not to show' do
|
29
|
-
block_data['primary-caption-field'] = 'some_field'
|
30
|
-
block_data['show-primary-caption'] = 'false'
|
31
|
-
expect(subject.primary_caption?).to eq false
|
32
|
-
end
|
33
|
-
|
34
|
-
it 'is true if the field is configured to show' do
|
35
|
-
block_data['primary-caption-field'] = 'some_field'
|
36
|
-
block_data['show-primary-caption'] = 'true'
|
37
|
-
expect(subject.primary_caption?).to eq true
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
describe '#secondary_caption?' do
|
42
|
-
it 'is false if the secondary caption field is not configured' do
|
43
|
-
block_data['show-secondary-caption'] = 'true'
|
44
|
-
expect(subject.secondary_caption?).to eq false
|
45
|
-
end
|
46
|
-
|
47
|
-
it 'is false if the field is configured not to show' do
|
48
|
-
block_data['secondary-caption-field'] = 'some_field'
|
49
|
-
block_data['show-secondary-caption'] = 'false'
|
50
|
-
expect(subject.secondary_caption?).to eq false
|
51
|
-
end
|
52
|
-
|
53
|
-
it 'is true if the field is configured to show' do
|
54
|
-
block_data['secondary-caption-field'] = 'some_field'
|
55
|
-
block_data['show-secondary-caption'] = 'true'
|
56
|
-
expect(subject.secondary_caption?).to eq true
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
@@ -1,42 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe SirTrevorRails::Blocks::Textable do
|
4
|
-
class TextableTestClass
|
5
|
-
include SirTrevorRails::Blocks::Textable
|
6
|
-
attr_accessor :text
|
7
|
-
end
|
8
|
-
let(:subject) { TextableTestClass.new }
|
9
|
-
let(:st_blank_text) { '<p><br></p>' }
|
10
|
-
|
11
|
-
describe '#text?' do
|
12
|
-
it 'returns false when there is no text' do
|
13
|
-
expect(subject).not_to be_text
|
14
|
-
end
|
15
|
-
|
16
|
-
it 'returns true false when the text is the default sir-trevor text' do
|
17
|
-
allow(subject).to receive_messages(text: st_blank_text)
|
18
|
-
expect(subject).to be_text
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
describe '#text_align' do
|
23
|
-
it 'proxies the sir-trevor text-align attribute' do
|
24
|
-
allow(subject).to receive_messages('text-align' => 'text-align-value')
|
25
|
-
expect(subject.text_align).to eq 'text-align-value'
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
describe '#content_align' do
|
30
|
-
it 'is the reverse of text-align' do
|
31
|
-
allow(subject).to receive_messages(text: 'TextContent')
|
32
|
-
allow(subject).to receive_messages(text_align: 'left')
|
33
|
-
expect(subject.content_align).to eq 'right'
|
34
|
-
allow(subject).to receive_messages(text_align: 'right')
|
35
|
-
expect(subject.content_align).to eq 'left'
|
36
|
-
end
|
37
|
-
|
38
|
-
it 'does not have any alignment if there is no text' do
|
39
|
-
expect(subject.content_align).to be_nil
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
@@ -1,214 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe SolrDocument, type: :model do
|
4
|
-
subject { document }
|
5
|
-
|
6
|
-
let(:document) { described_class.new(id: 'abcd123') }
|
7
|
-
let(:exhibit_alt) { FactoryBot.create(:exhibit) }
|
8
|
-
let(:exhibit) { FactoryBot.create(:exhibit) }
|
9
|
-
|
10
|
-
before do
|
11
|
-
allow(subject).to receive_messages(reindex: nil)
|
12
|
-
end
|
13
|
-
|
14
|
-
its(:to_key) { is_expected.to eq ['abcd123'] }
|
15
|
-
its(:persisted?) { is_expected.to be_truthy }
|
16
|
-
|
17
|
-
describe '.build_for_exhibit' do
|
18
|
-
subject { described_class.build_for_exhibit(id, exhibit) }
|
19
|
-
|
20
|
-
let(:id) { '123abc' }
|
21
|
-
|
22
|
-
it 'has a persisted sidecar' do
|
23
|
-
expect(subject.sidecars.first).to be_persisted
|
24
|
-
expect(subject.sidecars.first.exhibit).to eq exhibit
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
it 'has tags on the exhibit' do
|
29
|
-
expect(subject.sidecar(exhibit).tags_from(exhibit)).to be_empty
|
30
|
-
end
|
31
|
-
|
32
|
-
it 'is able to add tags' do
|
33
|
-
expect do
|
34
|
-
exhibit.tag(subject.sidecar(exhibit), with: 'paris, normandy', on: :tags)
|
35
|
-
end.to change(ActsAsTaggableOn::Tag, :count).by(2)
|
36
|
-
expect(subject.sidecar(exhibit).tags_from(exhibit)).to eq %w[paris normandy]
|
37
|
-
end
|
38
|
-
|
39
|
-
it 'has find' do
|
40
|
-
expect(described_class.find('dq287tq6352')).to be_kind_of described_class
|
41
|
-
end
|
42
|
-
|
43
|
-
it 'has ==' do
|
44
|
-
expect(described_class.find('dq287tq6352')).to eq described_class.find('dq287tq6352')
|
45
|
-
end
|
46
|
-
|
47
|
-
describe 'GlobalID' do
|
48
|
-
let(:doc_id) { 'dq287tq6352' }
|
49
|
-
|
50
|
-
it 'responds to #to_global_id' do
|
51
|
-
expect(described_class.find(doc_id).to_global_id.to_s).to eq "gid://internal/SolrDocument/#{doc_id}"
|
52
|
-
end
|
53
|
-
|
54
|
-
it 'is able to locate SolrDocuments by their GlobalID' do
|
55
|
-
expect(GlobalID::Locator.locate(
|
56
|
-
described_class.find(doc_id).to_global_id
|
57
|
-
)['id']).to eq doc_id
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
describe '#sidecar' do
|
62
|
-
it 'returns a sidecar for adding exhibit-specific fields' do
|
63
|
-
expect(subject.sidecar(exhibit)).to be_kind_of Spotlight::SolrDocumentSidecar
|
64
|
-
expect(subject.sidecar(exhibit).exhibit).to eq exhibit
|
65
|
-
end
|
66
|
-
|
67
|
-
it 'keeps distinct sidecars for each exhibit' do
|
68
|
-
expect(subject.sidecar(exhibit).exhibit).to eq exhibit
|
69
|
-
expect(subject.sidecar(exhibit_alt).exhibit).to eq exhibit_alt
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
describe '#update' do
|
74
|
-
it 'stores sidecar data on the sidecar object' do
|
75
|
-
mock_sidecar = double
|
76
|
-
allow(subject).to receive_messages(sidecar: mock_sidecar)
|
77
|
-
expect(mock_sidecar).to receive(:update).with({ data: { 'a' => 1 } })
|
78
|
-
subject.update exhibit, sidecar: { data: { 'a' => 1 } }
|
79
|
-
end
|
80
|
-
|
81
|
-
it 'stores tags' do
|
82
|
-
subject.update exhibit, exhibit_tag_list: 'paris, normandy'
|
83
|
-
expect(subject.sidecar(exhibit).tags_from(exhibit)).to eq %w[paris normandy]
|
84
|
-
end
|
85
|
-
|
86
|
-
it 'converts empty strings to nil' do
|
87
|
-
mock_sidecar = double
|
88
|
-
allow(subject).to receive_messages(sidecar: mock_sidecar)
|
89
|
-
expect(mock_sidecar).to receive(:update).with({ data: { 'a' => nil } })
|
90
|
-
subject.update exhibit, sidecar: { data: { 'a' => '' } }
|
91
|
-
end
|
92
|
-
|
93
|
-
it 'compacts arrays of empty or nil values' do
|
94
|
-
mock_sidecar = double
|
95
|
-
allow(subject).to receive_messages(sidecar: mock_sidecar)
|
96
|
-
expect(mock_sidecar).to receive(:update).with({ data: { 'a' => ['a'] } })
|
97
|
-
subject.update exhibit, sidecar: { data: { 'a' => ['', nil, 'a'] } }
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|
101
|
-
describe '#to_solr' do
|
102
|
-
before do
|
103
|
-
Spotlight::SolrDocumentSidecar.create! document: subject, exhibit: exhibit,
|
104
|
-
data: { 'a_tesim' => 1, 'b_tesim' => 2, 'c_tesim' => 3 }
|
105
|
-
end
|
106
|
-
|
107
|
-
it 'includes the doc id' do
|
108
|
-
expect(subject.to_solr[:id]).to eq 'abcd123'
|
109
|
-
end
|
110
|
-
|
111
|
-
it 'includes exhibit-specific tags' do
|
112
|
-
exhibit.tag(subject.sidecar(exhibit), with: 'paris', on: :tags)
|
113
|
-
|
114
|
-
expect(subject.to_solr).to include :"exhibit_#{exhibit.slug}_tags_ssim"
|
115
|
-
expect(subject.to_solr[:"exhibit_#{exhibit.slug}_tags_ssim"]).to include 'paris'
|
116
|
-
end
|
117
|
-
|
118
|
-
it "includes placeholders for all exhibits' tags" do
|
119
|
-
expect(subject.to_solr).to include :"exhibit_#{exhibit.slug}_tags_ssim"
|
120
|
-
expect(subject.to_solr[:"exhibit_#{exhibit.slug}_tags_ssim"]).to eq nil
|
121
|
-
end
|
122
|
-
|
123
|
-
it 'includes sidecar fields' do
|
124
|
-
expect(subject.to_solr).to include('a_tesim' => 1, 'b_tesim' => 2, 'c_tesim' => 3)
|
125
|
-
end
|
126
|
-
end
|
127
|
-
|
128
|
-
describe '#public?' do
|
129
|
-
it 'defaults to public' do
|
130
|
-
expect(subject).to be_public exhibit
|
131
|
-
end
|
132
|
-
end
|
133
|
-
|
134
|
-
describe '#private?' do
|
135
|
-
it 'defaults to public' do
|
136
|
-
expect(subject).not_to be_private exhibit
|
137
|
-
end
|
138
|
-
end
|
139
|
-
|
140
|
-
describe '#make_public!' do
|
141
|
-
it 'sets the object to public' do
|
142
|
-
allow(subject).to receive(:reindex)
|
143
|
-
subject.make_public! exhibit
|
144
|
-
expect(subject).not_to be_private exhibit
|
145
|
-
end
|
146
|
-
|
147
|
-
it 'augments existing sidecar data' do
|
148
|
-
allow(subject).to receive(:reindex)
|
149
|
-
|
150
|
-
subject.update exhibit, sidecar: { data: { a: 1 } }
|
151
|
-
subject.make_public! exhibit
|
152
|
-
expect(subject.sidecar(exhibit).data[:a]).to eq 1
|
153
|
-
end
|
154
|
-
end
|
155
|
-
|
156
|
-
describe '#make_private!' do
|
157
|
-
it 'sets the object to private' do
|
158
|
-
allow(subject).to receive(:reindex)
|
159
|
-
subject.make_private! exhibit
|
160
|
-
expect(subject).to be_private exhibit
|
161
|
-
end
|
162
|
-
end
|
163
|
-
|
164
|
-
describe 'uploaded resources' do
|
165
|
-
let(:uploaded_resource) do
|
166
|
-
described_class.new(
|
167
|
-
spotlight_resource_type_ssim: 'spotlight/resources/uploads'
|
168
|
-
)
|
169
|
-
end
|
170
|
-
|
171
|
-
it 'does not include Spotlight::SolrDocument::UploadedResource when the correct fields are present' do
|
172
|
-
expect(subject).not_to be_kind_of Spotlight::SolrDocument::UploadedResource
|
173
|
-
end
|
174
|
-
|
175
|
-
it 'includes Spotlight::SolrDocument::UploadedResource when the correct fields are present' do
|
176
|
-
expect(uploaded_resource).to be_kind_of Spotlight::SolrDocument::UploadedResource
|
177
|
-
end
|
178
|
-
|
179
|
-
describe '#uploaded_resource?' do
|
180
|
-
it 'returns false if the correct fields are not present' do
|
181
|
-
expect(subject).not_to be_uploaded_resource
|
182
|
-
end
|
183
|
-
|
184
|
-
it 'returns true when the correct fields are present' do
|
185
|
-
expect(uploaded_resource).to be_uploaded_resource
|
186
|
-
end
|
187
|
-
end
|
188
|
-
end
|
189
|
-
|
190
|
-
describe '.find_each' do
|
191
|
-
it 'enumerates the documents in the exhibit' do
|
192
|
-
expect(described_class.find_each).to be_a Enumerable
|
193
|
-
end
|
194
|
-
|
195
|
-
it 'pages through the index' do
|
196
|
-
allow_any_instance_of(Blacklight::Solr::Repository).to receive(:search).with(hash_including(start: 0)).and_return(double(documents: [1, 2, 3]))
|
197
|
-
allow_any_instance_of(Blacklight::Solr::Repository).to receive(:search).with(hash_including(start: 3)).and_return(double(documents: [4, 5, 6]))
|
198
|
-
allow_any_instance_of(Blacklight::Solr::Repository).to receive(:search).with(hash_including(start: 6)).and_return(double(documents: []))
|
199
|
-
|
200
|
-
expect(described_class.find_each.to_a).to match_array [1, 2, 3, 4, 5, 6]
|
201
|
-
end
|
202
|
-
end
|
203
|
-
|
204
|
-
describe '.reindex_all' do
|
205
|
-
let(:doc) { described_class.new id: 1 }
|
206
|
-
|
207
|
-
it 'reindexes all solr documents' do
|
208
|
-
expect(described_class).to receive(:find_each).and_yield(doc)
|
209
|
-
expect(doc).to receive(:reindex)
|
210
|
-
|
211
|
-
described_class.reindex_all
|
212
|
-
end
|
213
|
-
end
|
214
|
-
end
|
@@ -1,118 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'cancan/matchers'
|
4
|
-
|
5
|
-
describe Spotlight::Ability, type: :model do
|
6
|
-
subject { Ability.new(user) }
|
7
|
-
|
8
|
-
before do
|
9
|
-
allow_any_instance_of(Spotlight::Search).to receive(:set_default_featured_image)
|
10
|
-
end
|
11
|
-
|
12
|
-
let(:exhibit) { FactoryBot.create(:exhibit) }
|
13
|
-
let(:search) { FactoryBot.create(:published_search, exhibit: exhibit) }
|
14
|
-
let(:unpublished_search) { FactoryBot.create(:search, exhibit: exhibit) }
|
15
|
-
let(:page) { FactoryBot.create(:feature_page, exhibit: exhibit) }
|
16
|
-
let(:language) { FactoryBot.create(:language, exhibit: exhibit) }
|
17
|
-
let(:public_language) { FactoryBot.create(:language, exhibit: exhibit, public: true) }
|
18
|
-
let(:translation) { FactoryBot.create(:translation, exhibit: exhibit) }
|
19
|
-
|
20
|
-
describe 'a user with no roles' do
|
21
|
-
let(:user) { nil }
|
22
|
-
|
23
|
-
it { is_expected.not_to be_able_to(:create, exhibit) }
|
24
|
-
it { is_expected.to be_able_to(:read, exhibit) }
|
25
|
-
it { is_expected.to be_able_to(:read, page) }
|
26
|
-
it { is_expected.not_to be_able_to(:create, Spotlight::Page.new(exhibit: exhibit)) }
|
27
|
-
it { is_expected.to be_able_to(:read, search) }
|
28
|
-
it { is_expected.to be_able_to(:read, public_language) }
|
29
|
-
it { is_expected.not_to be_able_to(:read, language) }
|
30
|
-
it { is_expected.not_to be_able_to(:read, unpublished_search) }
|
31
|
-
it { is_expected.not_to be_able_to(:tag, exhibit) }
|
32
|
-
end
|
33
|
-
|
34
|
-
describe 'a superadmin' do
|
35
|
-
let(:user) { FactoryBot.create(:site_admin) }
|
36
|
-
|
37
|
-
it { is_expected.to be_able_to(:create, Spotlight::Exhibit) }
|
38
|
-
end
|
39
|
-
|
40
|
-
describe 'a user with admin role' do
|
41
|
-
let(:user) { FactoryBot.create(:exhibit_admin, exhibit: exhibit) }
|
42
|
-
let(:role) { FactoryBot.create(:role, resource: exhibit) }
|
43
|
-
let(:blacklight_config) { exhibit.blacklight_configuration }
|
44
|
-
|
45
|
-
it { is_expected.to be_able_to(:update, exhibit) }
|
46
|
-
|
47
|
-
it { is_expected.to be_able_to(:index, role) }
|
48
|
-
it { is_expected.to be_able_to(:destroy, role) }
|
49
|
-
it { is_expected.to be_able_to(:update, role) }
|
50
|
-
it { is_expected.to be_able_to(:create, Spotlight::Role) }
|
51
|
-
it { is_expected.not_to be_able_to(:create, Spotlight::Exhibit) }
|
52
|
-
it { is_expected.to be_able_to(:import, exhibit) }
|
53
|
-
it { is_expected.to be_able_to(:process_import, exhibit) }
|
54
|
-
it { is_expected.to be_able_to(:destroy, exhibit) }
|
55
|
-
it { is_expected.to be_able_to(:manage, language) }
|
56
|
-
end
|
57
|
-
|
58
|
-
describe 'a user with curate role' do
|
59
|
-
let(:user) { FactoryBot.create(:exhibit_curator, exhibit: exhibit) }
|
60
|
-
let(:contact) { FactoryBot.build_stubbed(:contact, exhibit: exhibit) }
|
61
|
-
let(:blacklight_config) { exhibit.blacklight_configuration }
|
62
|
-
|
63
|
-
it { is_expected.not_to be_able_to(:update, exhibit) }
|
64
|
-
it { is_expected.to be_able_to(:curate, exhibit) }
|
65
|
-
it { is_expected.to be_able_to(:read, exhibit) }
|
66
|
-
|
67
|
-
it { is_expected.to be_able_to(:create, Spotlight::Search) }
|
68
|
-
it { is_expected.to be_able_to(:update_all, Spotlight::Search) }
|
69
|
-
it { is_expected.to be_able_to(:update, search) }
|
70
|
-
it { is_expected.to be_able_to(:destroy, search) }
|
71
|
-
|
72
|
-
it { is_expected.to be_able_to(:create, Spotlight::Page) }
|
73
|
-
it { is_expected.to be_able_to(:update_all, Spotlight::Page) }
|
74
|
-
it { is_expected.to be_able_to(:update, page) }
|
75
|
-
it { is_expected.to be_able_to(:destroy, page) }
|
76
|
-
|
77
|
-
it { is_expected.to be_able_to(:create, Translation) }
|
78
|
-
it { is_expected.to be_able_to(:update_all, Translation) }
|
79
|
-
it { is_expected.to be_able_to(:update, translation) }
|
80
|
-
it { is_expected.to be_able_to(:destroy, translation) }
|
81
|
-
|
82
|
-
it { is_expected.to be_able_to(:tag, exhibit) }
|
83
|
-
it { is_expected.to be_able_to(:bulk_update, exhibit) }
|
84
|
-
|
85
|
-
it { is_expected.to be_able_to(:edit, contact) }
|
86
|
-
it { is_expected.to be_able_to(:new, contact) }
|
87
|
-
it { is_expected.to be_able_to(:create, contact) }
|
88
|
-
it { is_expected.to be_able_to(:destroy, contact) }
|
89
|
-
it { is_expected.not_to be_able_to(:manage, language) }
|
90
|
-
it { is_expected.to be_able_to(:read, language) }
|
91
|
-
end
|
92
|
-
|
93
|
-
context 'with an unpublished exhibit' do
|
94
|
-
before do
|
95
|
-
exhibit.update(published: false)
|
96
|
-
end
|
97
|
-
|
98
|
-
context 'with a user with a viewer role' do
|
99
|
-
let(:user) { FactoryBot.create(:user, :with_exhibit_role, role: 'viewer', exhibit: exhibit) }
|
100
|
-
|
101
|
-
it { is_expected.not_to be_able_to(:create, exhibit) }
|
102
|
-
it { is_expected.to be_able_to(:read, exhibit) }
|
103
|
-
it { is_expected.to be_able_to(:read, page) }
|
104
|
-
it { is_expected.not_to be_able_to(:create, Spotlight::Page.new(exhibit: exhibit)) }
|
105
|
-
it { is_expected.to be_able_to(:read, search) }
|
106
|
-
it { is_expected.to be_able_to(:read, public_language) }
|
107
|
-
it { is_expected.not_to be_able_to(:read, language) }
|
108
|
-
it { is_expected.not_to be_able_to(:read, unpublished_search) }
|
109
|
-
it { is_expected.not_to be_able_to(:tag, exhibit) }
|
110
|
-
end
|
111
|
-
|
112
|
-
context 'with an anonymous user' do
|
113
|
-
let(:user) { FactoryBot.create(:exhibit_visitor) }
|
114
|
-
|
115
|
-
it { is_expected.not_to be_able_to(:read, exhibit) }
|
116
|
-
end
|
117
|
-
end
|
118
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
describe Spotlight::AboutPage, type: :model do
|
4
|
-
let(:page) { described_class.create! exhibit: FactoryBot.create(:exhibit) }
|
5
|
-
|
6
|
-
it { is_expected.not_to be_feature_page }
|
7
|
-
it { is_expected.to be_about_page }
|
8
|
-
|
9
|
-
it 'displays the sidebar' do
|
10
|
-
expect(page).to be_display_sidebar
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'forces the sidebar to display (we do not provide an interface for setting this to false)' do
|
14
|
-
expect(page).to be_display_sidebar
|
15
|
-
page.display_sidebar = false
|
16
|
-
page.save
|
17
|
-
expect(page).to be_display_sidebar
|
18
|
-
end
|
19
|
-
end
|