blacklight 6.2.0 → 6.3.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.
Files changed (113) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +3 -0
  3. data/.solr_wrapper +5 -0
  4. data/.travis.yml +3 -5
  5. data/Gemfile +3 -3
  6. data/VERSION +1 -1
  7. data/app/assets/javascripts/blacklight/core.js +19 -5
  8. data/app/helpers/blacklight/blacklight_helper_behavior.rb +48 -20
  9. data/app/helpers/blacklight/configuration_helper_behavior.rb +1 -1
  10. data/app/helpers/blacklight/url_helper_behavior.rb +2 -1
  11. data/app/presenters/blacklight/document_presenter.rb +58 -150
  12. data/app/presenters/blacklight/field_presenter.rb +31 -0
  13. data/app/presenters/blacklight/index_presenter.rb +69 -0
  14. data/app/presenters/blacklight/link_alternate_presenter.rb +29 -0
  15. data/app/presenters/blacklight/rendering/abstract_step.rb +24 -0
  16. data/app/presenters/blacklight/rendering/helper_method.rb +23 -0
  17. data/app/presenters/blacklight/rendering/join.rb +16 -0
  18. data/app/presenters/blacklight/rendering/link_to_facet.rb +35 -0
  19. data/app/presenters/blacklight/rendering/microdata.rb +17 -0
  20. data/app/presenters/blacklight/rendering/pipeline.rb +32 -0
  21. data/app/presenters/blacklight/rendering/terminator.rb +9 -0
  22. data/app/presenters/blacklight/show_presenter.rb +93 -0
  23. data/app/services/blacklight/field_retriever.rb +58 -0
  24. data/app/views/catalog/_document_default.atom.builder +2 -3
  25. data/app/views/catalog/_document_default.rss.builder +2 -2
  26. data/app/views/kaminari/blacklight/_next_page.html.erb +9 -3
  27. data/app/views/kaminari/blacklight/_prev_page.html.erb +10 -3
  28. data/lib/blacklight/configuration.rb +15 -3
  29. data/lib/blacklight/configuration/null_field.rb +13 -0
  30. data/lib/blacklight/configuration/view_config.rb +6 -0
  31. data/lib/generators/blacklight/templates/catalog_controller.rb +1 -1
  32. data/lib/generators/blacklight/templates/config/blacklight.yml +1 -1
  33. data/lib/generators/blacklight/templates/config/jetty.yml +1 -1
  34. data/spec/controllers/alternate_controller_spec.rb +2 -2
  35. data/spec/controllers/application_controller_spec.rb +1 -1
  36. data/spec/controllers/blacklight/facet_spec.rb +3 -3
  37. data/spec/controllers/blacklight/search_fields_spec.rb +7 -7
  38. data/spec/controllers/blacklight/search_helper_spec.rb +44 -44
  39. data/spec/controllers/blacklight/suggest_search_spec.rb +1 -1
  40. data/spec/controllers/bookmarks_controller_spec.rb +6 -6
  41. data/spec/controllers/catalog_controller_spec.rb +125 -125
  42. data/spec/controllers/saved_searches_controller_spec.rb +4 -9
  43. data/spec/controllers/search_history_controller_spec.rb +3 -6
  44. data/spec/controllers/suggest_controller_spec.rb +2 -2
  45. data/spec/features/alternate_controller_spec.rb +3 -3
  46. data/spec/features/bookmarks_spec.rb +6 -6
  47. data/spec/features/did_you_mean_spec.rb +10 -10
  48. data/spec/features/facets_spec.rb +4 -4
  49. data/spec/features/record_view_spec.rb +4 -4
  50. data/spec/features/saved_searches_spec.rb +4 -4
  51. data/spec/features/search_context_spec.rb +4 -4
  52. data/spec/features/search_filters_spec.rb +10 -10
  53. data/spec/features/search_formats_spec.rb +2 -2
  54. data/spec/features/search_history_spec.rb +5 -5
  55. data/spec/features/search_pagination_spec.rb +4 -4
  56. data/spec/features/search_results_spec.rb +7 -7
  57. data/spec/features/search_sort_spec.rb +2 -2
  58. data/spec/features/search_spec.rb +6 -6
  59. data/spec/helpers/blacklight_helper_spec.rb +105 -65
  60. data/spec/helpers/catalog_helper_spec.rb +36 -36
  61. data/spec/helpers/configuration_helper_spec.rb +28 -28
  62. data/spec/helpers/facets_helper_spec.rb +39 -39
  63. data/spec/helpers/hash_as_hidden_fields_spec.rb +1 -1
  64. data/spec/helpers/render_constraints_helper_spec.rb +1 -1
  65. data/spec/helpers/search_history_constraints_helper_spec.rb +7 -7
  66. data/spec/helpers/url_helper_spec.rb +20 -17
  67. data/spec/lib/blacklight/search_state_spec.rb +2 -2
  68. data/spec/lib/blacklight/utils_spec.rb +15 -15
  69. data/spec/lib/blacklight_spec.rb +1 -1
  70. data/spec/lib/tasks/blacklight_task_spec.rb +1 -1
  71. data/spec/models/blacklight/configurable_spec.rb +3 -3
  72. data/spec/models/blacklight/configuration_spec.rb +52 -52
  73. data/spec/models/blacklight/document_spec.rb +10 -10
  74. data/spec/models/blacklight/facet_paginator_spec.rb +5 -5
  75. data/spec/models/blacklight/search_builder_spec.rb +34 -34
  76. data/spec/models/blacklight/user_spec.rb +4 -4
  77. data/spec/models/bookmark_spec.rb +5 -5
  78. data/spec/models/record_mailer_spec.rb +11 -11
  79. data/spec/models/search_spec.rb +1 -1
  80. data/spec/models/solr_document_spec.rb +4 -4
  81. data/spec/presenters/document_presenter_spec.rb +94 -50
  82. data/spec/presenters/index_presenter_spec.rb +147 -0
  83. data/spec/presenters/pipeline_spec.rb +28 -0
  84. data/spec/presenters/show_presenter_spec.rb +287 -0
  85. data/spec/routing/catalog_routing_spec.rb +11 -11
  86. data/spec/spec_helper.rb +10 -1
  87. data/spec/support/backport_test.rb +38 -0
  88. data/spec/test_app_templates/Gemfile.extra +2 -10
  89. data/spec/views/_user_util_links.html.erb_spec.rb +1 -1
  90. data/spec/views/catalog/_constraints.html.erb_spec.rb +3 -3
  91. data/spec/views/catalog/_constraints_element.html.erb_spec.rb +5 -5
  92. data/spec/views/catalog/_document.html.erb_spec.rb +2 -2
  93. data/spec/views/catalog/_document_list.html.erb_spec.rb +1 -1
  94. data/spec/views/catalog/_facet_layout.html.erb_spec.rb +4 -4
  95. data/spec/views/catalog/_facets.html.erb_spec.rb +4 -4
  96. data/spec/views/catalog/_index_default.erb_spec.rb +5 -4
  97. data/spec/views/catalog/_index_header_default.html.erb_spec.rb +4 -3
  98. data/spec/views/catalog/_paginate_compact.html.erb_spec.rb +3 -3
  99. data/spec/views/catalog/_search_header.erb_spec.rb +1 -1
  100. data/spec/views/catalog/_show_default.erb_spec.rb +6 -5
  101. data/spec/views/catalog/_show_sidebar.erb_spec.rb +2 -1
  102. data/spec/views/catalog/_show_tools.html.erb_spec.rb +8 -8
  103. data/spec/views/catalog/_sort_and_per_page.html.erb_spec.rb +2 -2
  104. data/spec/views/catalog/_thumbnail_default.erb_spec.rb +3 -2
  105. data/spec/views/catalog/_view_type_group.html.erb_spec.rb +3 -3
  106. data/spec/views/catalog/facet.html.erb_spec.rb +3 -3
  107. data/spec/views/catalog/index.atom.builder_spec.rb +15 -14
  108. data/spec/views/catalog/index.html.erb_spec.rb +3 -3
  109. data/spec/views/catalog/opensearch.xml.builder_spec.rb +1 -1
  110. data/spec/views/catalog/show.html.erb_spec.rb +5 -4
  111. data/tasks/blacklight.rake +1 -1
  112. metadata +25 -4
  113. data/config/jetty.yml +0 -13
