blacklight 4.7.0 → 4.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +13 -12
- data/Gemfile +37 -2
- data/VERSION +1 -1
- data/app/assets/stylesheets/blacklight/{_blacklight_base.css.scss → _blacklight_base.scss} +0 -0
- data/app/assets/stylesheets/blacklight/{_bookmark.css.scss → _bookmark.scss} +0 -0
- data/app/assets/stylesheets/blacklight/{_catalog.css.scss → _catalog.scss} +0 -0
- data/app/assets/stylesheets/blacklight/{_dropdown.css.scss → _dropdown.scss} +0 -0
- data/app/assets/stylesheets/blacklight/{_facets.css.scss → _facets.scss} +0 -0
- data/app/assets/stylesheets/blacklight/{_footer.css.scss → _footer.scss} +0 -0
- data/app/assets/stylesheets/blacklight/{_group.css.scss → _group.scss} +0 -0
- data/app/assets/stylesheets/blacklight/{_header.css.scss → _header.scss} +0 -0
- data/app/assets/stylesheets/blacklight/{_layout.css.scss → _layout.scss} +0 -0
- data/app/assets/stylesheets/blacklight/{_mixins.css.scss → _mixins.scss} +0 -0
- data/app/assets/stylesheets/blacklight/{_modal.css.scss → _modal.scss} +0 -0
- data/app/assets/stylesheets/blacklight/{_print.css.scss → _print.scss} +0 -0
- data/app/assets/stylesheets/blacklight/{_responsive.css.scss → _responsive.scss} +0 -0
- data/app/assets/stylesheets/blacklight/{_search_history.css.scss → _search_history.scss} +0 -0
- data/app/assets/stylesheets/blacklight/{blacklight.css.scss → blacklight.scss} +0 -0
- data/app/assets/stylesheets/blacklight/{blacklight_defaults.css.scss → blacklight_defaults.scss} +0 -0
- data/app/assets/stylesheets/blacklight/responsive_partials/{_catalog.css.scss → _catalog.scss} +0 -0
- data/app/assets/stylesheets/blacklight/responsive_partials/{_facets.css.scss → _facets.scss} +0 -0
- data/app/assets/stylesheets/blacklight/responsive_partials/{_header.css.scss → _header.scss} +0 -0
- data/app/helpers/blacklight/blacklight_helper_behavior.rb +2 -2
- data/app/helpers/blacklight/catalog_helper_behavior.rb +1 -1
- data/app/helpers/blacklight/facets_helper_behavior.rb +1 -0
- data/app/helpers/blacklight/search_history_constraints_helper_behavior.rb +2 -2
- data/blacklight.gemspec +5 -6
- data/lib/blacklight/catalog.rb +1 -1
- data/lib/blacklight/catalog/search_context.rb +6 -6
- data/lib/blacklight/solr/document.rb +29 -21
- data/lib/blacklight/solr_helper.rb +6 -4
- data/lib/generators/blacklight/templates/{blacklight.css.scss → blacklight.scss} +0 -0
- data/spec/controllers/application_controller_spec.rb +3 -3
- data/spec/controllers/bookmarks_controller_spec.rb +11 -11
- data/spec/controllers/catalog_controller_spec.rb +117 -117
- data/spec/controllers/search_history_controller_spec.rb +8 -8
- data/spec/features/alternate_controller_spec.rb +7 -5
- data/spec/features/record_view_spec.rb +4 -1
- data/spec/features/search_filters_spec.rb +37 -24
- data/spec/features/search_pagination_spec.rb +11 -7
- data/spec/features/search_results_spec.rb +22 -14
- data/spec/features/search_sort_spec.rb +3 -1
- data/spec/features/search_spec.rb +6 -0
- data/spec/helpers/blacklight_helper_spec.rb +175 -166
- data/spec/helpers/catalog_helper_spec.rb +59 -59
- data/spec/helpers/facets_helper_spec.rb +118 -118
- data/spec/helpers/hash_as_hidden_fields_spec.rb +14 -8
- data/spec/helpers/html_head_helper_spec.rb +51 -45
- data/spec/helpers/render_constraints_helper_spec.rb +5 -6
- data/spec/helpers/search_history_constraints_helper_spec.rb +21 -21
- data/spec/lib/blacklight/solr_response/group_response_spec.rb +2 -2
- data/spec/lib/blacklight_configurable_spec.rb +16 -16
- data/spec/lib/blacklight_configuration_spec.rb +132 -132
- data/spec/lib/blacklight_email_spec.rb +4 -4
- data/spec/lib/blacklight_sms_spec.rb +4 -4
- data/spec/lib/blacklight_solr_document_dublin_core_spec.rb +6 -6
- data/spec/lib/blacklight_solr_document_marc_spec.rb +3 -3
- data/spec/lib/blacklight_solr_document_more_like_this_spec.rb +4 -4
- data/spec/lib/blacklight_solr_document_spec.rb +36 -36
- data/spec/lib/blacklight_solr_response_spec.rb +42 -42
- data/spec/lib/blacklight_spec.rb +5 -5
- data/spec/lib/blacklight_user_spec.rb +5 -5
- data/spec/lib/facet_paginator_spec.rb +12 -12
- data/spec/lib/marc_export_spec.rb +746 -746
- data/spec/lib/search_fields_spec.rb +13 -13
- data/spec/lib/solr_helper_spec.rb +255 -250
- data/spec/lib/tasks/blacklight_task_spec.rb +1 -1
- data/spec/lib/tasks/solr_marc_task_spec.rb +6 -6
- data/spec/lib/utils_spec.rb +11 -11
- data/spec/models/bookmark_spec.rb +7 -6
- data/spec/models/record_mailer_spec.rb +16 -16
- data/spec/models/search_spec.rb +8 -8
- data/spec/models/solr_document_spec.rb +7 -7
- data/spec/requests/alternate_controller_spec.rb +3 -3
- data/spec/routing/catalog_routing_spec.rb +10 -15
- data/spec/spec_helper.rb +6 -4
- data/spec/support/assert_difference.rb +2 -2
- data/spec/support/features.rb +11 -0
- data/spec/support/features/session_helpers.rb +3 -3
- data/spec/support/include_text.rb +2 -2
- data/spec/test_app_templates/Gemfile.extra +2 -15
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +17 -6
- data/spec/views/catalog/_constraints.html.erb_spec.rb +7 -7
- data/spec/views/catalog/_constraints_element.html.erb_spec.rb +12 -12
- data/spec/views/catalog/_document.html.erb_spec.rb +1 -1
- data/spec/views/catalog/_facets.html.erb_spec.rb +13 -13
- data/spec/views/catalog/_index_default.erb_spec.rb +20 -20
- data/spec/views/catalog/_show_default.erb_spec.rb +20 -20
- data/spec/views/catalog/_show_sidebar.erb_spec.rb +6 -6
- data/spec/views/catalog/_thumbnail_default.erb_spec.rb +3 -3
- data/spec/views/catalog/index.atom.builder_spec.rb +28 -28
- data/spec/views/catalog/index.html.erb_spec.rb +6 -6
- metadata +35 -57
- data/gemfiles/rails3.gemfile +0 -25
- data/gemfiles/rails4.gemfile +0 -24
@@ -8,11 +8,11 @@ module RSpec::Rails
|
|
8
8
|
@content.include?(text)
|
9
9
|
end
|
10
10
|
|
11
|
-
|
11
|
+
failure_message do |text|
|
12
12
|
"expected '#{@content}' to contain '#{text}'"
|
13
13
|
end
|
14
14
|
|
15
|
-
|
15
|
+
failure_message_when_negated do |text|
|
16
16
|
"expected #{@content} to not contain '#{text}'"
|
17
17
|
end
|
18
18
|
end
|
@@ -1,9 +1,3 @@
|
|
1
|
-
platforms :jruby do
|
2
|
-
gem 'jdbc-sqlite3'
|
3
|
-
gem 'mediashelf-loggable', '>= 0.4.8'
|
4
|
-
gem 'therubyrhino'
|
5
|
-
end
|
6
|
-
|
7
1
|
platforms :ruby do
|
8
2
|
gem 'sqlite3'
|
9
3
|
end
|
@@ -11,17 +5,10 @@ end
|
|
11
5
|
gem 'jquery-rails'
|
12
6
|
|
13
7
|
group :test do
|
14
|
-
gem 'rspec-rails', '~> 2.13'
|
15
8
|
gem 'generator_spec'
|
16
9
|
gem 'poltergeist'
|
17
|
-
|
18
|
-
gem 'capybara', '~> 1.0'
|
19
|
-
else
|
20
|
-
gem 'capybara'
|
21
|
-
end
|
22
|
-
gem 'simplecov', :platform => :mri_19
|
23
|
-
gem 'simplecov-rcov', :platform => :mri_19
|
10
|
+
gem 'capybara'
|
24
11
|
end
|
25
12
|
|
26
13
|
gem 'jettywrapper', '>= 1.2.0'
|
27
|
-
|
14
|
+
gem 'test-unit'
|
@@ -1,11 +1,11 @@
|
|
1
1
|
require 'rails/generators'
|
2
2
|
|
3
3
|
class TestAppGenerator < Rails::Generators::Base
|
4
|
-
source_root
|
4
|
+
source_root "../spec/test_app_templates"
|
5
5
|
|
6
|
-
def fix_travis_rails_4
|
6
|
+
def fix_travis_rails_4
|
7
7
|
if ENV['TRAVIS']
|
8
|
-
insert_into_file 'app/assets/stylesheets/application.css', :before =>'/*' do
|
8
|
+
insert_into_file 'app/assets/stylesheets/application.css', :before =>'/*' do
|
9
9
|
"@charset \"UTF-8\";\n"
|
10
10
|
end
|
11
11
|
end
|
@@ -15,20 +15,31 @@ class TestAppGenerator < Rails::Generators::Base
|
|
15
15
|
copy_file "lib/tasks/blacklight_test_app.rake"
|
16
16
|
end
|
17
17
|
|
18
|
-
def remove_index
|
18
|
+
def remove_index
|
19
19
|
remove_file "public/index.html"
|
20
20
|
remove_file 'app/assets/images/rails.png'
|
21
21
|
end
|
22
22
|
|
23
23
|
def run_blacklight_generator
|
24
|
-
say_status("warning", "GENERATING BL", :yellow)
|
24
|
+
say_status("warning", "GENERATING BL", :yellow)
|
25
25
|
|
26
26
|
generate 'blacklight', '--devise'
|
27
27
|
end
|
28
28
|
|
29
29
|
def run_test_support_generator
|
30
|
-
say_status("warning", "GENERATING test_support", :yellow)
|
30
|
+
say_status("warning", "GENERATING test_support", :yellow)
|
31
31
|
|
32
32
|
generate 'blacklight:test_support'
|
33
33
|
end
|
34
|
+
|
35
|
+
# Add favicon.ico to asset path
|
36
|
+
# ADD THIS LINE Rails.application.config.assets.precompile += %w( favicon.ico )
|
37
|
+
# TO config/assets.rb
|
38
|
+
def add_favicon_to_asset_path
|
39
|
+
say_status("warning", "ADDING FAVICON TO ASSET PATH", :yellow)
|
40
|
+
|
41
|
+
append_to_file 'config/initializers/assets.rb' do
|
42
|
+
'Rails.application.config.assets.precompile += %w( favicon.ico )'
|
43
|
+
end
|
44
|
+
end
|
34
45
|
end
|
@@ -6,25 +6,25 @@ describe "catalog/constraints" do
|
|
6
6
|
end
|
7
7
|
|
8
8
|
it "should render nothing if no constraints are set" do
|
9
|
-
view.
|
9
|
+
allow(view).to receive_messages(query_has_constraints?: false)
|
10
10
|
render partial: "catalog/constraints"
|
11
11
|
expect(rendered).to be_empty
|
12
12
|
end
|
13
13
|
|
14
14
|
it "should render a start over link" do
|
15
|
-
view.
|
16
|
-
view.
|
17
|
-
view.
|
15
|
+
expect(view).to receive(:search_action_url).with({}).and_return('http://xyz')
|
16
|
+
allow(view).to receive_messages(query_has_constraints?: true)
|
17
|
+
allow(view).to receive(:blacklight_config).and_return(blacklight_config)
|
18
18
|
render partial: "catalog/constraints"
|
19
19
|
expect(rendered).to have_selector("#startOverLink")
|
20
20
|
expect(rendered).to have_link("Start Over", :href => 'http://xyz')
|
21
21
|
end
|
22
22
|
|
23
23
|
it "should render a start over link with the current view type" do
|
24
|
-
view.
|
25
|
-
view.
|
24
|
+
expect(view).to receive(:search_action_url).with(view: 'xyz').and_return('http://xyz?view=xyz')
|
25
|
+
allow(view).to receive_messages(query_has_constraints?: true)
|
26
26
|
params[:view] = 'xyz'
|
27
|
-
view.
|
27
|
+
allow(view).to receive(:blacklight_config).and_return(blacklight_config)
|
28
28
|
render partial: "catalog/constraints"
|
29
29
|
expect(rendered).to have_selector("#startOverLink")
|
30
30
|
expect(rendered).to have_link("Start Over", :href => 'http://xyz?view=xyz')
|
@@ -7,9 +7,9 @@ describe "catalog/_constraints_element.html.erb" do
|
|
7
7
|
render :partial => "catalog/constraints_element", :locals => {:label => "my label", :value => "my value"}
|
8
8
|
end
|
9
9
|
it "should render label and value" do
|
10
|
-
rendered.
|
11
|
-
s.
|
12
|
-
s.
|
10
|
+
expect(rendered).to have_selector("span.appliedFilter.constraint") do |s|
|
11
|
+
expect(s).to have_selector "span.filterName", :content => "my label"
|
12
|
+
expect(s).to have_selector "span.filterValue", :content => "my value"
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
@@ -19,14 +19,14 @@ describe "catalog/_constraints_element.html.erb" do
|
|
19
19
|
render :partial => "catalog/constraints_element", :locals => {:label => "my label", :value => "my value", :options => {:remove => "http://remove"}}
|
20
20
|
end
|
21
21
|
it "should include remove link" do
|
22
|
-
rendered.
|
23
|
-
s.
|
22
|
+
expect(rendered).to have_selector("span.appliedFilter") do |s|
|
23
|
+
expect(s).to have_selector("a.btnRemove.imgReplace[href='http://remove']")
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
27
|
it "should have an accessible remove label" do
|
28
|
-
rendered.
|
29
|
-
s.
|
28
|
+
expect(rendered).to have_selector("a.imgReplace") do |s|
|
29
|
+
expect(s).to have_content("Remove constraint my label: my value")
|
30
30
|
end
|
31
31
|
end
|
32
32
|
end
|
@@ -36,8 +36,8 @@ describe "catalog/_constraints_element.html.erb" do
|
|
36
36
|
render :partial => "catalog/constraints_element", :locals => {:label => "my label", :value => "my value", :options => {:check => false}}
|
37
37
|
end
|
38
38
|
it "should not include checkmark" do
|
39
|
-
rendered.
|
40
|
-
s.
|
39
|
+
expect(rendered).to have_selector("span.appliedFilter") do |s|
|
40
|
+
expect(s).not_to have_selector("img[src$='checkmark.gif']")
|
41
41
|
end
|
42
42
|
end
|
43
43
|
end
|
@@ -47,7 +47,7 @@ describe "catalog/_constraints_element.html.erb" do
|
|
47
47
|
render :partial => "catalog/constraints_element", :locals => {:label => "my label", :value => "my value", :options => {:classes => ["class1", "class2"]}}
|
48
48
|
end
|
49
49
|
it "should include them" do
|
50
|
-
rendered.
|
50
|
+
expect(rendered).to have_selector("span.appliedFilter.constraint.class1.class2")
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
@@ -56,8 +56,8 @@ describe "catalog/_constraints_element.html.erb" do
|
|
56
56
|
render( :partial => "catalog/constraints_element", :locals => {:label => "<span class='custom_label'>my label</span>", :value => "<span class='custom_value'>my value</span>", :options => {:escape_label => false, :escape_value => false}} )
|
57
57
|
end
|
58
58
|
it "should not escape key and value" do
|
59
|
-
rendered.
|
60
|
-
rendered.
|
59
|
+
expect(rendered).to have_selector("span.appliedFilter.constraint span.filterName span.custom_label")
|
60
|
+
expect(rendered).to have_selector("span.appliedFilter.constraint span.filterValue span.custom_value")
|
61
61
|
end
|
62
62
|
|
63
63
|
end
|
@@ -10,7 +10,7 @@ describe "catalog/_document" do
|
|
10
10
|
end
|
11
11
|
|
12
12
|
it "should render the header, thumbnail and index" do
|
13
|
-
view.
|
13
|
+
allow(view).to receive(:blacklight_config).and_return(blacklight_config)
|
14
14
|
stub_template "catalog/_document_header.html.erb" => "document_header"
|
15
15
|
stub_template "catalog/_thumbnail_default.html.erb" => "thumbnail_default"
|
16
16
|
stub_template "catalog/_index_default.html.erb" => "index_default"
|
@@ -3,12 +3,12 @@ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
|
3
3
|
describe "catalog/_facets" do
|
4
4
|
before do
|
5
5
|
@mock_config = Blacklight::Configuration.new
|
6
|
-
view.
|
6
|
+
allow(view).to receive_messages(:blacklight_config => @mock_config)
|
7
7
|
end
|
8
8
|
it "should not have a header if no facets are displayed" do
|
9
|
-
view.
|
9
|
+
allow(view).to receive_messages(:render_facet_partials => '')
|
10
10
|
render
|
11
|
-
rendered.
|
11
|
+
expect(rendered).not_to have_selector('h4')
|
12
12
|
end
|
13
13
|
|
14
14
|
it "should have a header" do
|
@@ -16,15 +16,15 @@ describe "catalog/_facets" do
|
|
16
16
|
@mock_field_1 = double(:field => 'facet_field_1',
|
17
17
|
:label => 'label')
|
18
18
|
@mock_display_facet_1 = double(:name => 'facet_field_1', :items => [Blacklight::SolrResponse::Facets::FacetItem.new(:value => 'Value', :hits => 1234)])
|
19
|
-
view.
|
19
|
+
allow(view).to receive_messages(:facet_field_names => [:facet_field_1],
|
20
20
|
:facet_limit_for => 10 )
|
21
21
|
|
22
22
|
@response = double()
|
23
|
-
@response.
|
23
|
+
allow(@response).to receive(:facet_by_field_name).with(:facet_field_1) { @mock_display_facet_1 }
|
24
24
|
|
25
|
-
view.
|
25
|
+
allow(view).to receive_messages(:render_facet_partials => '')
|
26
26
|
render
|
27
|
-
rendered.
|
27
|
+
expect(rendered).to have_selector('h4')
|
28
28
|
end
|
29
29
|
|
30
30
|
describe "facet display" do
|
@@ -32,24 +32,24 @@ describe "catalog/_facets" do
|
|
32
32
|
@mock_field_1 = double(:field => 'facet_field_1',
|
33
33
|
:label => 'label')
|
34
34
|
@mock_display_facet_1 = double(:name => 'facet_field_1', :items => [Blacklight::SolrResponse::Facets::FacetItem.new(:value => 'Value', :hits => 1234)])
|
35
|
-
view.
|
35
|
+
allow(view).to receive_messages(:facet_field_names => [:facet_field_1],
|
36
36
|
:facet_limit_for => 10 )
|
37
37
|
|
38
38
|
@response = double()
|
39
|
-
@response.
|
39
|
+
allow(@response).to receive(:facet_by_field_name).with(:facet_field_1) { @mock_display_facet_1 }
|
40
40
|
|
41
41
|
end
|
42
42
|
|
43
43
|
it "should have a(n accessible) header" do
|
44
44
|
render
|
45
|
-
rendered.
|
46
|
-
rendered.
|
45
|
+
expect(rendered).to have_selector('h5')
|
46
|
+
expect(rendered).to have_selector('h5 > a')
|
47
47
|
end
|
48
48
|
|
49
49
|
it "should list values" do
|
50
50
|
render
|
51
|
-
rendered.
|
52
|
-
rendered.
|
51
|
+
expect(rendered).to have_selector('a.facet_select')
|
52
|
+
expect(rendered).to have_selector('.count')
|
53
53
|
end
|
54
54
|
|
55
55
|
end
|
@@ -22,44 +22,44 @@ describe "/catalog/_index_default.erb" do
|
|
22
22
|
@fname_4 = "four_field"
|
23
23
|
|
24
24
|
@document = double("solr_doc")
|
25
|
-
@document.
|
26
|
-
@document.
|
27
|
-
@document.
|
28
|
-
@document.
|
25
|
+
allow(@document).to receive(:get).with(@fname_1, hash_including(:sep => nil)).and_return("val_1")
|
26
|
+
allow(@document).to receive(:get).with(@fname_2, hash_including(:sep => nil)).and_return("val_2")
|
27
|
+
allow(@document).to receive(:get).with(@fname_3, hash_including(:sep => nil)).and_return(nil)
|
28
|
+
allow(@document).to receive(:get).with(@fname_4, hash_including(:sep => nil)).and_return("val_4")
|
29
29
|
|
30
|
-
@document.
|
31
|
-
@document.
|
32
|
-
@document.
|
33
|
-
@document.
|
30
|
+
allow(@document).to receive(:has?).with(@fname_1).and_return(true)
|
31
|
+
allow(@document).to receive(:has?).with(@fname_2).and_return(true)
|
32
|
+
allow(@document).to receive(:has?).with(@fname_3).and_return(false)
|
33
|
+
allow(@document).to receive(:has?).with(@fname_4).and_return(true)
|
34
34
|
|
35
35
|
# cover any remaining fields in initalizer
|
36
|
-
@document.
|
36
|
+
allow(@document).to receive(:[])
|
37
37
|
|
38
38
|
@flabel_1 = "One:"
|
39
39
|
@flabel_3 = "Three:"
|
40
40
|
@flabel_4 = "Four:"
|
41
41
|
|
42
|
-
view.
|
42
|
+
allow(view).to receive(:blacklight_config).and_return(@config)
|
43
43
|
assigns[:document] = @document
|
44
44
|
@rendered = view.render_document_partial @document, :index
|
45
45
|
end
|
46
46
|
|
47
47
|
it "should only display fields listed in the initializer" do
|
48
|
-
@rendered.
|
49
|
-
@rendered.
|
48
|
+
expect(@rendered).not_to include_text("val_2")
|
49
|
+
expect(@rendered).not_to include_text(@fname_2)
|
50
50
|
end
|
51
51
|
|
52
52
|
it "should skip over fields listed in initializer that are not in solr response" do
|
53
|
-
@rendered.
|
53
|
+
expect(@rendered).not_to include_text(@fname_3)
|
54
54
|
end
|
55
55
|
|
56
56
|
it "should display field labels from initializer and raw solr field names in the class" do
|
57
57
|
# labels
|
58
|
-
@rendered.
|
59
|
-
@rendered.
|
58
|
+
expect(@rendered).to include_text(@flabel_1)
|
59
|
+
expect(@rendered).to include_text(@flabel_4)
|
60
60
|
# classes
|
61
|
-
@rendered.
|
62
|
-
@rendered.
|
61
|
+
expect(@rendered).to include_text("blacklight-#{@fname_1}")
|
62
|
+
expect(@rendered).to include_text("blacklight-#{@fname_4}")
|
63
63
|
end
|
64
64
|
|
65
65
|
# this test probably belongs in a Cucumber feature
|
@@ -68,9 +68,9 @@ describe "/catalog/_index_default.erb" do
|
|
68
68
|
# end
|
69
69
|
|
70
70
|
it "should have values for displayed fields" do
|
71
|
-
@rendered.
|
72
|
-
@rendered.
|
73
|
-
@rendered.
|
71
|
+
expect(@rendered).to include_text("val_1")
|
72
|
+
expect(@rendered).to include_text("val_4")
|
73
|
+
expect(@rendered).not_to include_text("val_2")
|
74
74
|
end
|
75
75
|
|
76
76
|
end
|
@@ -24,44 +24,44 @@ describe "/catalog/_show_default.html.erb" do
|
|
24
24
|
@fname_4 = "four_field"
|
25
25
|
|
26
26
|
@document = double("solr_doc")
|
27
|
-
@document.
|
28
|
-
@document.
|
29
|
-
@document.
|
30
|
-
@document.
|
27
|
+
allow(@document).to receive(:get).with(@fname_1, hash_including(:sep => nil)).and_return("val_1")
|
28
|
+
allow(@document).to receive(:get).with(@fname_2, hash_including(:sep => nil)).and_return("val_2")
|
29
|
+
allow(@document).to receive(:get).with(@fname_3, hash_including(:sep => nil)).and_return(nil)
|
30
|
+
allow(@document).to receive(:get).with(@fname_4, hash_including(:sep => nil)).and_return("val_4")
|
31
31
|
|
32
|
-
@document.
|
33
|
-
@document.
|
34
|
-
@document.
|
35
|
-
@document.
|
32
|
+
allow(@document).to receive(:'has?').with(@fname_1).and_return(true)
|
33
|
+
allow(@document).to receive(:'has?').with(@fname_2).and_return(true)
|
34
|
+
allow(@document).to receive(:'has?').with(@fname_3).and_return(false)
|
35
|
+
allow(@document).to receive(:'has?').with(@fname_4).and_return(true)
|
36
36
|
|
37
37
|
# cover any remaining fields in initalizer
|
38
|
-
@document.
|
38
|
+
allow(@document).to receive(:[])
|
39
39
|
|
40
40
|
@flabel_1 = "One:"
|
41
41
|
@flabel_3 = "Two:"
|
42
42
|
@flabel_4 = "Four:"
|
43
43
|
|
44
|
-
view.
|
44
|
+
allow(view).to receive(:blacklight_config).and_return(@config)
|
45
45
|
assigns[:document] = @document
|
46
46
|
@rendered = view.render_document_partial @document, :show
|
47
47
|
end
|
48
48
|
|
49
49
|
it "should only display fields listed in the initializer" do
|
50
|
-
@rendered.
|
51
|
-
@rendered.
|
50
|
+
expect(@rendered).not_to include_text("val_2")
|
51
|
+
expect(@rendered).not_to include_text(@fname_2)
|
52
52
|
end
|
53
53
|
|
54
54
|
it "should skip over fields listed in initializer that are not in solr response" do
|
55
|
-
@rendered.
|
55
|
+
expect(@rendered).not_to include_text(@fname_3)
|
56
56
|
end
|
57
57
|
|
58
58
|
it "should display field labels from initializer and raw solr field names in the class" do
|
59
59
|
# labels
|
60
|
-
@rendered.
|
61
|
-
@rendered.
|
60
|
+
expect(@rendered).to include_text(@flabel_1)
|
61
|
+
expect(@rendered).to include_text(@flabel_4)
|
62
62
|
# classes
|
63
|
-
@rendered.
|
64
|
-
@rendered.
|
63
|
+
expect(@rendered).to include_text("blacklight-#{@fname_1}")
|
64
|
+
expect(@rendered).to include_text("blacklight-#{@fname_4}")
|
65
65
|
end
|
66
66
|
|
67
67
|
# this test probably belongs in a Cucumber feature
|
@@ -70,9 +70,9 @@ describe "/catalog/_show_default.html.erb" do
|
|
70
70
|
# end
|
71
71
|
|
72
72
|
it "should have values for displayed fields" do
|
73
|
-
@rendered.
|
74
|
-
@rendered.
|
75
|
-
@rendered.
|
73
|
+
expect(@rendered).to include_text("val_1")
|
74
|
+
expect(@rendered).to include_text("val_4")
|
75
|
+
expect(@rendered).not_to include_text("val_2")
|
76
76
|
end
|
77
77
|
|
78
78
|
end
|
@@ -11,16 +11,16 @@ describe "/catalog/_show_sidebar.html.erb" do
|
|
11
11
|
|
12
12
|
before(:each) do
|
13
13
|
|
14
|
-
view.
|
15
|
-
view.
|
16
|
-
view.
|
14
|
+
allow(view).to receive(:blacklight_config).and_return(CatalogController.blacklight_config)
|
15
|
+
allow(view).to receive(:has_user_authentication_provider?).and_return(false)
|
16
|
+
allow(view).to receive(:current_search_session).and_return nil
|
17
17
|
end
|
18
18
|
|
19
19
|
it "should show more-like-this titles in the sidebar" do
|
20
20
|
@document = SolrDocument.new :id => 1, :title_s => 'abc', :format => 'default'
|
21
|
-
@document.
|
21
|
+
allow(@document).to receive(:more_like_this).and_return([SolrDocument.new({ 'id' => '2', 'title_display' => 'Title of MLT Document' })])
|
22
22
|
render
|
23
|
-
rendered.
|
24
|
-
rendered.
|
23
|
+
expect(rendered).to include_text("More Like This")
|
24
|
+
expect(rendered).to include_text("Title of MLT Document")
|
25
25
|
end
|
26
26
|
end
|
@@ -18,9 +18,9 @@ describe "catalog/_thumbnail_default" do
|
|
18
18
|
|
19
19
|
before do
|
20
20
|
assign :response, double(:params => {})
|
21
|
-
view.
|
22
|
-
view.
|
23
|
-
view.
|
21
|
+
allow(view).to receive(:render_grouped_response?).and_return false
|
22
|
+
allow(view).to receive(:blacklight_config).and_return(blacklight_config)
|
23
|
+
allow(view).to receive(:current_search_session).and_return nil
|
24
24
|
end
|
25
25
|
|
26
26
|
it "should render the thumbnail if the document has one" do
|