blacklight 6.3.1 → 6.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rspec +2 -1
- data/README.md +2 -2
- data/VERSION +1 -1
- data/app/assets/stylesheets/blacklight/_twitter_typeahead.scss +4 -4
- data/app/controllers/concerns/blacklight/facet.rb +12 -5
- data/app/views/catalog/_bookmark_control.html.erb +2 -2
- data/app/views/layouts/blacklight.html.erb +0 -6
- data/blacklight.gemspec +1 -1
- data/lib/blacklight/configuration/field.rb +2 -0
- data/lib/generators/blacklight/solr5_generator.rb +1 -1
- data/lib/generators/blacklight/user_generator.rb +2 -2
- data/spec/controllers/alternate_controller_spec.rb +0 -1
- data/spec/controllers/application_controller_spec.rb +0 -1
- data/spec/controllers/blacklight/base_spec.rb +0 -1
- data/spec/controllers/blacklight/catalog/component_configuration_spec.rb +0 -1
- data/spec/controllers/blacklight/facet_spec.rb +0 -1
- data/spec/controllers/blacklight/search_fields_spec.rb +0 -1
- data/spec/controllers/blacklight/search_helper_spec.rb +0 -1
- data/spec/controllers/blacklight/suggest_search_spec.rb +0 -1
- data/spec/controllers/bookmarks_controller_spec.rb +0 -1
- data/spec/controllers/catalog_controller_spec.rb +0 -1
- data/spec/controllers/saved_searches_controller_spec.rb +0 -1
- data/spec/controllers/search_history_controller_spec.rb +0 -1
- data/spec/controllers/suggest_controller_spec.rb +0 -1
- data/spec/features/alternate_controller_spec.rb +0 -1
- data/spec/features/bookmarks_spec.rb +0 -1
- data/spec/features/did_you_mean_spec.rb +0 -1
- data/spec/features/facets_spec.rb +0 -1
- data/spec/features/record_view_spec.rb +0 -1
- data/spec/features/saved_searches_spec.rb +0 -1
- data/spec/features/search_context_spec.rb +0 -1
- data/spec/features/search_filters_spec.rb +0 -1
- data/spec/features/search_formats_spec.rb +0 -1
- data/spec/features/search_history_spec.rb +0 -1
- data/spec/features/search_pagination_spec.rb +0 -1
- data/spec/features/search_results_spec.rb +0 -1
- data/spec/features/search_sort_spec.rb +0 -1
- data/spec/features/search_spec.rb +0 -1
- data/spec/features/sitelinks_search_box.rb +0 -1
- data/spec/helpers/blacklight_helper_spec.rb +95 -153
- data/spec/helpers/catalog_helper_spec.rb +0 -1
- data/spec/helpers/configuration_helper_spec.rb +0 -1
- data/spec/helpers/deprecated_url_helper_behavior_spec.rb +0 -1
- data/spec/helpers/facets_helper_spec.rb +83 -117
- data/spec/helpers/hash_as_hidden_fields_spec.rb +0 -1
- data/spec/helpers/layout_helper_spec.rb +0 -1
- data/spec/helpers/render_constraints_helper_spec.rb +0 -1
- data/spec/helpers/search_history_constraints_helper_spec.rb +0 -1
- data/spec/helpers/suggest_helper_spec.rb +0 -1
- data/spec/helpers/url_helper_spec.rb +0 -1
- data/spec/lib/blacklight/parameters_spec.rb +0 -1
- data/spec/lib/blacklight/search_state_spec.rb +0 -1
- data/spec/lib/blacklight/utils_spec.rb +0 -1
- data/spec/lib/blacklight_spec.rb +0 -1
- data/spec/lib/tasks/blacklight_task_spec.rb +0 -1
- data/spec/models/blacklight/configurable_spec.rb +0 -1
- data/spec/models/blacklight/configuration/context_spec.rb +0 -1
- data/spec/models/blacklight/configuration_spec.rb +0 -1
- data/spec/models/blacklight/document/active_model_shim_spec.rb +0 -1
- data/spec/models/blacklight/document/cache_key_spec.rb +0 -1
- data/spec/models/blacklight/document/dublin_core_spec.rb +0 -1
- data/spec/models/blacklight/document/email_spec.rb +0 -1
- data/spec/models/blacklight/document/sms_spec.rb +0 -1
- data/spec/models/blacklight/document_spec.rb +0 -1
- data/spec/models/blacklight/facet_paginator_spec.rb +0 -1
- data/spec/models/blacklight/search_builder_spec.rb +0 -1
- data/spec/models/blacklight/solr/document/more_like_this_spec.rb +0 -1
- data/spec/models/blacklight/solr/document_spec.rb +0 -1
- data/spec/models/blacklight/solr/facet_paginator_spec.rb +0 -1
- data/spec/models/blacklight/solr/repository_spec.rb +0 -1
- data/spec/models/blacklight/solr/request_spec.rb +0 -1
- data/spec/models/blacklight/solr/response/facets_spec.rb +0 -1
- data/spec/models/blacklight/solr/response_spec.rb +0 -1
- data/spec/models/blacklight/solr/search_builder_spec.rb +0 -1
- data/spec/models/blacklight/suggest/response_spec.rb +0 -1
- data/spec/models/blacklight/user_spec.rb +0 -1
- data/spec/models/bookmark_spec.rb +0 -1
- data/spec/models/record_mailer_spec.rb +0 -1
- data/spec/models/search_spec.rb +0 -1
- data/spec/models/solr_document_spec.rb +0 -1
- data/spec/presenters/document_presenter_spec.rb +0 -1
- data/spec/presenters/index_presenter_spec.rb +0 -1
- data/spec/presenters/pipeline_spec.rb +0 -1
- data/spec/presenters/show_presenter_spec.rb +0 -1
- data/spec/spec_helper.rb +5 -8
- data/spec/test_app_templates/Gemfile.extra +1 -1
- data/spec/views/_user_util_links.html.erb_spec.rb +0 -1
- data/spec/views/catalog/_constraints.html.erb_spec.rb +0 -1
- data/spec/views/catalog/_constraints_element.html.erb_spec.rb +0 -5
- data/spec/views/catalog/_document.html.erb_spec.rb +3 -14
- data/spec/views/catalog/_document_list.html.erb_spec.rb +1 -4
- data/spec/views/catalog/_facet_index_navigation.html.erb_spec.rb +0 -3
- data/spec/views/catalog/_facet_layout.html.erb_spec.rb +2 -7
- data/spec/views/catalog/_facets.html.erb_spec.rb +6 -14
- data/spec/views/catalog/_index_default.erb_spec.rb +4 -7
- data/spec/views/catalog/_index_header_default.html.erb_spec.rb +2 -5
- data/spec/views/catalog/_paginate_compact.html.erb_spec.rb +3 -5
- data/spec/views/catalog/_search_header.erb_spec.rb +0 -2
- data/spec/views/catalog/_show_default.erb_spec.rb +7 -11
- data/spec/views/catalog/_show_sidebar.erb_spec.rb +0 -1
- data/spec/views/catalog/_show_tools.html.erb_spec.rb +3 -13
- data/spec/views/catalog/_sort_and_per_page.html.erb_spec.rb +1 -5
- data/spec/views/catalog/_thumbnail_default.erb_spec.rb +0 -1
- data/spec/views/catalog/_view_type_group.html.erb_spec.rb +3 -11
- data/spec/views/catalog/facet.html.erb_spec.rb +0 -1
- data/spec/views/catalog/facet.json.jbuilder_spec.rb +0 -1
- data/spec/views/catalog/index.atom.builder_spec.rb +21 -36
- data/spec/views/catalog/index.html.erb_spec.rb +0 -3
- data/spec/views/catalog/index.json.jbuilder_spec.rb +0 -1
- data/spec/views/catalog/opensearch.xml.builder_spec.rb +0 -1
- data/spec/views/catalog/show.html.erb_spec.rb +2 -13
- metadata +6 -8
- data/spec/spec.opts +0 -4
data/spec/spec_helper.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
|
3
3
|
# Has been customized by Blacklight to work when application is in one place,
|
|
4
|
-
# and actual spec/ stuff is in another (the blacklight gem checkout).
|
|
4
|
+
# and actual spec/ stuff is in another (the blacklight gem checkout).
|
|
5
5
|
|
|
6
6
|
ENV["RAILS_ENV"] ||= 'test'
|
|
7
7
|
|
|
@@ -27,21 +27,18 @@ require 'rspec/collection_matchers'
|
|
|
27
27
|
require 'capybara/rspec'
|
|
28
28
|
require 'capybara/poltergeist'
|
|
29
29
|
|
|
30
|
-
|
|
31
30
|
Capybara.javascript_driver = :poltergeist
|
|
32
31
|
|
|
33
32
|
Capybara.register_driver :poltergeist do |app|
|
|
34
33
|
options = {}
|
|
35
|
-
|
|
36
34
|
options[:timeout] = 120 if RUBY_PLATFORM == "java"
|
|
37
|
-
|
|
38
35
|
Capybara::Poltergeist::Driver.new(app, options)
|
|
39
36
|
end
|
|
40
37
|
|
|
41
38
|
# Requires supporting ruby files with custom matchers and macros, etc,
|
|
42
39
|
# in spec/support/ and its subdirectories.
|
|
43
|
-
# Blacklight, again, make sure we're looking in the right place for em.
|
|
44
|
-
# Relative to HERE, NOT to Rails.root, which is off somewhere else.
|
|
40
|
+
# Blacklight, again, make sure we're looking in the right place for em.
|
|
41
|
+
# Relative to HERE, NOT to Rails.root, which is off somewhere else.
|
|
45
42
|
Dir[Pathname.new(File.expand_path("../support/**/*.rb", __FILE__))].each {|f| require f}
|
|
46
43
|
|
|
47
44
|
RSpec.configure do |config|
|
|
@@ -53,12 +50,12 @@ RSpec.configure do |config|
|
|
|
53
50
|
# instead of true.
|
|
54
51
|
config.use_transactional_fixtures = true
|
|
55
52
|
|
|
56
|
-
if
|
|
57
|
-
# This is for an unreleased version of Devise (will either be 4.2 or 5.0)
|
|
53
|
+
if defined? Devise::Test::ControllerHelpers
|
|
58
54
|
config.include Devise::Test::ControllerHelpers, type: :controller
|
|
59
55
|
else
|
|
60
56
|
config.include Devise::TestHelpers, type: :controller
|
|
61
57
|
end
|
|
58
|
+
|
|
62
59
|
config.infer_spec_type_from_file_location!
|
|
63
60
|
|
|
64
61
|
config.include(ControllerLevelHelpers, type: :helper)
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
-
require 'spec_helper'
|
|
3
2
|
|
|
4
3
|
describe "catalog/_constraints_element.html.erb" do
|
|
5
4
|
describe "for simple display" do
|
|
@@ -25,7 +24,6 @@ describe "catalog/_constraints_element.html.erb" do
|
|
|
25
24
|
expect(s).to have_selector(".remove[href='http://remove']")
|
|
26
25
|
end
|
|
27
26
|
end
|
|
28
|
-
|
|
29
27
|
it "has an accessible remove label" do
|
|
30
28
|
expect(rendered).to have_selector(".remove") do |s|
|
|
31
29
|
expect(s).to have_content("Remove constraint my label: my value")
|
|
@@ -50,8 +48,5 @@ describe "catalog/_constraints_element.html.erb" do
|
|
|
50
48
|
expect(rendered).to have_selector("span.appliedFilter.constraint span.filterName span.custom_label")
|
|
51
49
|
expect(rendered).to have_selector("span.appliedFilter.constraint span.filterValue span.custom_value")
|
|
52
50
|
end
|
|
53
|
-
|
|
54
51
|
end
|
|
55
|
-
|
|
56
|
-
|
|
57
52
|
end
|
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
-
require 'spec_helper'
|
|
3
2
|
|
|
4
3
|
describe "catalog/_document" do
|
|
5
|
-
let
|
|
6
|
-
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
let :blacklight_config do
|
|
10
|
-
Blacklight::Configuration.new
|
|
11
|
-
end
|
|
4
|
+
let(:document) { SolrDocument.new :id => 'xyz', :format => 'a' }
|
|
5
|
+
let(:blacklight_config) { Blacklight::Configuration.new }
|
|
12
6
|
|
|
13
7
|
before do
|
|
14
8
|
allow(view).to receive(:render_grouped_response?).and_return(false)
|
|
@@ -27,7 +21,6 @@ describe "catalog/_document" do
|
|
|
27
21
|
expect(rendered).to have_selector('div.document[@itemtype="http://schema.org/Thing"]')
|
|
28
22
|
end
|
|
29
23
|
|
|
30
|
-
|
|
31
24
|
it "uses the index.partials parameter to determine the partials to render" do
|
|
32
25
|
blacklight_config.index.partials = ['a', 'b', 'c']
|
|
33
26
|
stub_template "catalog/_a_default.html.erb" => "a_partial"
|
|
@@ -41,17 +34,13 @@ describe "catalog/_document" do
|
|
|
41
34
|
|
|
42
35
|
it 'has a css class with the document position' do
|
|
43
36
|
allow(view).to receive(:render_document_partials)
|
|
44
|
-
|
|
45
37
|
render partial: 'catalog/document', locals: { document: document, document_counter: 5 }
|
|
46
|
-
|
|
47
38
|
expect(rendered).to have_selector 'div.document-position-5'
|
|
48
39
|
end
|
|
49
40
|
|
|
50
41
|
it 'has a data attribute with the document position' do
|
|
51
42
|
allow(view).to receive(:render_document_partials)
|
|
52
|
-
|
|
53
43
|
render partial: 'catalog/document', locals: { document: document, document_counter: 5 }
|
|
54
|
-
|
|
55
44
|
expect(rendered).to have_selector 'div.document[@data-document-counter="5"]'
|
|
56
45
|
end
|
|
57
|
-
end
|
|
46
|
+
end
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
-
require 'spec_helper'
|
|
3
|
-
|
|
4
|
-
describe "catalog/_document_list", type: :view do
|
|
5
2
|
|
|
3
|
+
describe "catalog/_document_list", type: :view do
|
|
6
4
|
before do
|
|
7
5
|
allow(view).to receive_messages(document_index_view_type: "some-view", documents: [])
|
|
8
6
|
end
|
|
9
|
-
|
|
10
7
|
it "includes a class for the current view" do
|
|
11
8
|
render
|
|
12
9
|
expect(rendered).to have_selector(".documents-some-view")
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
-
require 'spec_helper'
|
|
3
2
|
|
|
4
3
|
describe 'catalog/_facet_index_navigation.html.erb', type: :view do
|
|
5
4
|
let(:pagination) { Blacklight::Solr::FacetPaginator.new([]) }
|
|
@@ -15,7 +14,6 @@ describe 'catalog/_facet_index_navigation.html.erb', type: :view do
|
|
|
15
14
|
|
|
16
15
|
it 'renders the facet index navigation range' do
|
|
17
16
|
render
|
|
18
|
-
|
|
19
17
|
expect(rendered).to have_selector '.pagination'
|
|
20
18
|
expect(rendered).to have_link '0', href: '/?facet.prefix=0&facet.sort=index'
|
|
21
19
|
expect(rendered).to have_link '1'
|
|
@@ -35,7 +33,6 @@ describe 'catalog/_facet_index_navigation.html.erb', type: :view do
|
|
|
35
33
|
render
|
|
36
34
|
expect(rendered).to have_selector '.active', text: '5'
|
|
37
35
|
end
|
|
38
|
-
|
|
39
36
|
it 'enables the clear facets button' do
|
|
40
37
|
render
|
|
41
38
|
expect(rendered).to have_link 'Clear Filter'
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
-
require 'spec_helper'
|
|
3
2
|
|
|
4
3
|
describe "catalog/facet_layout" do
|
|
5
|
-
|
|
6
4
|
let :blacklight_config do
|
|
7
5
|
Blacklight::Configuration.new do |config|
|
|
8
6
|
config.facet_fields[facet_field.field] = facet_field
|
|
@@ -19,7 +17,7 @@ describe "catalog/facet_layout" do
|
|
|
19
17
|
|
|
20
18
|
it "has a facet-specific class" do
|
|
21
19
|
render partial: 'catalog/facet_layout', locals: { facet_field: facet_field }
|
|
22
|
-
expect(rendered).to have_selector '.blacklight-some_field'
|
|
20
|
+
expect(rendered).to have_selector '.blacklight-some_field'
|
|
23
21
|
end
|
|
24
22
|
|
|
25
23
|
it "has a title with a link for a11y" do
|
|
@@ -38,8 +36,5 @@ describe "catalog/facet_layout" do
|
|
|
38
36
|
render partial: 'catalog/facet_layout', locals: { facet_field: facet_field }
|
|
39
37
|
expect(rendered).to_not have_selector '.panel-heading.collapsed'
|
|
40
38
|
expect(rendered).to have_selector '.in .panel-body'
|
|
41
|
-
|
|
42
39
|
end
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
end
|
|
40
|
+
end
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
-
require 'spec_helper'
|
|
3
2
|
|
|
4
3
|
describe "catalog/_facets" do
|
|
5
4
|
let(:blacklight_config) { Blacklight::Configuration.new }
|
|
@@ -26,13 +25,10 @@ describe "catalog/_facets" do
|
|
|
26
25
|
|
|
27
26
|
before do
|
|
28
27
|
blacklight_config.facet_fields['facet_field_1'] = facet_field
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
@response = double()
|
|
35
|
-
allow(@response).to receive(:aggregations).and_return("facet_field_1" => @mock_display_facet_1)
|
|
28
|
+
@mock_display_facet_1 = double(:name => 'facet_field_1', sort: nil, offset: nil, prefix: nil, :items => [Blacklight::Solr::Response::Facets::FacetItem.new(:value => 'Value', :hits => 1234)])
|
|
29
|
+
allow(view).to receive_messages(:facet_field_names => [:facet_field_1], :facet_limit_for => 10)
|
|
30
|
+
@response = double()
|
|
31
|
+
allow(@response).to receive(:aggregations).and_return("facet_field_1" => @mock_display_facet_1)
|
|
36
32
|
end
|
|
37
33
|
|
|
38
34
|
it "has a header" do
|
|
@@ -41,23 +37,19 @@ describe "catalog/_facets" do
|
|
|
41
37
|
expect(rendered).to have_selector('.facets-heading')
|
|
42
38
|
end
|
|
43
39
|
|
|
44
|
-
|
|
45
40
|
describe "facet display" do
|
|
46
41
|
it "has a(n accessible) header" do
|
|
47
42
|
render
|
|
48
43
|
expect(rendered).to have_selector('.facet-field-heading')
|
|
49
44
|
end
|
|
50
|
-
|
|
51
45
|
it "lists values" do
|
|
52
46
|
render
|
|
53
|
-
|
|
54
47
|
# The .facet-content class is used by blacklight_range_limit js, and
|
|
55
48
|
# should be applied to the .panel-collapse div that contains the collapsible
|
|
56
|
-
# facet content. Please make sure it remains if possible.
|
|
49
|
+
# facet content. Please make sure it remains if possible.
|
|
57
50
|
expect(rendered).to have_selector('.facet-content a.facet_select')
|
|
58
|
-
expect(rendered).to have_selector('.facet-content .facet-count')
|
|
51
|
+
expect(rendered).to have_selector('.facet-content .facet-count')
|
|
59
52
|
end
|
|
60
53
|
end
|
|
61
54
|
end
|
|
62
55
|
end
|
|
63
|
-
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
-
require 'spec_helper'
|
|
3
2
|
|
|
4
|
-
# spec for default partial to display solr document fields
|
|
5
|
-
# in catalog INDEX view
|
|
3
|
+
# spec for default partial to display solr document fields in catalog INDEX view
|
|
6
4
|
|
|
7
5
|
describe "/catalog/_index_default.erb" do
|
|
8
6
|
include BlacklightHelper
|
|
@@ -22,7 +20,6 @@ describe "/catalog/_index_default.erb" do
|
|
|
22
20
|
@fname_3 = "empty_field"
|
|
23
21
|
@fname_4 = "four_field"
|
|
24
22
|
|
|
25
|
-
|
|
26
23
|
@document = SolrDocument.new(id: 1, @fname_1 => "val_1", @fname_2 => "val2", @fname_4 => "val_4")
|
|
27
24
|
|
|
28
25
|
@flabel_1 = "One:"
|
|
@@ -38,7 +35,7 @@ describe "/catalog/_index_default.erb" do
|
|
|
38
35
|
expect(@rendered).to_not include("val_2")
|
|
39
36
|
expect(@rendered).to_not include(@fname_2)
|
|
40
37
|
end
|
|
41
|
-
|
|
38
|
+
|
|
42
39
|
it "skips over fields listed in initializer that are not in solr response" do
|
|
43
40
|
expect(@rendered).to_not include(@fname_3)
|
|
44
41
|
end
|
|
@@ -47,11 +44,11 @@ describe "/catalog/_index_default.erb" do
|
|
|
47
44
|
# labels
|
|
48
45
|
expect(@rendered).to include(@flabel_1)
|
|
49
46
|
expect(@rendered).to include(@flabel_4)
|
|
50
|
-
# classes
|
|
47
|
+
# classes
|
|
51
48
|
expect(@rendered).to include("blacklight-#{@fname_1}")
|
|
52
49
|
expect(@rendered).to include("blacklight-#{@fname_4}")
|
|
53
50
|
end
|
|
54
|
-
|
|
51
|
+
|
|
55
52
|
# this test probably belongs in a Cucumber feature
|
|
56
53
|
# it "should display fields in the order listed in the initializer" do
|
|
57
54
|
# pending
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
-
require 'spec_helper'
|
|
3
2
|
|
|
4
3
|
describe "catalog/_index_header_default" do
|
|
5
4
|
let :document do
|
|
6
5
|
SolrDocument.new :id => 'xyz', :format => 'a'
|
|
7
6
|
end
|
|
8
7
|
|
|
9
|
-
let
|
|
10
|
-
Blacklight::Configuration.new
|
|
11
|
-
end
|
|
8
|
+
let(:blacklight_config) { Blacklight::Configuration.new }
|
|
12
9
|
|
|
13
10
|
before do
|
|
14
11
|
allow(controller).to receive(:action_name).and_return('index')
|
|
@@ -30,7 +27,7 @@ describe "catalog/_index_header_default" do
|
|
|
30
27
|
render partial: "catalog/index_header_default", locals: {document: document, document_counter: 1}
|
|
31
28
|
expect(rendered).to have_selector '.index_title.col-md-12'
|
|
32
29
|
end
|
|
33
|
-
|
|
30
|
+
|
|
34
31
|
it "gives the document actions space if present" do
|
|
35
32
|
allow(view).to receive(:render_index_doc_actions).and_return("DOCUMENT ACTIONS")
|
|
36
33
|
render partial: "catalog/index_header_default", locals: {document: document, document_counter: 1}
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
-
require 'spec_helper'
|
|
3
2
|
|
|
4
3
|
describe "catalog/_paginate_compact.html.erb" do
|
|
5
4
|
let(:user) { User.new.tap { |u| u.save(validate: false) } }
|
|
6
|
-
|
|
5
|
+
|
|
7
6
|
before do
|
|
8
7
|
controller.request.path_parameters[:action] = 'index'
|
|
9
8
|
end
|
|
10
9
|
|
|
11
|
-
describe "with a real solr response", :integration => true do
|
|
10
|
+
describe "with a real solr response", :integration => true do
|
|
12
11
|
def blacklight_config
|
|
13
12
|
@config ||= CatalogController.blacklight_config
|
|
14
13
|
end
|
|
15
|
-
|
|
14
|
+
|
|
16
15
|
def blacklight_config=(config)
|
|
17
16
|
@config = config
|
|
18
17
|
end
|
|
@@ -25,7 +24,6 @@ describe "catalog/_paginate_compact.html.erb" do
|
|
|
25
24
|
|
|
26
25
|
it "renders solr responses" do
|
|
27
26
|
solr_response, document_list = search_results(q: '')
|
|
28
|
-
|
|
29
27
|
render :partial => 'catalog/paginate_compact', :object => solr_response
|
|
30
28
|
expect(rendered).to have_selector ".page_entries"
|
|
31
29
|
expect(rendered).to have_selector "a[@rel=next]"
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
-
require 'spec_helper'
|
|
3
2
|
|
|
4
3
|
# spec for sidebar partial in catalog show view
|
|
5
4
|
|
|
6
5
|
describe "/catalog/_search_header.html.erb" do
|
|
7
|
-
|
|
8
6
|
it "renders the default search header partials" do
|
|
9
7
|
stub_template "_did_you_mean.html.erb" => "did_you_mean"
|
|
10
8
|
stub_template "_constraints.html.erb" => "constraints"
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
-
require 'spec_helper'
|
|
3
2
|
|
|
4
|
-
# spec for default partial to display solr document fields
|
|
5
|
-
# in catalog show view
|
|
3
|
+
# spec for default partial to display solr document fields in catalog show view
|
|
6
4
|
|
|
7
5
|
describe "/catalog/_show_default.html.erb" do
|
|
8
|
-
|
|
6
|
+
|
|
9
7
|
include BlacklightHelper
|
|
10
8
|
include CatalogHelper
|
|
11
9
|
|
|
12
|
-
|
|
13
10
|
before(:each) do
|
|
14
11
|
allow(controller).to receive(:action_name).and_return('show')
|
|
15
12
|
@config = Blacklight::Configuration.new do |config|
|
|
@@ -23,9 +20,9 @@ describe "/catalog/_show_default.html.erb" do
|
|
|
23
20
|
@fname_2 = "solr_field_not_in_config"
|
|
24
21
|
@fname_3 = "empty_field"
|
|
25
22
|
@fname_4 = "four_field"
|
|
26
|
-
|
|
23
|
+
|
|
27
24
|
@document = SolrDocument.new(id: 1, @fname_1 => "val_1", @fname_2 => "val2", @fname_4 => "val_4")
|
|
28
|
-
|
|
25
|
+
|
|
29
26
|
@flabel_1 = "One:"
|
|
30
27
|
@flabel_3 = "Two:"
|
|
31
28
|
@flabel_4 = "Four:"
|
|
@@ -39,7 +36,7 @@ describe "/catalog/_show_default.html.erb" do
|
|
|
39
36
|
expect(@rendered).to_not include("val_2")
|
|
40
37
|
expect(@rendered).to_not include(@fname_2)
|
|
41
38
|
end
|
|
42
|
-
|
|
39
|
+
|
|
43
40
|
it "skips over fields listed in initializer that are not in solr response" do
|
|
44
41
|
expect(@rendered).to_not include(@fname_3)
|
|
45
42
|
end
|
|
@@ -48,11 +45,11 @@ describe "/catalog/_show_default.html.erb" do
|
|
|
48
45
|
# labels
|
|
49
46
|
expect(@rendered).to include(@flabel_1)
|
|
50
47
|
expect(@rendered).to include(@flabel_4)
|
|
51
|
-
# classes
|
|
48
|
+
# classes
|
|
52
49
|
expect(@rendered).to include("blacklight-#{@fname_1}")
|
|
53
50
|
expect(@rendered).to include("blacklight-#{@fname_4}")
|
|
54
51
|
end
|
|
55
|
-
|
|
52
|
+
|
|
56
53
|
# this test probably belongs in a Cucumber feature
|
|
57
54
|
# it "should display fields in the order listed in the initializer" do
|
|
58
55
|
# pending
|
|
@@ -63,5 +60,4 @@ describe "/catalog/_show_default.html.erb" do
|
|
|
63
60
|
expect(@rendered).to include("val_4")
|
|
64
61
|
expect(@rendered).to_not include("val_2")
|
|
65
62
|
end
|
|
66
|
-
|
|
67
63
|
end
|
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
-
require 'spec_helper'
|
|
3
2
|
|
|
4
3
|
describe "catalog/_show_tools.html.erb" do
|
|
5
|
-
let
|
|
6
|
-
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
let :blacklight_config do
|
|
10
|
-
Blacklight::Configuration.new
|
|
11
|
-
end
|
|
4
|
+
let(:document) { SolrDocument.new :id => 'xyz', :format => 'a' }
|
|
5
|
+
let(:blacklight_config) { Blacklight::Configuration.new }
|
|
12
6
|
|
|
13
7
|
before do
|
|
14
8
|
assign :response, double(:params => {})
|
|
@@ -18,11 +12,7 @@ describe "catalog/_show_tools.html.erb" do
|
|
|
18
12
|
end
|
|
19
13
|
|
|
20
14
|
describe "document actions" do
|
|
21
|
-
|
|
22
|
-
let :document_actions do
|
|
23
|
-
blacklight_config.show.document_actions
|
|
24
|
-
end
|
|
25
|
-
|
|
15
|
+
let(:document_actions) { blacklight_config.show.document_actions }
|
|
26
16
|
|
|
27
17
|
it "renders a document action" do
|
|
28
18
|
allow(view).to receive(:some_action_solr_document_path).with(document).and_return "x"
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
-
require 'spec_helper'
|
|
3
2
|
|
|
4
3
|
describe "catalog/_sort_and_per_page" do
|
|
5
|
-
|
|
6
|
-
let :blacklight_config do
|
|
7
|
-
Blacklight::Configuration.new
|
|
8
|
-
end
|
|
4
|
+
let(:blacklight_config) { Blacklight::Configuration.new }
|
|
9
5
|
|
|
10
6
|
before do
|
|
11
7
|
blacklight_config.add_results_collection_tool(:sort_widget)
|
|
@@ -1,19 +1,13 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
-
require 'spec_helper'
|
|
3
2
|
|
|
4
3
|
describe "catalog/_view_type_group" do
|
|
5
|
-
|
|
6
|
-
let :blacklight_config do
|
|
7
|
-
Blacklight::Configuration.new
|
|
8
|
-
end
|
|
4
|
+
let(:blacklight_config) { Blacklight::Configuration.new }
|
|
9
5
|
|
|
10
6
|
before do
|
|
11
7
|
allow(view).to receive(:view_label) do |view|
|
|
12
8
|
view.to_s
|
|
13
9
|
end
|
|
14
|
-
|
|
15
10
|
allow(view).to receive_messages(how_sort_and_per_page?: true, blacklight_config: blacklight_config)
|
|
16
|
-
|
|
17
11
|
controller.request.path_parameters[:action] = 'index'
|
|
18
12
|
end
|
|
19
13
|
|
|
@@ -27,7 +21,7 @@ describe "catalog/_view_type_group" do
|
|
|
27
21
|
assign(:response, [double])
|
|
28
22
|
blacklight_config.configure do |config|
|
|
29
23
|
config.view.delete(:list)
|
|
30
|
-
config.view.a
|
|
24
|
+
config.view.a
|
|
31
25
|
config.view.b
|
|
32
26
|
config.view.c
|
|
33
27
|
end
|
|
@@ -38,12 +32,11 @@ describe "catalog/_view_type_group" do
|
|
|
38
32
|
expect(rendered).to have_selector('.view-type-c', :text => 'c')
|
|
39
33
|
end
|
|
40
34
|
|
|
41
|
-
|
|
42
35
|
it "sets the current view to 'active'" do
|
|
43
36
|
assign(:response, [double])
|
|
44
37
|
blacklight_config.configure do |config|
|
|
45
38
|
config.view.delete(:list)
|
|
46
|
-
config.view.a
|
|
39
|
+
config.view.a
|
|
47
40
|
config.view.b
|
|
48
41
|
end
|
|
49
42
|
render partial: 'catalog/view_type_group'
|
|
@@ -51,5 +44,4 @@ describe "catalog/_view_type_group" do
|
|
|
51
44
|
expect(rendered).to_not have_selector('.active', :text => 'b')
|
|
52
45
|
expect(rendered).to have_selector('.btn', :text => 'b')
|
|
53
46
|
end
|
|
54
|
-
|
|
55
47
|
end
|
|
@@ -1,36 +1,29 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
-
require 'spec_helper'
|
|
3
2
|
require 'rexml/document'
|
|
4
3
|
|
|
5
4
|
describe "catalog/index" do
|
|
6
|
-
|
|
7
|
-
before(:all) do
|
|
8
|
-
@response = Blacklight::Solr::Response.new({ response: { numFound: 30 }}, { start: 10, rows: 10})
|
|
9
|
-
@config = CatalogController.blacklight_config
|
|
10
|
-
end
|
|
11
|
-
|
|
12
5
|
let(:document_list) do
|
|
13
|
-
10.times.map
|
|
6
|
+
10.times.map do |i|
|
|
7
|
+
doc = SolrDocument.new(id: i)
|
|
8
|
+
allow(doc).to receive(:export_as_some_format).and_return("")
|
|
9
|
+
allow(doc).to receive(:to_semantic_values).and_return(author: ['xyz']) if i == 0
|
|
10
|
+
doc.will_export_as(:some_format, "application/some-format") if i == 1
|
|
11
|
+
doc
|
|
12
|
+
end
|
|
14
13
|
end
|
|
15
14
|
|
|
16
15
|
before do
|
|
17
|
-
|
|
18
|
-
params['content_format'] = 'some_format'
|
|
16
|
+
@response = Blacklight::Solr::Response.new({ response: { numFound: 30 }}, { start: 10, rows: 10})
|
|
19
17
|
@document_list = document_list
|
|
20
|
-
|
|
21
|
-
allow(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
allow(view).to receive(:blacklight_config).and_return(@config)
|
|
18
|
+
params['content_format'] = 'some_format'
|
|
19
|
+
allow(view).to receive(:action_name).and_return('index')
|
|
20
|
+
allow(view).to receive(:blacklight_config).and_return(CatalogController.blacklight_config)
|
|
25
21
|
allow(view).to receive(:search_field_options_for_select).and_return([])
|
|
26
|
-
|
|
27
22
|
render template: 'catalog/index', formats: [:atom]
|
|
28
23
|
end
|
|
29
24
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
REXML::Document.new(rendered)
|
|
33
|
-
end
|
|
25
|
+
# We need to use rexml to test certain things that have_tag wont' test
|
|
26
|
+
let(:response_xml) { REXML::Document.new(rendered) }
|
|
34
27
|
|
|
35
28
|
it "has contextual information" do
|
|
36
29
|
expect(rendered).to have_selector("link[rel=self]")
|
|
@@ -80,29 +73,23 @@ describe "catalog/index" do
|
|
|
80
73
|
end
|
|
81
74
|
|
|
82
75
|
describe "with an author" do
|
|
83
|
-
|
|
84
|
-
@entry = response_xml.elements.to_a("/feed/entry")[0]
|
|
85
|
-
end
|
|
76
|
+
let(:entry) { response_xml.elements.to_a("/feed/entry")[0] }
|
|
86
77
|
it "has author tag" do
|
|
87
|
-
expect(
|
|
78
|
+
expect(entry.elements["author/name"].text).to eq 'xyz'
|
|
88
79
|
end
|
|
89
80
|
end
|
|
90
81
|
|
|
91
82
|
describe "without an author" do
|
|
92
|
-
|
|
93
|
-
@entry = response_xml.elements.to_a("/feed/entry")[1]
|
|
94
|
-
end
|
|
83
|
+
let(:entry) { response_xml.elements.to_a("/feed/entry")[1] }
|
|
95
84
|
it "does not have an author tag" do
|
|
96
|
-
expect(
|
|
85
|
+
expect(entry.elements["author/name"]).to be_nil
|
|
97
86
|
end
|
|
98
87
|
end
|
|
99
88
|
end
|
|
100
89
|
|
|
101
90
|
describe "when content_format is specified" do
|
|
102
91
|
describe "for an entry with content available" do
|
|
103
|
-
let(:entry)
|
|
104
|
-
response_xml.elements.to_a("/feed/entry")[1].to_s
|
|
105
|
-
end
|
|
92
|
+
let(:entry) { response_xml.elements.to_a("/feed/entry")[1].to_s }
|
|
106
93
|
it "includes a link rel tag" do
|
|
107
94
|
expect(entry).to have_selector("link[rel=alternate][type='application/some-format']")
|
|
108
95
|
end
|
|
@@ -111,11 +98,9 @@ describe "catalog/index" do
|
|
|
111
98
|
end
|
|
112
99
|
end
|
|
113
100
|
describe "for an entry with NO content available" do
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
it "includes content" do
|
|
118
|
-
expect(@entry.to_s).to_not have_selector("content[type='application/some-format']")
|
|
101
|
+
let(:entry) { response_xml.elements.to_a("/feed/entry")[5].to_s }
|
|
102
|
+
it "does not have content embedded" do
|
|
103
|
+
expect(entry).to_not have_selector("content[type='application/some-format']")
|
|
119
104
|
end
|
|
120
105
|
end
|
|
121
106
|
end
|