@@ -10,7 +10,7 @@ describe "_user_util_links" do
10
10
 
11
11
  end
12
12
 
13
- it "should render the correct bookmark count" do
13
+ it "renders the correct bookmark count" do
14
14
  count = rand(99)
15
15
  allow(view).to receive(:blacklight_config).and_return(blacklight_config)
16
16
  allow(controller).to receive(:render_bookmarks_control?).and_return true
@@ -8,13 +8,13 @@ describe "catalog/constraints" do
8
8
  end
9
9
  end
10
10
 
11
- it "should render nothing if no constraints are set" do
11
+ it "renders nothing if no constraints are set" do
12
12
  allow(view).to receive_messages(query_has_constraints?: false)
13
13
  render partial: "catalog/constraints"
14
14
  expect(rendered).to be_empty
15
15
  end
16
16
 
17
- it "should render a start over link" do
17
+ it "renders a start over link" do
18
18
  allow(view).to receive(:search_action_path).with({}).and_return('http://xyz')
19
19
  allow(view).to receive_messages(query_has_constraints?: true)
20
20
  allow(view).to receive(:blacklight_config).and_return(blacklight_config)
@@ -23,7 +23,7 @@ describe "catalog/constraints" do
23
23
  expect(rendered).to have_link("Start Over", :href => 'http://xyz')
