blacklight-spotlight 0.17.1 → 0.18.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -7
- data/Rakefile +22 -36
- data/app/assets/javascripts/spotlight/blocks/solr_documents_block.js +1 -1
- data/app/assets/javascripts/spotlight/search_typeahead.js +1 -1
- data/app/assets/javascripts/spotlight/spotlight.js +3 -9
- data/app/assets/stylesheets/spotlight/_footer.scss +2 -19
- data/app/controllers/concerns/spotlight/base.rb +2 -2
- data/app/controllers/concerns/spotlight/catalog.rb +7 -5
- data/app/controllers/concerns/spotlight/controller.rb +4 -4
- data/app/controllers/spotlight/application_controller.rb +2 -0
- data/app/controllers/spotlight/browse_controller.rb +1 -2
- data/app/controllers/spotlight/catalog_controller.rb +8 -8
- data/app/controllers/spotlight/concerns/application_controller.rb +59 -0
- data/app/controllers/spotlight/dashboards_controller.rb +1 -2
- data/app/controllers/spotlight/home_pages_controller.rb +1 -1
- data/app/controllers/spotlight/pages_controller.rb +1 -2
- data/app/controllers/spotlight/resources/upload_controller.rb +3 -3
- data/app/controllers/spotlight/resources_controller.rb +3 -3
- data/app/controllers/spotlight/searches_controller.rb +1 -1
- data/app/helpers/spotlight/application_helper.rb +3 -7
- data/app/helpers/spotlight/main_app_helpers.rb +10 -29
- data/app/helpers/spotlight/pages_helper.rb +1 -1
- data/app/jobs/spotlight/reindex_job.rb +2 -3
- data/app/models/concerns/spotlight/access_controls_enforcement_search_builder.rb +34 -0
- data/app/models/concerns/spotlight/exhibit_documents.rb +2 -3
- data/app/models/concerns/spotlight/sitemap.rb +1 -1
- data/app/models/concerns/spotlight/solr_document/uploaded_resource.rb +1 -2
- data/app/models/sir_trevor_rails/blocks/browse_block.rb +7 -1
- data/app/models/sir_trevor_rails/blocks/textable.rb +2 -1
- data/app/models/spotlight/ability.rb +2 -1
- data/app/models/spotlight/contact_form.rb +1 -1
- data/app/models/spotlight/custom_field.rb +7 -15
- data/app/models/spotlight/field_metadata.rb +1 -1
- data/app/models/spotlight/resource.rb +2 -1
- data/app/models/spotlight/search.rb +1 -1
- data/app/values/custom_field_name.rb +36 -0
- data/app/views/blacklight/nav/_saved_searches.html.erb +1 -1
- data/app/views/blacklight/nav/_search_history.html.erb +1 -1
- data/app/views/catalog/_save_search.html.erb +1 -1
- data/app/views/catalog/_search_form.html.erb +1 -1
- data/app/views/layouts/spotlight/spotlight.html.erb +1 -1
- data/app/views/shared/_site_sidebar.html.erb +2 -2
- data/app/views/spotlight/about_pages/_empty.html.erb +1 -1
- data/app/views/spotlight/appearances/edit.html.erb +1 -1
- data/app/views/spotlight/catalog/_document_visibility_control.html.erb +1 -1
- data/app/views/spotlight/catalog/_edit_default.html.erb +4 -4
- data/app/views/spotlight/dashboards/analytics.html.erb +1 -1
- data/app/views/spotlight/exhibits/_missing_exhibits.html.erb +1 -1
- data/app/views/spotlight/feature_pages/_empty.html.erb +1 -1
- data/app/views/spotlight/home_pages/_empty.html.erb +2 -2
- data/app/views/spotlight/pages/_form.html.erb +1 -1
- data/app/views/spotlight/pages/_order_pages.html.erb +1 -1
- data/app/views/spotlight/resources/_missing_external_resources_partials.html.erb +1 -1
- data/app/views/spotlight/searches/_form.html.erb +1 -1
- data/app/views/spotlight/shared/_curation_sidebar.html.erb +2 -2
- data/config/locales/spotlight.en.yml +3 -3
- data/config/routes.rb +13 -9
- data/db/migrate/20160329215014_add_readonly_to_custom_fields.rb +5 -0
- data/lib/generators/spotlight/install_generator.rb +4 -4
- data/lib/spotlight/engine.rb +6 -1
- data/lib/spotlight/version.rb +1 -1
- data/spec/controllers/spotlight/about_pages_controller_spec.rb +4 -4
- data/spec/controllers/spotlight/application_controller_spec.rb +1 -1
- data/spec/controllers/spotlight/browse_controller_spec.rb +0 -2
- data/spec/controllers/spotlight/catalog_controller_spec.rb +103 -17
- data/spec/controllers/spotlight/dashboards_controller_spec.rb +1 -1
- data/spec/controllers/spotlight/feature_pages_controller_spec.rb +0 -2
- data/spec/controllers/spotlight/home_pages_controller_spec.rb +0 -2
- data/spec/controllers/spotlight/resources/upload_controller_spec.rb +1 -1
- data/spec/controllers/spotlight/resources_controller_spec.rb +1 -1
- data/spec/controllers/spotlight/search_configurations_controller_spec.rb +1 -1
- data/spec/features/add_custom_field_metadata_spec.rb +16 -3
- data/spec/features/catalog_spec.rb +2 -2
- data/spec/features/edit_search_fields_spec.rb +1 -1
- data/spec/features/exhibits/add_tags_spec.rb +2 -2
- data/spec/features/item_admin_spec.rb +5 -5
- data/spec/features/javascript/reindex_monitor_spec.rb +1 -1
- data/spec/features/javascript/search_context_spec.rb +4 -2
- data/spec/features/report_a_problem_spec.rb +2 -2
- data/spec/features/slideshow_spec.rb +1 -1
- data/spec/fixtures/sample_solr_documents.yml +44 -44
- data/spec/helpers/spotlight/application_helper_spec.rb +2 -23
- data/spec/helpers/spotlight/main_app_helpers_spec.rb +4 -62
- data/spec/helpers/spotlight/pages_helper_spec.rb +1 -2
- data/spec/models/sir_trevor_rails/blocks/browse_block_spec.rb +22 -0
- data/spec/{lib/spotlight/catalog/access_controls_enforcement_spec.rb → models/spotlight/access_controls_enforcement_search_builder_spec.rb} +5 -18
- data/spec/models/spotlight/contact_form_spec.rb +35 -0
- data/spec/models/spotlight/custom_field_spec.rb +6 -0
- data/spec/models/spotlight/exhibit_spec.rb +3 -2
- data/spec/models/spotlight/search_spec.rb +2 -2
- data/spec/spec_helper.rb +7 -0
- data/spec/support/helpers/controller_level_helpers.rb +13 -0
- data/spec/test_app_templates/catalog_controller.rb +1 -0
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +9 -1
- data/spec/views/shared/_footer.html.erb_spec.rb +3 -3
- data/spec/views/spotlight/about_pages/index.html.erb_spec.rb +7 -11
- data/spec/views/spotlight/catalog/admin.html.erb_spec.rb +3 -1
- data/spec/views/spotlight/home_pages/_empty.html.erb_spec.rb +1 -1
- data/spec/views/spotlight/metadata_configurations/_metadata_field.html.erb_spec.rb +2 -1
- data/spec/views/spotlight/metadata_configurations/edit.html.erb_spec.rb +2 -1
- data/spec/views/spotlight/pages/index.html.erb_spec.rb +2 -4
- data/spec/views/spotlight/pages/show.html.erb_spec.rb +1 -2
- data/spec/views/spotlight/search_configurations/_sort.html.erb_spec.rb +2 -1
- data/spec/views/spotlight/searches/_search.html.erb_spec.rb +1 -1
- data/spec/views/spotlight/searches/edit.html.erb_spec.rb +1 -1
- metadata +30 -25
- data/app/controllers/concerns/spotlight/catalog/access_controls_enforcement.rb +0 -47
- data/config/jetty.yml +0 -6
- data/spec/test_app_templates/Gemfile.extra +0 -0
@@ -36,13 +36,13 @@ describe Spotlight::ApplicationHelper, type: :helper do
|
|
36
36
|
|
37
37
|
# controller provided helper.
|
38
38
|
allow(helper).to receive(:search_action_url) do |*args|
|
39
|
-
spotlight.
|
39
|
+
spotlight.search_exhibit_catalog_path(helper.current_exhibit, *args)
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
43
|
it 'is a url for a search with the given tag facet' do
|
44
44
|
allow(SolrDocument).to receive_messages(solr_field_for_tagger: :exhibit_tags)
|
45
|
-
expected = spotlight.
|
45
|
+
expected = spotlight.search_exhibit_catalog_path(exhibit_id: helper.current_exhibit, f: { exhibit_tags: ['tag_value'] })
|
46
46
|
expect(helper.url_to_tag_facet('tag_value')).to eq expected
|
47
47
|
end
|
48
48
|
end
|
@@ -133,27 +133,6 @@ describe Spotlight::ApplicationHelper, type: :helper do
|
|
133
133
|
end
|
134
134
|
end
|
135
135
|
|
136
|
-
describe 'save_search rendering' do
|
137
|
-
let(:current_exhibit) { FactoryGirl.create(:exhibit) }
|
138
|
-
before { allow(helper).to receive_messages(current_exhibit: current_exhibit) }
|
139
|
-
describe 'render_save_this_search?' do
|
140
|
-
it 'returns false if we are on the items admin screen' do
|
141
|
-
allow(helper).to receive(:"can?").with(:curate, current_exhibit).and_return(true)
|
142
|
-
allow(helper).to receive(:params).and_return(controller: 'spotlight/catalog', action: 'admin')
|
143
|
-
expect(helper.render_save_this_search?).to be_falsey
|
144
|
-
end
|
145
|
-
it 'returns true if we are not on the items admin screen' do
|
146
|
-
allow(helper).to receive(:"can?").with(:curate, current_exhibit).and_return(true)
|
147
|
-
allow(helper).to receive(:params).and_return(controller: 'spotlight/catalog', action: 'index')
|
148
|
-
expect(helper.render_save_this_search?).to be_truthy
|
149
|
-
end
|
150
|
-
it 'returns false if a user cannot curate the object' do
|
151
|
-
allow(helper).to receive(:"can?").with(:curate, current_exhibit).and_return(false)
|
152
|
-
expect(helper.render_save_this_search?).to be_falsey
|
153
|
-
end
|
154
|
-
end
|
155
|
-
end
|
156
|
-
|
157
136
|
describe '#uploaded_field_label' do
|
158
137
|
let :field do
|
159
138
|
OpenStruct.new field_name: 'x'
|
@@ -34,69 +34,11 @@ describe Spotlight::MainAppHelpers, type: :helper do
|
|
34
34
|
before { allow(helper).to receive_messages current_exhibit: nil }
|
35
35
|
its(:show_contact_form?) { should be_falsey }
|
36
36
|
end
|
37
|
-
end
|
38
|
-
|
39
|
-
describe '#field_enabled?' do
|
40
|
-
let(:field) { FactoryGirl.create(:custom_field) }
|
41
|
-
let(:controller) { OpenStruct.new }
|
42
|
-
before do
|
43
|
-
controller.extend(Blacklight::Catalog)
|
44
|
-
allow(helper).to receive(:controller).and_return(controller)
|
45
|
-
allow(helper).to receive(:document_index_view_type).and_return(nil)
|
46
|
-
allow(field).to receive(:enabled).and_return(true)
|
47
|
-
end
|
48
|
-
context 'for sort fields' do
|
49
|
-
let(:field) { Blacklight::Configuration::SortField.new enabled: true }
|
50
|
-
it 'uses the enabled property for sort fields' do
|
51
|
-
expect(helper.field_enabled?(field)).to eq true
|
52
|
-
end
|
53
|
-
end
|
54
37
|
|
55
|
-
context '
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
it 'returns the value of field#show if the action_name is "show"' do
|
63
|
-
allow(field).to receive(:show).and_return(:value)
|
64
|
-
allow(helper).to receive(:action_name).and_return('show')
|
65
|
-
expect(helper.field_enabled?(field)).to eq :value
|
66
|
-
end
|
67
|
-
it 'returns the value of field#show if the action_name is "edit"' do
|
68
|
-
allow(field).to receive(:show).and_return(:value)
|
69
|
-
allow(helper).to receive(:action_name).and_return('edit')
|
70
|
-
expect(helper.field_enabled?(field)).to eq :value
|
71
|
-
end
|
72
|
-
it 'returns the value of the original if condition' do
|
73
|
-
allow(field).to receive(:upstream_if).and_return false
|
74
|
-
expect(helper.field_enabled?(field)).to eq false
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
describe '#enabled_in_spotlight_view_type_configuration?' do
|
79
|
-
let(:controller) { OpenStruct.new }
|
80
|
-
let(:view) { OpenStruct.new }
|
81
|
-
before do
|
82
|
-
controller.extend(Blacklight::Catalog)
|
83
|
-
allow(helper).to receive(:controller).and_return(controller)
|
84
|
-
end
|
85
|
-
|
86
|
-
it 'respects the original if condition' do
|
87
|
-
view.upstream_if = false
|
88
|
-
expect(helper.enabled_in_spotlight_view_type_configuration?(view)).to eq false
|
89
|
-
end
|
90
|
-
|
91
|
-
it 'is true if there is no exhibit context' do
|
92
|
-
allow(helper).to receive(:current_exhibit).and_return(nil)
|
93
|
-
expect(helper.enabled_in_spotlight_view_type_configuration?(view)).to eq true
|
94
|
-
end
|
95
|
-
|
96
|
-
it "is true if we're in a page context" do
|
97
|
-
allow(helper).to receive(:current_exhibit).and_return(nil)
|
98
|
-
allow(controller).to receive(:is_a?).with(Spotlight::PagesController).and_return(true)
|
99
|
-
expect(helper.enabled_in_spotlight_view_type_configuration?(view)).to eq true
|
38
|
+
context 'with a default contact address' do
|
39
|
+
before { allow(Spotlight::Engine.config).to receive_messages default_contact_email: 'root@localhost' }
|
40
|
+
before { allow(helper).to receive_messages current_exhibit: exhibit }
|
41
|
+
its(:show_contact_form?) { should be_truthy }
|
100
42
|
end
|
101
43
|
end
|
102
44
|
end
|
@@ -59,8 +59,7 @@ module Spotlight
|
|
59
59
|
let(:search_result) { [double('response'), double('documents')] }
|
60
60
|
|
61
61
|
it 'returns the results for a given search browse category' do
|
62
|
-
|
63
|
-
expect(helper).to receive(:search_results).with({ 'q' => 'query' }, []).and_return(search_result)
|
62
|
+
expect(helper).to receive(:search_results).with('q' => 'query').and_return(search_result)
|
64
63
|
expect(helper.get_search_widget_search_results(good)).to eq search_result
|
65
64
|
end
|
66
65
|
it "returns an empty array when requesting a search that doesn't exist" do
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SirTrevorRails::Blocks::BrowseBlock do
|
4
|
+
let(:page) { FactoryGirl.create(:feature_page) }
|
5
|
+
let(:block_data) { {} }
|
6
|
+
subject { described_class.new({ type: '', data: block_data }, page) }
|
7
|
+
|
8
|
+
describe '#items' do
|
9
|
+
it 'is the array of items with display set to true' do
|
10
|
+
block_data[:item] = {
|
11
|
+
'0': { id: 'abc123', display: 'true' },
|
12
|
+
'1': { id: 'xyz321', display: 'false' }
|
13
|
+
}
|
14
|
+
expect(subject.items.length).to eq 1
|
15
|
+
expect(subject.items).to eq([{ id: 'abc123', display: 'true' }])
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'is an empty array when there is no browse category' do
|
19
|
+
expect(subject.items).to eq([])
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -1,13 +1,13 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe Spotlight::
|
3
|
+
describe Spotlight::AccessControlsEnforcementSearchBuilder do
|
4
4
|
class MockSearchBuilder < Blacklight::SearchBuilder
|
5
5
|
attr_reader :blacklight_params, :scope
|
6
6
|
def initialize(blacklight_params, scope)
|
7
7
|
@blacklight_params = blacklight_params
|
8
8
|
@scope = scope
|
9
9
|
end
|
10
|
-
include Spotlight::
|
10
|
+
include Spotlight::AccessControlsEnforcementSearchBuilder
|
11
11
|
include Blacklight::Solr::SearchBuilderBehavior
|
12
12
|
|
13
13
|
def blacklight_config
|
@@ -21,19 +21,6 @@ describe Spotlight::Catalog::AccessControlsEnforcement do
|
|
21
21
|
let(:solr_request) { Blacklight::Solr::Request.new }
|
22
22
|
let(:blacklight_params) { Hash.new }
|
23
23
|
|
24
|
-
describe '.search_params_logic' do
|
25
|
-
class MockCatalogController
|
26
|
-
include Blacklight::SearchHelper
|
27
|
-
include Spotlight::Catalog::AccessControlsEnforcement
|
28
|
-
end
|
29
|
-
|
30
|
-
subject { MockCatalogController.new }
|
31
|
-
|
32
|
-
it 'adds the filter to the params logic' do
|
33
|
-
expect(subject.search_params_logic).to include :apply_permissive_visibility_filter
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
24
|
describe '#apply_permissive_visibility_filter' do
|
38
25
|
it 'allows curators to view everything' do
|
39
26
|
allow(scope).to receive(:can?).and_return(true)
|
@@ -53,7 +40,7 @@ describe Spotlight::Catalog::AccessControlsEnforcement do
|
|
53
40
|
allow(subject).to receive(:can?).and_return(true)
|
54
41
|
subject.apply_permissive_visibility_filter(solr_request)
|
55
42
|
expect(solr_request).to include :fq
|
56
|
-
expect(solr_request[:fq]).not_to include "spotlight_exhibit_slug_#{exhibit.slug}_bsi
|
43
|
+
expect(solr_request[:fq]).not_to include "{!term f=spotlight_exhibit_slug_#{exhibit.slug}_bsi}true"
|
57
44
|
end
|
58
45
|
end
|
59
46
|
|
@@ -69,7 +56,7 @@ describe Spotlight::Catalog::AccessControlsEnforcement do
|
|
69
56
|
subject.apply_exhibit_resources_filter(solr_request)
|
70
57
|
|
71
58
|
expect(solr_request).to include :fq
|
72
|
-
expect(solr_request[:fq]).to include "spotlight_exhibit_slug_#{exhibit.slug}_bsi
|
59
|
+
expect(solr_request[:fq]).to include "{!term f=spotlight_exhibit_slug_#{exhibit.slug}_bsi}true"
|
73
60
|
end
|
74
61
|
end
|
75
62
|
|
@@ -86,7 +73,7 @@ describe Spotlight::Catalog::AccessControlsEnforcement do
|
|
86
73
|
subject.apply_exhibit_resources_filter(solr_request)
|
87
74
|
|
88
75
|
expect(solr_request).to include :fq
|
89
|
-
expect(solr_request[:fq]).to include '{!
|
76
|
+
expect(solr_request[:fq]).to include '{!term f=author_ssim}Coyne, Justin'
|
90
77
|
end
|
91
78
|
end
|
92
79
|
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Spotlight::ContactForm do
|
4
|
+
subject { described_class.new(name: 'Root', email: 'user@example.com').tap { |c| c.current_exhibit = exhibit } }
|
5
|
+
let(:exhibit) { FactoryGirl.create(:exhibit) }
|
6
|
+
|
7
|
+
context 'with a site-wide contact email' do
|
8
|
+
before { allow(Spotlight::Engine.config).to receive_messages default_contact_email: 'root@localhost' }
|
9
|
+
|
10
|
+
it 'sends the email to the configured contact' do
|
11
|
+
expect(subject.headers[:to]).to eq Spotlight::Engine.config.default_contact_email
|
12
|
+
end
|
13
|
+
|
14
|
+
context 'with exhibit-specific contacts' do
|
15
|
+
before { exhibit.contact_emails.create(email: 'curator@example.com', confirmed_at: Time.zone.now) }
|
16
|
+
|
17
|
+
it 'appends exhibit-specific contacts as cc recipients' do
|
18
|
+
expect(subject.headers[:cc]).to eq 'curator@example.com'
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
context 'with exhibit-specific contacts' do
|
24
|
+
before { exhibit.contact_emails.create(email: 'curator@example.com', confirmed_at: Time.zone.now) }
|
25
|
+
before { exhibit.contact_emails.create(email: 'addl_curator@example.com', confirmed_at: Time.zone.now) }
|
26
|
+
|
27
|
+
it 'sends the email to the first contact' do
|
28
|
+
expect(subject.headers[:to]).to eq 'curator@example.com'
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'appends exhibit-specific contacts as cc recipients' do
|
32
|
+
expect(subject.headers[:cc]).to eq 'curator@example.com, addl_curator@example.com'
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -69,6 +69,12 @@ describe Spotlight::CustomField, type: :model do
|
|
69
69
|
subject.save
|
70
70
|
expect(subject.field).to end_with Spotlight::Engine.config.solr_fields.string_suffix
|
71
71
|
end
|
72
|
+
|
73
|
+
it 'begins with readonly if it is readonly' do
|
74
|
+
subject.readonly_field = true
|
75
|
+
subject.save
|
76
|
+
expect(subject.field).to start_with('readonly_')
|
77
|
+
end
|
72
78
|
end
|
73
79
|
|
74
80
|
describe '#solr_field' do
|
@@ -82,7 +82,8 @@ describe Spotlight::Exhibit, type: :model do
|
|
82
82
|
before do
|
83
83
|
subject.contacts_attributes = [
|
84
84
|
{ 'show_in_sidebar' => '0', 'name' => 'Justin Coyne', 'contact_info' => { 'email' => 'jcoyne@justincoyne.com', 'title' => '', 'location' => 'US' } },
|
85
|
-
{ 'show_in_sidebar' => '0', 'name' => '', 'contact_info' => { 'email' => '', 'title' => 'Librarian', 'location' => '' } }
|
85
|
+
{ 'show_in_sidebar' => '0', 'name' => '', 'contact_info' => { 'email' => '', 'title' => 'Librarian', 'location' => '' } }
|
86
|
+
]
|
86
87
|
end
|
87
88
|
it 'accepts nested contacts' do
|
88
89
|
expect(subject.contacts.size).to eq 2
|
@@ -230,7 +231,7 @@ describe Spotlight::Exhibit, type: :model do
|
|
230
231
|
end
|
231
232
|
|
232
233
|
it 'filters the solr results using the exhibit filter' do
|
233
|
-
expected_query_params = { fq: ["spotlight_exhibit_slug_#{subject.slug}_bsi
|
234
|
+
expected_query_params = { fq: ["{!term f=spotlight_exhibit_slug_#{subject.slug}_bsi}true"] }
|
234
235
|
allow_any_instance_of(Blacklight::Solr::Repository).to receive(:search).with(hash_including(expected_query_params)).and_return(double(documents: []))
|
235
236
|
expect(subject.solr_documents.to_a).to be_blank
|
236
237
|
end
|
@@ -97,7 +97,7 @@ describe Spotlight::Search, type: :model do
|
|
97
97
|
|
98
98
|
describe '#search_params' do
|
99
99
|
it 'maps the search to the appropriate facet values' do
|
100
|
-
expect(subject.search_params.to_hash).to include 'fq' => array_including('{!
|
100
|
+
expect(subject.search_params.to_hash).to include 'fq' => array_including('{!term f=genre_sim}map')
|
101
101
|
end
|
102
102
|
|
103
103
|
context 'with filter_resources_by_exhibit configured' do
|
@@ -106,7 +106,7 @@ describe Spotlight::Search, type: :model do
|
|
106
106
|
end
|
107
107
|
|
108
108
|
it 'includes the exhibit context' do
|
109
|
-
expect(subject.search_params.to_hash).to include 'fq' => array_including("spotlight_exhibit_slug_#{exhibit.slug}_bsi
|
109
|
+
expect(subject.search_params.to_hash).to include 'fq' => array_including("{!term f=spotlight_exhibit_slug_#{exhibit.slug}_bsi}true")
|
110
110
|
end
|
111
111
|
end
|
112
112
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -72,6 +72,13 @@ RSpec.configure do |config|
|
|
72
72
|
config.include Devise::TestHelpers, type: :view
|
73
73
|
config.include Spotlight::TestViewHelpers, type: :view
|
74
74
|
config.include Warden::Test::Helpers, type: :feature
|
75
|
+
|
76
|
+
config.include(ControllerLevelHelpers, type: :helper)
|
77
|
+
config.before(:each, type: :helper) { initialize_controller_helpers(helper) }
|
78
|
+
|
79
|
+
config.include(ControllerLevelHelpers, type: :view)
|
80
|
+
config.before(:each, type: :view) { initialize_controller_helpers(view) }
|
81
|
+
|
75
82
|
config.after(:each, type: :feature) { Warden.test_reset! }
|
76
83
|
config.include Controllers::EngineHelpers, type: :controller
|
77
84
|
config.include Capybara::DSL
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module ControllerLevelHelpers
|
2
|
+
def search_state
|
3
|
+
@search_state ||= Blacklight::SearchState.new(params, blacklight_config)
|
4
|
+
end
|
5
|
+
|
6
|
+
def blacklight_configuration_context
|
7
|
+
@blacklight_configuration_context ||= Blacklight::Configuration::Context.new(controller)
|
8
|
+
end
|
9
|
+
|
10
|
+
def initialize_controller_helpers(helper)
|
11
|
+
helper.extend ControllerLevelHelpers
|
12
|
+
end
|
13
|
+
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
class CatalogController < ApplicationController
|
2
2
|
include Blacklight::Catalog
|
3
3
|
helper Openseadragon::OpenseadragonHelper
|
4
|
+
before_action :set_paper_trail_whodunnit
|
4
5
|
|
5
6
|
configure_blacklight do |config|
|
6
7
|
## Default parameters to send to solr for all search-like requests. See also SolrHelper#solr_search_params
|
@@ -4,7 +4,7 @@ class TestAppGenerator < Rails::Generators::Base
|
|
4
4
|
source_root '../spec/test_app_templates'
|
5
5
|
|
6
6
|
def add_gems
|
7
|
-
gem 'blacklight', '~>
|
7
|
+
gem 'blacklight', '~> 6.0'
|
8
8
|
gem 'blacklight-gallery', '>= 0.3.0'
|
9
9
|
gem 'jettywrapper'
|
10
10
|
Bundler.with_clean_env do
|
@@ -48,4 +48,12 @@ class TestAppGenerator < Rails::Generators::Base
|
|
48
48
|
EOF
|
49
49
|
end
|
50
50
|
end
|
51
|
+
|
52
|
+
def disable_papertrail_associations
|
53
|
+
initializer 'paper_trail.rb' do
|
54
|
+
<<-EOF
|
55
|
+
PaperTrail.config.track_associations = false
|
56
|
+
EOF
|
57
|
+
end
|
58
|
+
end
|
51
59
|
end
|
@@ -16,9 +16,9 @@ module Spotlight
|
|
16
16
|
|
17
17
|
it 'displays social media links' do
|
18
18
|
render
|
19
|
-
expect(rendered).to have_selector('footer .social-share-button a.
|
20
|
-
expect(rendered).to have_selector('footer .social-share-button a.
|
21
|
-
expect(rendered).to have_selector('footer .social-share-button a.
|
19
|
+
expect(rendered).to have_selector('footer .social-share-button a.ssb-icon[title="Twitter"]')
|
20
|
+
expect(rendered).to have_selector('footer .social-share-button a.ssb-icon[title="Facebook"]')
|
21
|
+
expect(rendered).to have_selector('footer .social-share-button a.ssb-icon[title="Google+"]')
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
@@ -6,23 +6,19 @@ describe 'spotlight/about_pages/index.html.erb', type: :view do
|
|
6
6
|
stub_model(Spotlight::AboutPage,
|
7
7
|
title: 'Title1',
|
8
8
|
content: '[]',
|
9
|
-
exhibit: exhibit
|
10
|
-
),
|
9
|
+
exhibit: exhibit),
|
11
10
|
stub_model(Spotlight::AboutPage,
|
12
11
|
title: 'Title2',
|
13
12
|
content: '[]',
|
14
|
-
exhibit: exhibit
|
15
|
-
)
|
13
|
+
exhibit: exhibit)
|
16
14
|
]
|
17
15
|
end
|
18
16
|
let(:contacts) do
|
19
17
|
[
|
20
18
|
stub_model(Spotlight::Contact,
|
21
|
-
exhibit: exhibit
|
22
|
-
),
|
19
|
+
exhibit: exhibit),
|
23
20
|
stub_model(Spotlight::Contact,
|
24
|
-
exhibit: exhibit
|
25
|
-
)
|
21
|
+
exhibit: exhibit)
|
26
22
|
]
|
27
23
|
end
|
28
24
|
let(:exhibit) { stub_model(Spotlight::Exhibit) }
|
@@ -48,9 +44,9 @@ describe 'spotlight/about_pages/index.html.erb', type: :view do
|
|
48
44
|
expect(rendered).to have_selector '.panel-title', text: 'Title2'
|
49
45
|
|
50
46
|
expect(rendered).to have_selector '.contacts_admin ol.dd-list li[data-id]', count: 2
|
51
|
-
expect(rendered).to have_selector '.contacts_admin ol.dd-list li input[data-property=weight]', count: 2
|
52
|
-
expect(rendered).to have_selector '.contacts_admin ol.dd-list li input#exhibit_contacts_attributes_0_id'
|
53
|
-
expect(rendered).to have_selector '.contacts_admin ol.dd-list li input#exhibit_contacts_attributes_1_id'
|
47
|
+
expect(rendered).to have_selector '.contacts_admin ol.dd-list li input[data-property=weight]', visible: false, count: 2
|
48
|
+
expect(rendered).to have_selector '.contacts_admin ol.dd-list li input#exhibit_contacts_attributes_0_id', visible: false
|
49
|
+
expect(rendered).to have_selector '.contacts_admin ol.dd-list li input#exhibit_contacts_attributes_1_id', visible: false
|
54
50
|
end
|
55
51
|
|
56
52
|
describe 'Save button' do
|
@@ -3,8 +3,10 @@ require 'spec_helper'
|
|
3
3
|
module Spotlight
|
4
4
|
describe 'spotlight/catalog/admin.html.erb', type: :view do
|
5
5
|
let(:exhibit) { stub_model(Spotlight::Exhibit) }
|
6
|
+
let(:blacklight_config) { CatalogController.blacklight_config }
|
6
7
|
before do
|
7
|
-
allow(view).to receive(:blacklight_config).and_return(
|
8
|
+
allow(view).to receive(:blacklight_config).and_return(blacklight_config)
|
9
|
+
allow(exhibit).to receive(:blacklight_config).and_return(blacklight_config)
|
8
10
|
allow(view).to receive(:spotlight_page_path_for).and_return(nil)
|
9
11
|
allow(view).to receive(:current_exhibit).and_return(exhibit)
|
10
12
|
allow(view).to receive(:new_exhibit_resource_path).and_return('')
|
@@ -8,7 +8,7 @@ describe 'spotlight/home_pages/_empty.html.erb', type: :view do
|
|
8
8
|
edit_exhibit_path: '/',
|
9
9
|
edit_exhibit_appearance_path: '/',
|
10
10
|
exhibit_roles_path: '/',
|
11
|
-
|
11
|
+
admin_exhibit_catalog_path: '/',
|
12
12
|
edit_exhibit_metadata_configuration_path: '/',
|
13
13
|
edit_exhibit_search_configuration_path: '/')
|
14
14
|
end
|
@@ -11,7 +11,8 @@ module Spotlight
|
|
11
11
|
current_exhibit: exhibit,
|
12
12
|
blacklight_config: exhibit.blacklight_configuration,
|
13
13
|
available_view_fields: { some_view_type: 1, another_view_type: 2 },
|
14
|
-
select_deselect_button: nil
|
14
|
+
select_deselect_button: nil
|
15
|
+
)
|
15
16
|
end
|
16
17
|
|
17
18
|
let(:facet_field) { Blacklight::Configuration::FacetField.new }
|