24
24
  end
25
25
 
26
- it "should render a start over link with the current view type" do
26
+ it "renders a start over link with the current view type" do
27
27
  allow(view).to receive(:search_action_path).with(view: :xyz).and_return('http://xyz?view=xyz')
28
28
  allow(view).to receive_messages(query_has_constraints?: true)
29
29
  params[:view] = 'xyz'
@@ -6,7 +6,7 @@ describe "catalog/_constraints_element.html.erb" do
6
6
  before do
7
7
  render :partial => "catalog/constraints_element", :locals => {:label => "my label", :value => "my value"}
8
8
  end
9
- it "should render label and value" do
9
+ it "renders label and value" do
10
10
  expect(rendered).to have_selector("span.appliedFilter.constraint") do |s|
11
11
  expect(s).to have_css("span.constraint-value")
12
12
  expect(s).to_not have_css("a.constraint-value")
@@ -20,13 +20,13 @@ describe "catalog/_constraints_element.html.erb" do
20
20
  before do
21
21
  render :partial => "catalog/constraints_element", :locals => {:label => "my label", :value => "my value", :options => {:remove => "http://remove"}}
22
22
  end
23
- it "should include remove link" do
23
+ it "includes remove link" do
24
24
  expect(rendered).to have_selector("span.appliedFilter") do |s|
25
25
  expect(s).to have_selector(".remove[href='http://remove']")
26
26
  end
27
27
  end
28
28
 
29
- it "should have an accessible remove label" do
29
+ it "has an accessible remove label" do
30
30
  expect(rendered).to have_selector(".remove") do |s|
31
31
  expect(s).to have_content("Remove constraint my label: my value")
32
32
  end
@@ -37,7 +37,7 @@ describe "catalog/_constraints_element.html.erb" do
37
37
  before do
38
38
  render :partial => "catalog/constraints_element", :locals => {:label => "my label", :value => "my value", :options => {:classes => ["class1", "class2"]}}
39
39
  end
40
- it "should include them" do
40
+ it "includes them" do
41
41
  expect(rendered).to have_selector("span.appliedFilter.constraint.class1.class2")
42
42
  end
43
43
  end
@@ -46,7 +46,7 @@ describe "catalog/_constraints_element.html.erb" do
46
46
  before do
47
47
  render( :partial => "catalog/constraints_element", :locals => {:label => "<span class='custom_label'>my label</span>".html_safe, :value => "<span class='custom_value'>my value</span>".html_safe} )
48
48
  end
49
- it "should not escape key and value" do
49
+ it "does not escape key and value" do
50
50
  expect(rendered).to have_selector("span.appliedFilter.constraint span.filterName span.custom_label")
51
51
  expect(rendered).to have_selector("span.appliedFilter.constraint span.filterValue span.custom_value")
52
52
  end
@@ -15,7 +15,7 @@ describe "catalog/_document" do
15
15
  allow(view).to receive(:blacklight_config).and_return(blacklight_config)
16
16
  end
17
17
 
18
- it "should render the header, thumbnail and index by default" do
18
+ it "renders the header, thumbnail and index by default" do
19
19
  stub_template "catalog/_index_header_default.html.erb" => "document_header"
20
20
  stub_template "catalog/_thumbnail_default.html.erb" => "thumbnail_default"
21
21
  stub_template "catalog/_index_default.html.erb" => "index_default"
@@ -28,7 +28,7 @@ describe "catalog/_document" do
28
28
  end
29
29
 
30
30
 
31
- it "should use the index.partials parameter to determine the partials to render" do
31
+ it "uses the index.partials parameter to determine the partials to render" do
32
32
  blacklight_config.index.partials = ['a', 'b', 'c']
33
33
  stub_template "catalog/_a_default.html.erb" => "a_partial"
34
34
  stub_template "catalog/_b_default.html.erb" => "b_partial"
@@ -7,7 +7,7 @@ describe "catalog/_document_list", type: :view do
7
7
  allow(view).to receive_messages(document_index_view_type: "some-view", documents: [])
8
8
  end
9
9
 
10
- it "should include a class for the current view" do
10
+ it "includes a class for the current view" do
11
11
  render
12
12
  expect(rendered).to have_selector(".documents-some-view")
13
13
  end
@@ -17,23 +17,23 @@ describe "catalog/facet_layout" do
17
17
  allow(view).to receive_messages(blacklight_config: blacklight_config)
18
18
  end
19
19
 
20
- it "should have a facet-specific class" do
20
+ it "has a facet-specific class" do
21
21
  render partial: 'catalog/facet_layout', locals: { facet_field: facet_field }
22
22
  expect(rendered).to have_selector '.blacklight-some_field'
23
23
  end
24
24
 
25
- it "should have a title with a link for a11y" do
25
+ it "has a title with a link for a11y" do
26
26
  render partial: 'catalog/facet_layout', locals: { facet_field: facet_field }
27
27
  expect(rendered).to have_selector 'h3 a', text: 'Some Field'
28
28
  end
29
29
 
30
- it "should be collapsable" do
30
+ it "is collapsable" do
31
31
  render partial: 'catalog/facet_layout', locals: { facet_field: facet_field }
32
32
  expect(rendered).to have_selector '.panel-heading.collapsed'
33
33
  expect(rendered).to have_selector '.collapse .panel-body'
34
34
  end
35
35
 
36
- it "should be configured to be open by default" do
36
+ it "is configured to be open by default" do
37
37
  allow(facet_field).to receive_messages(collapse: false)
38
38
  render partial: 'catalog/facet_layout', locals: { facet_field: facet_field }
39
39
  expect(rendered).to_not have_selector '.panel-heading.collapsed'
@@ -12,7 +12,7 @@ describe "catalog/_facets" do
12
12
  end
13
13
 
14
14
  context "without any facet fields" do
15
- it "should not have a header if no facets are displayed" do
15
+ it "does not have a header if no facets are displayed" do
16
16
  allow(view).to receive_messages(:render_facet_partials => '')
17
17
  render
18
18
  expect(rendered).to_not have_selector('h4')
@@ -35,7 +35,7 @@ describe "catalog/_facets" do
35
35
  allow(@response).to receive(:aggregations).and_return("facet_field_1" => @mock_display_facet_1)
36
36
  end
37
37
 
38
- it "should have a header" do
38
+ it "has a header" do
39
39
  allow(view).to receive_messages(:render_facet_partials => '')
40
40
  render
41
41
  expect(rendered).to have_selector('.facets-heading')
@@ -43,12 +43,12 @@ describe "catalog/_facets" do
43
43
 
44
44
 
45
45
  describe "facet display" do
46
- it "should have a(n accessible) header" do
46
+ it "has a(n accessible) header" do
47
47
  render
48
48
  expect(rendered).to have_selector('.facet-field-heading')
49
49
  end
50
50
 
51
- it "should list values" do
51
+ it "lists values" do
52
52
  render
53
53
 
54
54
  # The .facet-content class is used by blacklight_range_limit js, and
@@ -9,6 +9,7 @@ describe "/catalog/_index_default.erb" do
9
9
  include CatalogHelper
10
10
 
11
11
  before(:each) do
12
+ allow(view).to receive(:action_name).and_return('index')
12
13
  @config = Blacklight::Configuration.new do |config|
13
14
  config.show.display_type_field = 'asdf'
14
15
  config.add_index_field 'one_field', :label => 'One:'
@@ -33,16 +34,16 @@ describe "/catalog/_index_default.erb" do
33
34
  @rendered = view.render_document_partial @document, :index
34
35
  end
35
36
 
36
- it "should only display fields listed in the initializer" do
37
+ it "only displays fields listed in the initializer" do
37
38
  expect(@rendered).to_not include("val_2")
38
39
  expect(@rendered).to_not include(@fname_2)
39
40
  end
40
41
 
41
- it "should skip over fields listed in initializer that are not in solr response" do
42
+ it "skips over fields listed in initializer that are not in solr response" do
42
43
  expect(@rendered).to_not include(@fname_3)
43
44
  end
44
45
 
45
- it "should display field labels from initializer and raw solr field names in the class" do
46
+ it "displays field labels from initializer and raw solr field names in the class" do
46
47
  # labels
47
48
  expect(@rendered).to include(@flabel_1)
48
49
  expect(@rendered).to include(@flabel_4)
@@ -56,7 +57,7 @@ describe "/catalog/_index_default.erb" do
56
57
  # pending
57
58
  # end
58
59
 
59
- it "should have values for displayed fields" do
60
+ it "has values for displayed fields" do
60
61
  expect(@rendered).to include("val_1")
61
62
  expect(@rendered).to include("val_4")
62
63
  expect(@rendered).to_not include("val_2")
@@ -11,6 +11,7 @@ describe "catalog/_index_header_default" do
11
11
  end
12
12
 
13
13
  before do
14
+ allow(controller).to receive(:action_name).and_return('index')
14
15
  assign :response, double(start: 0)
15
16
  allow(view).to receive(:render_grouped_response?).and_return false
16
17
  allow(view).to receive(:blacklight_config).and_return(blacklight_config)
@@ -18,19 +19,19 @@ describe "catalog/_index_header_default" do
18
19
  allow(view).to receive(:search_session).and_return({})
19
20
  end
20
21
 
21
- it "should render the document header" do
22
+ it "renders the document header" do
22
23
  allow(view).to receive(:render_index_doc_actions)
23
24
  render partial: "catalog/index_header_default", locals: {document: document, document_counter: 1}
24
25
  expect(rendered).to have_selector('.document-counter', text: "2")
25
26
  end
26
27
 
27
- it "should allow the title to take the whole space if no document tools are rendered" do
28
+ it "allows the title to take the whole space if no document tools are rendered" do
28
29
  allow(view).to receive(:render_index_doc_actions)
29
30
  render partial: "catalog/index_header_default", locals: {document: document, document_counter: 1}
30
31
  expect(rendered).to have_selector '.index_title.col-md-12'
31
32
  end
32
33
 
33
- it "should give the document actions space if present" do
34
+ it "gives the document actions space if present" do
34
35
  allow(view).to receive(:render_index_doc_actions).and_return("DOCUMENT ACTIONS")
35
36
  render partial: "catalog/index_header_default", locals: {document: document, document_counter: 1}
36
37
  expect(rendered).to have_selector '.index_title.col-sm-9'
@@ -23,7 +23,7 @@ describe "catalog/_paginate_compact.html.erb" do
23
23
 
24
24
  include Blacklight::SearchHelper
25
25
 
26
- it "should render solr responses" do
26
+ it "renders solr responses" do
27
27
  solr_response, document_list = search_results(q: '')
28
28
 
29
29
  render :partial => 'catalog/paginate_compact', :object => solr_response
@@ -32,13 +32,13 @@ describe "catalog/_paginate_compact.html.erb" do
32
32
  end
33
33
  end
34
34
 
35
- it "should render paginatable arrays" do
35
+ it "renders paginatable arrays" do
36
36
  render :partial => 'catalog/paginate_compact', :object => (Kaminari.paginate_array([], total_count: 145).page(1).per(10))
37
37
  expect(rendered).to have_selector ".page_entries"
38
38
  expect(rendered).to have_selector "a[@rel=next]"
39
39
  end
40
40
 
41
- it "should render ActiveRecord collections" do
41
+ it "renders ActiveRecord collections" do
42
42
  50.times { b = Bookmark.new; b.user = user; b.save! }
43
43
  render :partial => 'catalog/paginate_compact', :object => Bookmark.page(1).per(25)
44
44
  expect(rendered).to have_selector ".page_entries"
@@ -5,7 +5,7 @@ require 'spec_helper'
5
5
 
6
6
  describe "/catalog/_search_header.html.erb" do
7
7
 
8
- it "should render the default search header partials" do
8
+ it "renders the default search header partials" do
9
9
  stub_template "_did_you_mean.html.erb" => "did_you_mean"
10
10
  stub_template "_constraints.html.erb" => "constraints"
11
11
  stub_template "_sort_and_per_page.html.erb" => "sort_and_per_page"
@@ -11,7 +11,8 @@ describe "/catalog/_show_default.html.erb" do
11
11
 
12
12
 
13
13
  before(:each) do
14
- @config = Blacklight::Configuration.new do |config|
14
+ allow(controller).to receive(:action_name).and_return('show')
15
+ @config = Blacklight::Configuration.new do |config|
15
16
  config.show.display_type_field = 'asdf'
16
17
  config.add_show_field 'one_field', :label => 'One:'
17
18
  config.add_show_field 'empty_field', :label => 'Three:'
@@ -34,16 +35,16 @@ describe "/catalog/_show_default.html.erb" do
34
35
  @rendered = view.render_document_partial @document, :show
35
36
  end
36
37
 
37
- it "should only display fields listed in the initializer" do
38
+ it "only displays fields listed in the initializer" do
38
39
  expect(@rendered).to_not include("val_2")
39
40
  expect(@rendered).to_not include(@fname_2)
40
41
  end
41
42
 
42
- it "should skip over fields listed in initializer that are not in solr response" do
43
+ it "skips over fields listed in initializer that are not in solr response" do
43
44
  expect(@rendered).to_not include(@fname_3)
44
45
  end
45
46
 
46
- it "should display field labels from initializer and raw solr field names in the class" do
47
+ it "displays field labels from initializer and raw solr field names in the class" do
47
48
  # labels
48
49
  expect(@rendered).to include(@flabel_1)
49
50
  expect(@rendered).to include(@flabel_4)
@@ -57,7 +58,7 @@ describe "/catalog/_show_default.html.erb" do
57
58
  # pending
58
59
  # end
59
60
 
60
- it "should have values for displayed fields" do
61
+ it "has values for displayed fields" do
61
62
  expect(@rendered).to include("val_1")
62
63
  expect(@rendered).to include("val_4")
63
64
  expect(@rendered).to_not include("val_2")
@@ -12,6 +12,7 @@ describe "/catalog/_show_sidebar.html.erb" do
12
12
  end
13
13
 
14
14
  before(:each) do
15
+ allow(controller).to receive(:action_name).and_return('show')
15
16
  allow(view).to receive(:blacklight_config).and_return(blacklight_config)
16
17
  allow(view).to receive(:has_user_authentication_provider?).and_return(false)
17
18
  allow(view).to receive(:current_search_session).and_return nil
@@ -19,7 +20,7 @@ describe "/catalog/_show_sidebar.html.erb" do
19
20
  allow(view).to receive(:document_actions).and_return([])
20
21
  end
21
22
 
22
- it "should show more-like-this titles in the sidebar" do
23
+ it "shows more-like-this titles in the sidebar" do
23
24
  @document = SolrDocument.new :id => 1, :title_s => 'abc', :format => 'default'
24
25
  allow(@document).to receive(:more_like_this).and_return([SolrDocument.new({ 'id' => '2', 'title_display' => 'Title of MLT Document' })])
25
26
  render
@@ -24,56 +24,56 @@ describe "catalog/_show_tools.html.erb" do
24
24
  end
25
25
 
26
26
 
27
- it "should render a document action" do
27
+ it "renders a document action" do
28
28
  allow(view).to receive(:some_action_solr_document_path).with(document).and_return "x"
29
29
  document_actions[:some_action] = Blacklight::Configuration::ToolConfig.new partial: 'document_action'
30
30
  render partial: 'catalog/show_tools'
31
31
  expect(rendered).to have_link "Some action", href: "x"
32
32
  end
33
33
 
34
- it "should use the provided label" do
34
+ it "uses the provided label" do
35
35
  allow(view).to receive(:some_action_solr_document_path).and_return "x"
36
36
  document_actions[:some_action] = Blacklight::Configuration::ToolConfig.new label: "Some label", partial: 'document_action'
37
37
  render partial: 'catalog/show_tools'
38
38
  expect(rendered).to have_selector '.some_action', text: "Some label"
39
39
  end
40
40
 
41
- it "should evaluate a document action's if configurations" do
41
+ it "evaluates a document action's if configurations" do
42
42
  allow(view).to receive(:some_action_solr_document_path).and_return "x"
43
43
  document_actions[:some_action] = Blacklight::Configuration::ToolConfig.new if: false, partial: 'document_action'
44
44
  render partial: 'catalog/show_tools'
45
45
  expect(rendered).not_to have_selector '.some_action', text: "Some action"
46
46
  end
47
47
 
48
- it "should evaluate a document action's if configuration with a proc" do
48
+ it "evaluates a document action's if configuration with a proc" do
49
49
  allow(view).to receive(:some_action_solr_document_path).and_return "x"
50
50
  document_actions[:some_action] = Blacklight::Configuration::ToolConfig.new partial: 'document_action', if: Proc.new { |config, doc| doc.id == "xyz" }
51
51
  render partial: 'catalog/show_tools'
52
52
  expect(rendered).not_to have_selector '.some_action', text: "Some action"
53
53
  end
54
54
 
55
- it "should evaluate a document action's unless configurations" do
55
+ it "evaluates a document action's unless configurations" do
56
56
  allow(view).to receive(:some_action_solr_document_path).and_return "x"
57
57
  document_actions[:some_action] = Blacklight::Configuration::ToolConfig.new partial: 'document_action', unless: true
58
58
  render partial: 'catalog/show_tools'
59
59
  expect(rendered).not_to have_selector '.some_action', text: "Some action"
60
60
  end
61
61
 
62
- it "should allow the tool to have a custom id" do
62
+ it "allows the tool to have a custom id" do
63
63
  allow(view).to receive(:some_action_solr_document_path).and_return "x"
64
64
  document_actions[:some_action] = Blacklight::Configuration::ToolConfig.new partial: 'document_action', id: "some_action"
65
65
  render partial: 'catalog/show_tools'
66
66
  expect(rendered).to have_selector '#some_action', text: "Some action"
67
67
  end
68
68
 
69
- it "should default to modal behavior" do
69
+ it "defaults to modal behavior" do
70
70
  allow(view).to receive(:some_action_solr_document_path).and_return "x"
71
71
  document_actions[:some_action] = Blacklight::Configuration::ToolConfig.new partial: 'document_action'
72
72
  render partial: 'catalog/show_tools'
73
73
  expect(rendered).to have_selector '.some_action > a[data-ajax-modal="trigger"]', text: "Some action"
74
74
  end
75
75
 
76
- it "should allow configuration to opt out of modal behavior" do
76
+ it "allows configuration to opt out of modal behavior" do
77
77
  allow(view).to receive(:some_action_solr_document_path).and_return "x"
78
78
  document_actions[:some_action] = Blacklight::Configuration::ToolConfig.new partial: 'document_action', modal: false
79
79
  render partial: 'catalog/show_tools'
@@ -14,7 +14,7 @@ describe "catalog/_sort_and_per_page" do
14
14
  allow(view).to receive_messages(blacklight_config: blacklight_config)
15
15
  end
16
16
 
17
- it "should render the pagination, sort, per page and view type controls" do
17
+ it "renders the pagination, sort, per page and view type controls" do
18
18
  assign(:response, double("Solr::Response", limit_value: 1))
19
19
  stub_template "catalog/_paginate_compact.html.erb" => "paginate_compact"
20
20
  stub_template "catalog/_sort_widget.html.erb" => "sort_widget"
@@ -27,7 +27,7 @@ describe "catalog/_sort_and_per_page" do
27
27
  expect(rendered).to match /view_type_group/
28
28
  end
29
29
 
30
- it "should not render the pagination controls with bad limit values" do
30
+ it "does not render the pagination controls with bad limit values" do
31
31
  assign(:response, double("Solr::Response", limit_value: 0))
32
32
  stub_template "catalog/_paginate_compact.html.erb" => "paginate_compact"
33
33
  stub_template "catalog/_sort_widget.html.erb" => "sort_widget"
@@ -18,6 +18,7 @@ describe "catalog/_thumbnail_default" do
18
18
  end
19
19
 
20
20
  before do
21
+ allow(controller).to receive(:action_name).and_return('index')
21
22
  assign :response, double(start: 0)
22
23
  allow(view).to receive(:render_grouped_response?).and_return false
23
24
  allow(view).to receive(:blacklight_config).and_return(blacklight_config)
@@ -25,13 +26,13 @@ describe "catalog/_thumbnail_default" do
25
26
  allow(view).to receive(:search_session).and_return({})
26
27
  end
27
28
 
28
- it "should render the thumbnail if the document has one" do
29
+ it "renders the thumbnail if the document has one" do
29
30
  render :partial => "catalog/thumbnail_default", :locals => {:document => document_with_thumbnail_field, :document_counter => 1}
30
31
  expect(rendered).to match /document-thumbnail/
31
32
  expect(rendered).to match /src="http:\/\/localhost\/logo.png"/
32
33
  end
33
34
 
34
- it "should not render a thumbnail if the document does not have one" do
35
+ it "does not render a thumbnail if the document does not have one" do
35
36
  render :partial => "catalog/thumbnail_default", :locals => {:document => document_without_thumbnail_field, :document_counter => 1}
36
37
  expect(rendered).to eq ""
37
38
  end
@@ -17,13 +17,13 @@ describe "catalog/_view_type_group" do
17
17
  controller.request.path_parameters[:action] = 'index'
18
18
  end
19
19
 
20
- it "should not display the group when there's only one option" do
20
+ it "does not display the group when there's only one option" do
21
21
  assign(:response, [])
22
22
  render partial: 'catalog/view_type_group'
23
23
  expect(rendered).to be_empty
24
24
  end
25
25
 
26
- it "should display the group" do
26
+ it "displays the group" do
27
27
  assign(:response, [double])
28
28
  blacklight_config.configure do |config|
29
29
  config.view.delete(:list)
@@ -39,7 +39,7 @@ describe "catalog/_view_type_group" do
39
39
  end
40
40
 
41
41
 
42
- it "should set the current view to 'active'" do
42
+ it "sets the current view to 'active'" do
43
43
  assign(:response, [double])
44
44
  blacklight_config.configure do |config|
45
45
  config.view.delete(:list)