blacklight 6.3.1 → 6.3.3

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 (110) hide show
  1. checksums.yaml +4 -4
  2. data/.rspec +2 -1
  3. data/README.md +2 -2
  4. data/VERSION +1 -1
  5. data/app/views/catalog/_bookmark_control.html.erb +2 -2
  6. data/blacklight.gemspec +1 -1
  7. data/lib/generators/blacklight/solr5_generator.rb +1 -1
  8. data/lib/generators/blacklight/user_generator.rb +2 -2
  9. data/spec/controllers/alternate_controller_spec.rb +0 -1
  10. data/spec/controllers/application_controller_spec.rb +0 -1
  11. data/spec/controllers/blacklight/base_spec.rb +0 -1
  12. data/spec/controllers/blacklight/catalog/component_configuration_spec.rb +0 -1
  13. data/spec/controllers/blacklight/facet_spec.rb +0 -1
  14. data/spec/controllers/blacklight/search_fields_spec.rb +0 -1
  15. data/spec/controllers/blacklight/search_helper_spec.rb +0 -1
  16. data/spec/controllers/blacklight/suggest_search_spec.rb +0 -1
  17. data/spec/controllers/bookmarks_controller_spec.rb +0 -1
  18. data/spec/controllers/catalog_controller_spec.rb +0 -1
  19. data/spec/controllers/saved_searches_controller_spec.rb +0 -1
  20. data/spec/controllers/search_history_controller_spec.rb +0 -1
  21. data/spec/controllers/suggest_controller_spec.rb +0 -1
  22. data/spec/features/alternate_controller_spec.rb +0 -1
  23. data/spec/features/bookmarks_spec.rb +0 -1
  24. data/spec/features/did_you_mean_spec.rb +0 -1
  25. data/spec/features/facets_spec.rb +0 -1
  26. data/spec/features/record_view_spec.rb +0 -1
  27. data/spec/features/saved_searches_spec.rb +0 -1
  28. data/spec/features/search_context_spec.rb +0 -1
  29. data/spec/features/search_filters_spec.rb +0 -1
  30. data/spec/features/search_formats_spec.rb +0 -1
  31. data/spec/features/search_history_spec.rb +0 -1
  32. data/spec/features/search_pagination_spec.rb +0 -1
  33. data/spec/features/search_results_spec.rb +0 -1
  34. data/spec/features/search_sort_spec.rb +0 -1
  35. data/spec/features/search_spec.rb +0 -1
  36. data/spec/features/sitelinks_search_box.rb +0 -1
  37. data/spec/helpers/blacklight_helper_spec.rb +95 -153
  38. data/spec/helpers/catalog_helper_spec.rb +0 -1
  39. data/spec/helpers/configuration_helper_spec.rb +0 -1
  40. data/spec/helpers/deprecated_url_helper_behavior_spec.rb +0 -1
  41. data/spec/helpers/facets_helper_spec.rb +79 -113
  42. data/spec/helpers/hash_as_hidden_fields_spec.rb +0 -1
  43. data/spec/helpers/layout_helper_spec.rb +0 -1
  44. data/spec/helpers/render_constraints_helper_spec.rb +0 -1
  45. data/spec/helpers/search_history_constraints_helper_spec.rb +0 -1
  46. data/spec/helpers/suggest_helper_spec.rb +0 -1
  47. data/spec/helpers/url_helper_spec.rb +0 -1
  48. data/spec/lib/blacklight/parameters_spec.rb +0 -1
  49. data/spec/lib/blacklight/search_state_spec.rb +0 -1
  50. data/spec/lib/blacklight/utils_spec.rb +0 -1
  51. data/spec/lib/blacklight_spec.rb +0 -1
  52. data/spec/lib/tasks/blacklight_task_spec.rb +0 -1
  53. data/spec/models/blacklight/configurable_spec.rb +0 -1
  54. data/spec/models/blacklight/configuration/context_spec.rb +0 -1
  55. data/spec/models/blacklight/configuration_spec.rb +0 -1
  56. data/spec/models/blacklight/document/active_model_shim_spec.rb +0 -1
  57. data/spec/models/blacklight/document/cache_key_spec.rb +0 -1
  58. data/spec/models/blacklight/document/dublin_core_spec.rb +0 -1
  59. data/spec/models/blacklight/document/email_spec.rb +0 -1
  60. data/spec/models/blacklight/document/sms_spec.rb +0 -1
  61. data/spec/models/blacklight/document_spec.rb +0 -1
  62. data/spec/models/blacklight/facet_paginator_spec.rb +0 -1
  63. data/spec/models/blacklight/search_builder_spec.rb +0 -1
  64. data/spec/models/blacklight/solr/document/more_like_this_spec.rb +0 -1
  65. data/spec/models/blacklight/solr/document_spec.rb +0 -1
  66. data/spec/models/blacklight/solr/facet_paginator_spec.rb +0 -1
  67. data/spec/models/blacklight/solr/repository_spec.rb +0 -1
  68. data/spec/models/blacklight/solr/request_spec.rb +0 -1
  69. data/spec/models/blacklight/solr/response/facets_spec.rb +0 -1
  70. data/spec/models/blacklight/solr/response_spec.rb +0 -1
  71. data/spec/models/blacklight/solr/search_builder_spec.rb +0 -1
  72. data/spec/models/blacklight/suggest/response_spec.rb +0 -1
  73. data/spec/models/blacklight/user_spec.rb +0 -1
  74. data/spec/models/bookmark_spec.rb +0 -1
  75. data/spec/models/record_mailer_spec.rb +0 -1
  76. data/spec/models/search_spec.rb +0 -1
  77. data/spec/models/solr_document_spec.rb +0 -1
  78. data/spec/presenters/document_presenter_spec.rb +0 -1
  79. data/spec/presenters/index_presenter_spec.rb +0 -1
  80. data/spec/presenters/pipeline_spec.rb +0 -1
  81. data/spec/presenters/show_presenter_spec.rb +0 -1
  82. data/spec/spec_helper.rb +5 -8
  83. data/spec/test_app_templates/Gemfile.extra +1 -1
  84. data/spec/views/_user_util_links.html.erb_spec.rb +0 -1
  85. data/spec/views/catalog/_constraints.html.erb_spec.rb +0 -1
  86. data/spec/views/catalog/_constraints_element.html.erb_spec.rb +0 -5
  87. data/spec/views/catalog/_document.html.erb_spec.rb +3 -14
  88. data/spec/views/catalog/_document_list.html.erb_spec.rb +1 -4
  89. data/spec/views/catalog/_facet_index_navigation.html.erb_spec.rb +0 -3
  90. data/spec/views/catalog/_facet_layout.html.erb_spec.rb +2 -7
  91. data/spec/views/catalog/_facets.html.erb_spec.rb +6 -14
  92. data/spec/views/catalog/_index_default.erb_spec.rb +4 -7
  93. data/spec/views/catalog/_index_header_default.html.erb_spec.rb +2 -5
  94. data/spec/views/catalog/_paginate_compact.html.erb_spec.rb +3 -5
  95. data/spec/views/catalog/_search_header.erb_spec.rb +0 -2
  96. data/spec/views/catalog/_show_default.erb_spec.rb +7 -11
  97. data/spec/views/catalog/_show_sidebar.erb_spec.rb +0 -1
  98. data/spec/views/catalog/_show_tools.html.erb_spec.rb +3 -13
  99. data/spec/views/catalog/_sort_and_per_page.html.erb_spec.rb +1 -5
  100. data/spec/views/catalog/_thumbnail_default.erb_spec.rb +0 -1
  101. data/spec/views/catalog/_view_type_group.html.erb_spec.rb +3 -11
  102. data/spec/views/catalog/facet.html.erb_spec.rb +0 -1
  103. data/spec/views/catalog/facet.json.jbuilder_spec.rb +0 -1
  104. data/spec/views/catalog/index.atom.builder_spec.rb +21 -36
  105. data/spec/views/catalog/index.html.erb_spec.rb +0 -3
  106. data/spec/views/catalog/index.json.jbuilder_spec.rb +0 -1
  107. data/spec/views/catalog/opensearch.xml.builder_spec.rb +0 -1
  108. data/spec/views/catalog/show.html.erb_spec.rb +2 -13
  109. metadata +7 -9
  110. data/spec/spec.opts +0 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e5f399d49a4b81d638fd3a6b7dd2a79595895ef6
4
- data.tar.gz: 3ab2a5bfb36436d5c2febb62c6fa24f1b3026830
3
+ metadata.gz: fe529651eb30f40e0df003554a192dbc40d0ab30
4
+ data.tar.gz: d154c23eab23af0c127054df1e9ba245230ff620
5
5
  SHA512:
6
- metadata.gz: e83719b79cde64ee06a25074789458719b414c34c9eee9b4ae693c8b1a0bbdfe321acd0002421331aec2725c8d1fd957175dc1dda11873d1d79f79096fbccff6
7
- data.tar.gz: d90c449b77e6a30c0aee64967f6cb9b4048e131d1ff2e94b4238ad133505994606ce00da1ea90d5cc1359e39797d49d318d304550ebf9e4890fe15aad25e422b
6
+ metadata.gz: fad74eb425ca3df818b78d6b3e2f483b9b9b5250e549d487a1b467c4e4028649a844c10aee6487ac9b470754ce522a4444a7ddd3bf2a9c7aad86672831604363
7
+ data.tar.gz: 05301c63ff664355cd63125188c9d6e5aa1a0e22dbc2b1d63a4300825f5b71d696dd22a9bb0b768500285cbb75c2d88732afd316e048c03005914feb003d22d5
data/.rspec CHANGED
@@ -1 +1,2 @@
1
- --colour
1
+ --color
2
+ --require spec_helper
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Blacklight
2
2
 
3
- [![Build Status](https://travis-ci.org/projectblacklight/blacklight.png?branch=master)](https://travis-ci.org/projectblacklight/blacklight) [![Gem Version](https://badge.fury.io/rb/blacklight.png)](http://badge.fury.io/rb/blacklight)
3
+ [![Build Status](https://travis-ci.org/projectblacklight/blacklight.png?branch=master)](https://travis-ci.org/projectblacklight/blacklight) [![Gem Version](https://badge.fury.io/rb/blacklight.png)](http://badge.fury.io/rb/blacklight) [![Coverage Status](https://coveralls.io/repos/github/projectblacklight/blacklight/badge.svg?branch=master)](https://coveralls.io/github/projectblacklight/blacklight?branch=master)
4
4
 
5
5
  Blacklight is an open source Solr user interface discovery platform.
6
6
  You can use Blacklight to enable searching and browsing of your collections.
@@ -19,7 +19,7 @@ gem "blacklight"
19
19
 
20
20
  Run the install generator which will copy over some initial templates, migrations, routes, and configuration:
21
21
 
22
- ```
22
+ ```bash
23
23
  rails generate blacklight:install
24
24
  ```
25
25
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 6.3.1
1
+ 6.3.3
@@ -7,13 +7,13 @@
7
7
  <% unless bookmarked? document %>
8
8
 
9
9
  <%= form_tag( bookmark_path( document ), :method => :put, :class => "bookmark_toggle", "data-doc-id" => document.id, :'data-present' => t('blacklight.search.bookmarks.present'), :'data-absent' => t('blacklight.search.bookmarks.absent'), :'data-inprogress' => t('blacklight.search.bookmarks.inprogress')) do %>
10
- <%= submit_tag(t('blacklight.bookmarks.add.button'), :id => "bookmark_toggle_#{document.id.to_s.parameterize}", :class => "bookmark_add") %>
10
+ <%= submit_tag(t('blacklight.bookmarks.add.button'), :id => "bookmark_toggle_#{document.id.to_s.parameterize}", :class => "bookmark_add btn btn-default") %>
11
11
  <% end %>
12
12
 
13
13
  <% else %>
14
14
 
15
15
  <%= form_tag( bookmark_path( document ), :method => :delete, :class => "bookmark_toggle", "data-doc-id" => document.id, :'data-present' => t('blacklight.search.bookmarks.present'), :'data-absent' => t('blacklight.search.bookmarks.absent'), :'data-inprogress' => t('blacklight.search.bookmarks.inprogress')) do %>
16
- <%= submit_tag(t('blacklight.bookmarks.remove.button'), :id => "bookmark_toggle_#{document.id.to_s.parameterize}", :class => "bookmark_remove") %>
16
+ <%= submit_tag(t('blacklight.bookmarks.remove.button'), :id => "bookmark_toggle_#{document.id.to_s.parameterize}", :class => "bookmark_remove btn btn-default") %>
17
17
  <% end %>
18
18
 
19
19
  <% end %>
@@ -32,7 +32,7 @@ Gem::Specification.new do |s|
32
32
  s.add_dependency "rsolr", "~> 1.0", ">= 1.0.6" # Library for interacting with rSolr.
33
33
  s.add_dependency "bootstrap-sass", "~> 3.2"
34
34
  s.add_dependency "deprecation"
35
- s.add_dependency "twitter-typeahead-rails", '~> 0.11'
35
+ s.add_dependency "twitter-typeahead-rails", '0.11.1.pre.corejavascript'
36
36
 
37
37
  s.add_development_dependency "solr_wrapper"
38
38
  s.add_development_dependency "rspec-rails", "~> 3.5"
@@ -13,7 +13,7 @@ module Blacklight
13
13
  gem 'solr_wrapper', '>= 0.3'
14
14
  end
15
15
 
16
- append_to_file "Rakefile", "\nrequire 'solr_wrapper/rake_task'\n"
16
+ append_to_file "Rakefile", "\nrequire 'solr_wrapper/rake_task' unless Rails.env.production?\n"
17
17
  end
18
18
 
19
19
  def add_rsolr_gem
@@ -23,7 +23,7 @@ module Blacklight
23
23
  else
24
24
  gem "devise"
25
25
  end
26
- gem "devise-guests", "~> 0.3"
26
+ gem "devise-guests", "~> 0.5"
27
27
 
28
28
  Bundler.with_clean_env do
29
29
  run "bundle install"
@@ -58,7 +58,7 @@ module Blacklight
58
58
  "\n include Blacklight::User\n"
59
59
  end
60
60
  else
61
- say_status "warning", <<-EOS.strip_heredocs, :yellow
61
+ say_status "warning", <<-EOS.strip_heredoc, :yellow
62
62
  Blacklight authenticated user functionality not installed, as a user model
63
63
  could not be found at /app/models/user.rb. If you used a different name,
64
64
  please re-run the migration and provide that name as an argument. E.g.:
@@ -1,5 +1,4 @@
1
1
  # frozen_string_literal: true
2
- require 'spec_helper'
3
2
 
4
3
  describe AlternateController do
5
4
  describe "the search results tools" do
@@ -1,5 +1,4 @@
1
1
  # frozen_string_literal: true
2
- require 'spec_helper'
3
2
 
4
3
  describe ApplicationController do
5
4
 
@@ -1,5 +1,4 @@
1
1
  # frozen_string_literal: true
2
- require 'spec_helper'
3
2
 
4
3
  describe Blacklight::Base do
5
4
  let(:controller) { (Class.new(ApplicationController) { include Blacklight::Base }).new }
@@ -1,5 +1,4 @@
1
1
  # frozen_string_literal: true
2
- require 'spec_helper'
3
2
 
4
3
  describe Blacklight::DefaultComponentConfiguration do
5
4
  subject do
@@ -1,5 +1,4 @@
1
1
  # frozen_string_literal: true
2
- require 'spec_helper'
3
2
 
4
3
  describe Blacklight::Facet do
5
4
  subject do
@@ -1,5 +1,4 @@
1
1
  # frozen_string_literal: true
2
- require 'spec_helper'
3
2
 
4
3
  describe Blacklight::SearchFields do
5
4
 
@@ -1,5 +1,4 @@
1
1
  # frozen_string_literal: true
2
- require 'spec_helper'
3
2
 
4
3
  # check the methods that do solr requests. Note that we are not testing if
5
4
  # solr gives "correct" responses, as that's out of scope (it's a part of
@@ -1,5 +1,4 @@
1
1
  # frozen_string_literal: true
2
- require 'spec_helper'
3
2
 
4
3
  describe Blacklight::SuggestSearch do
5
4
  let(:params) { {q: 'test'} }
@@ -1,5 +1,4 @@
1
1
  # frozen_string_literal: true
2
- require 'spec_helper'
3
2
 
4
3
  describe BookmarksController do
5
4
  # jquery 1.9 ajax does error callback if 200 returns empty body. so use 204 instead.
@@ -1,5 +1,4 @@
1
1
  # frozen_string_literal: true
2
- require 'spec_helper'
3
2
 
4
3
  describe CatalogController do
5
4
 
@@ -1,5 +1,4 @@
1
1
  # frozen_string_literal: true
2
- require 'spec_helper'
3
2
 
4
3
  describe SavedSearchesController do
5
4
  routes { Blacklight::Engine.routes }
@@ -1,5 +1,4 @@
1
1
  # frozen_string_literal: true
2
- require 'spec_helper'
3
2
 
4
3
  describe SearchHistoryController do
5
4
  routes { Blacklight::Engine.routes }
@@ -1,5 +1,4 @@
1
1
  # frozen_string_literal: true
2
- require 'spec_helper'
3
2
 
4
3
  describe SuggestController do
5
4
  routes { Blacklight::Engine.routes }
@@ -1,5 +1,4 @@
1
1
  # frozen_string_literal: true
2
- require 'spec_helper'
3
2
 
4
3
  describe "Alternate Controller Behaviors" do
5
4
  it "has the correct per-page form" do
@@ -1,5 +1,4 @@
1
1
  # frozen_string_literal: true
2
- require 'spec_helper'
3
2
 
4
3
  describe "Bookmarks" do
5
4
  describe "navigating from the homepage" do
@@ -1,5 +1,4 @@
1
1
  # frozen_string_literal: true
2
- require 'spec_helper'
3
2
 
4
3
  describe "Did You Mean" do
5
4
  before { visit root_path }
@@ -1,5 +1,4 @@
1
1
  # frozen_string_literal: true
2
- require 'spec_helper'
3
2
 
4
3
  describe "Facets" do
5
4
  it "shows a single facet's values" do
@@ -1,5 +1,4 @@
1
1
  # frozen_string_literal: true
2
- require 'spec_helper'
3
2
 
4
3
  describe "Record View" do
5
4
  it "displays a normal record" do
@@ -1,5 +1,4 @@
1
1
  # frozen_string_literal: true
2
- require 'spec_helper'
3
2
 
4
3
  describe "Saved Searches" do
5
4
  before do
@@ -1,5 +1,4 @@
1
1
  # frozen_string_literal: true
2
- require 'spec_helper'
3
2
 
4
3
  describe "Search Results context", js: true do
5
4
  it "passes the current search id through" do
@@ -1,5 +1,4 @@
1
1
  # frozen_string_literal: true
2
- require 'spec_helper'
3
2
 
4
3
  describe "Facets" do
5
4
  it "works without a search term" do
@@ -1,5 +1,4 @@
1
1
  # frozen_string_literal: true
2
- require 'spec_helper'
3
2
 
4
3
  describe "Search Formats" do
5
4
  before do
@@ -1,5 +1,4 @@
1
1
  # frozen_string_literal: true
2
- require 'spec_helper'
3
2
 
4
3
  describe "Search History Page" do
5
4
  describe "navigating from the homepage" do
@@ -1,5 +1,4 @@
1
1
  # frozen_string_literal: true
2
- require 'spec_helper'
3
2
 
4
3
  describe "Search Pagination" do
5
4
  it "has results with pagination" do
@@ -1,5 +1,4 @@
1
1
  # frozen_string_literal: true
2
- require 'spec_helper'
3
2
 
4
3
  describe "Search Results" do
5
4
  it "has for an empty query" do
@@ -1,5 +1,4 @@
1
1
  # frozen_string_literal: true
2
- require 'spec_helper'
3
2
 
4
3
  describe "Search Sort" do
5
4
  it "sorts on facet results with no search terms" do
@@ -1,5 +1,4 @@
1
1
  # frozen_string_literal: true
2
- require 'spec_helper'
3
2
 
4
3
  describe "Search Page" do
5
4
  it "shows welcome" do
@@ -1,5 +1,4 @@
1
1
  # frozen_string_literal: true
2
- require 'spec_helper'
3
2
 
4
3
  feature 'Sitelinks search box' do
5
4
  scenario 'is home page' do
@@ -1,16 +1,5 @@
1
1
  # frozen_string_literal: true
2
- require 'spec_helper'
3
-
4
2
  describe BlacklightHelper do
5
- include ERB::Util
6
- include BlacklightHelper
7
- def blacklight_config
8
- @config ||= Blacklight::Configuration.new.configure do |config|
9
- config.index.title_field = 'title_display'
10
- config.index.display_type_field = 'format'
11
- end
12
- end
13
-
14
3
  before(:each) do
15
4
  allow(helper).to receive(:current_or_guest_user).and_return(User.new)
16
5
  allow(helper).to receive(:search_action_path) do |*args|
@@ -18,18 +7,14 @@ describe BlacklightHelper do
18
7
  end
19
8
  end
20
9
 
21
- def current_search_session
22
-
23
- end
24
-
25
10
  describe "#application_name", :test => true do
11
+ it "defaults to 'Blacklight'" do
12
+ expect(application_name).to eq "Blacklight"
13
+ end
26
14
  it "uses the Rails application config application_name if available" do
27
15
  allow(Rails.application).to receive(:config).and_return(double(application_name: "asdf"))
28
16
  expect(application_name).to eq "asdf"
29
17
  end
30
- it "defaults to 'Blacklight'" do
31
- expect(application_name).to eq "Blacklight"
32
- end
33
18
  end
34
19
 
35
20
  describe "#render_page_title" do
@@ -37,12 +22,10 @@ describe BlacklightHelper do
37
22
  helper.content_for(:page_title) { "xyz" }
38
23
  expect(helper.render_page_title).to eq "xyz"
39
24
  end
40
-
41
25
  it "looks in the @page_title ivar" do
42
26
  assign(:page_title, "xyz")
43
27
  expect(helper.render_page_title).to eq "xyz"
44
28
  end
45
-
46
29
  it "defaults to the application name" do
47
30
  expect(helper.render_page_title).to eq helper.application_name
48
31
  end
@@ -52,8 +35,17 @@ describe BlacklightHelper do
52
35
  let(:document) { double }
53
36
  let(:result) { double }
54
37
  let(:presenter) { Blacklight::DocumentPresenter.new(document, self) }
38
+ let(:blacklight_config) do
39
+ Blacklight::Configuration.new.configure do |config|
40
+ config.index.title_field = 'title_display'
41
+ config.index.display_type_field = 'format'
42
+ end
43
+ end
55
44
 
56
- before { allow(helper).to receive(:presenter).and_return(presenter) }
45
+ before do
46
+ allow(helper).to receive(:presenter).and_return(presenter)
47
+ allow(helper).to receive(:blacklight_config).and_return(blacklight_config)
48
+ end
57
49
 
58
50
  it "generates <link rel=alternate> tags" do
59
51
  expect(presenter).to receive(:link_rel_alternates).and_return(result)
@@ -73,7 +65,6 @@ describe BlacklightHelper do
73
65
  config.index.display_type_field = 'format'
74
66
  end
75
67
  end
76
-
77
68
  let(:document) { SolrDocument.new('title_display' => "A Fake Document", 'id'=>'8') }
78
69
 
79
70
  before do
@@ -128,13 +119,12 @@ describe BlacklightHelper do
128
119
  it "is true" do
129
120
  expect(helper.should_render_index_field?(double, double)).to be true
130
121
  end
131
-
122
+
132
123
  it "is false if the document doesn't have a value for the field" do
133
124
  allow(helper).to receive_messages(document_has_value?: false)
134
125
  expect(helper.should_render_index_field?(double, double)).to be false
135
-
136
126
  end
137
-
127
+
138
128
  it "is false if the configuration has the field disabled" do
139
129
  allow(helper).to receive_messages(should_render_field?: false)
140
130
  expect(helper.should_render_index_field?(double, double)).to be false
@@ -145,93 +135,80 @@ describe BlacklightHelper do
145
135
  before do
146
136
  allow(helper).to receive_messages(should_render_field?: true, document_has_value?: true)
147
137
  end
148
-
138
+
149
139
  it "is true" do
150
140
  expect(helper.should_render_show_field?(double, double)).to be true
151
141
  end
152
-
142
+
153
143
  it "is false if the document doesn't have a value for the field" do
154
144
  allow(helper).to receive_messages(document_has_value?: false)
155
145
  expect(helper.should_render_show_field?(double, double)).to be false
156
-
157
146
  end
158
-
147
+
159
148
  it "is false if the configuration has the field disabled" do
160
149
  allow(helper).to receive_messages(should_render_field?: false)
161
150
  expect(helper.should_render_show_field?(double, double)).to be false
162
151
  end
163
152
  end
164
153
 
165
- describe "#render_index_field_value" do
154
+ context "render methods" do
155
+ let(:field) { "some_field" }
156
+ let(:doc) { double }
166
157
  let(:presenter) { double }
167
158
  before do
168
- allow(Deprecation).to receive(:warn)
159
+ allow(Deprecation).to receive(:warn) # TODO: purge Deprecations
169
160
  allow(helper).to receive(:presenter).with(doc).and_return(presenter)
170
161
  end
171
162
 
172
- let(:doc) { double }
173
- let(:field) { "some_field" }
174
-
175
- it "passes the document and field through to the presenter" do
176
- expect(presenter).to receive(:field_value).with(field, {})
177
- helper.render_index_field_value(doc, field)
178
- end
163
+ describe "#render_index_field_value" do
164
+ it "passes the document and field through to the presenter" do
165
+ expect(presenter).to receive(:field_value).with(field, {})
166
+ helper.render_index_field_value(doc, field)
167
+ end
179
168
 
180
- it "allows the document and field to be passed as hash arguments" do
181
- expect(presenter).to receive(:field_value).with(field, {})
182
- helper.render_index_field_value(document: doc, field: field)
183
- end
169
+ it "allows the document and field to be passed as hash arguments" do
170
+ expect(presenter).to receive(:field_value).with(field, {})
171
+ helper.render_index_field_value(document: doc, field: field)
172
+ end
184
173
 
185
- it "allows additional options to be passed to the presenter" do
186
- expect(presenter).to receive(:field_value).with(field, x: 1)
187
- helper.render_index_field_value(document: doc, field: field, x: 1)
188
- end
189
- end
190
-
191
- describe "#render_document_show_field_value" do
192
- let(:presenter) { double }
193
- before do
194
- allow(helper).to receive(:presenter).with(doc).and_return(presenter)
195
- allow(Deprecation).to receive(:warn)
174
+ it "allows additional options to be passed to the presenter" do
175
+ expect(presenter).to receive(:field_value).with(field, x: 1)
176
+ helper.render_index_field_value(document: doc, field: field, x: 1)
177
+ end
196
178
  end
197
179
 
198
- let(:doc) { double }
199
- let(:field) { "some_field" }
200
-
201
- it "passes the document and field through to the presenter" do
202
- expect(presenter).to receive(:field_value).with(field, {})
203
- helper.render_document_show_field_value(doc, field)
204
- end
180
+ describe "#render_document_show_field_value" do
181
+ it "passes the document and field through to the presenter" do
182
+ expect(presenter).to receive(:field_value).with(field, {})
183
+ helper.render_document_show_field_value(doc, field)
184
+ end
205
185
 
206
- it "allows the document and field to be passed as hash arguments" do
207
- expect(presenter).to receive(:field_value).with(field, {})
208
- helper.render_document_show_field_value(document: doc, field: field)
209
- end
186
+ it "allows the document and field to be passed as hash arguments" do
187
+ expect(presenter).to receive(:field_value).with(field, {})
188
+ helper.render_document_show_field_value(document: doc, field: field)
189
+ end
210
190
 
211
- it "allows additional options to be passed to the presenter" do
212
- expect(presenter).to receive(:field_value).with(field, x: 1)
213
- helper.render_document_show_field_value(document: doc, field: field, x: 1)
191
+ it "allows additional options to be passed to the presenter" do
192
+ expect(presenter).to receive(:field_value).with(field, x: 1)
193
+ helper.render_document_show_field_value(document: doc, field: field, x: 1)
194
+ end
214
195
  end
215
196
  end
216
-
197
+
217
198
  describe "#document_has_value?" do
199
+ let(:doc) { double() }
218
200
  it "ifs the document has the field value" do
219
- doc = double()
220
201
  allow(doc).to receive(:has?).with('asdf').and_return(true)
221
202
  field_config = double(:field => 'asdf')
222
203
  expect(helper.document_has_value?(doc, field_config)).to eq true
223
204
  end
224
-
225
205
  it "ifs the document has a highlight field value" do
226
- doc = double()
227
206
  allow(doc).to receive(:has?).with('asdf').and_return(false)
228
207
  allow(doc).to receive(:has_highlight_field?).with('asdf').and_return(true)
229
208
  field_config = double(:field => 'asdf', :highlight => true)
230
209
  expect(helper.document_has_value?(doc, field_config)).to eq true
231
210
  end
232
-
233
211
  it "ifs the field has a model accessor" do
234
- doc = double()
235
212
  allow(doc).to receive(:has?).with('asdf').and_return(false)
236
213
  allow(doc).to receive(:has_highlight_field?).with('asdf').and_return(false)
237
214
  field_config = double(:field => 'asdf', :highlight => true, :accessor => true)
@@ -245,7 +222,6 @@ describe BlacklightHelper do
245
222
  expect(helper.render_grouped_response?).to be true
246
223
  end
247
224
 
248
-
249
225
  it "checks if the response param contains grouped data" do
250
226
  response = double("Solr::Response", :grouped? => true)
251
227
  expect(helper.render_grouped_response?(response)).to be true
@@ -253,45 +229,42 @@ describe BlacklightHelper do
253
229
  end
254
230
 
255
231
  describe "render_grouped_document_index" do
256
-
232
+ pending 'not implemented'
257
233
  end
258
234
 
259
235
  describe "should_show_spellcheck_suggestions?" do
260
- before :each do
236
+ before do
261
237
  allow(helper).to receive_messages spell_check_max: 5
262
238
  end
263
239
  it "does not show suggestions if there are enough results" do
264
240
  response = double(total: 10)
265
241
  expect(helper.should_show_spellcheck_suggestions? response).to be false
266
242
  end
267
-
268
243
  it "onlies show suggestions if there are very few results" do
269
244
  response = double(total: 4, spelling: double(words: [1]))
270
245
  expect(helper.should_show_spellcheck_suggestions? response).to be true
271
246
  end
272
-
273
247
  it "shows suggestions only if there are spelling suggestions available" do
274
248
  response = double(total: 4, spelling: double(words: []))
275
249
  expect(helper.should_show_spellcheck_suggestions? response).to be false
276
250
  end
277
251
  end
278
-
252
+
279
253
  describe "#render_document_partials" do
280
254
  let(:doc) { double }
281
255
  before do
282
256
  allow(helper).to receive_messages(document_partial_path_templates: [])
283
257
  allow(helper).to receive_messages(document_index_view_type: 'index_header')
284
258
  end
285
-
259
+
286
260
  it "gets the document format from document_partial_name" do
287
261
  allow(helper).to receive(:document_partial_name).with(doc, :xyz)
288
- helper.render_document_partial(doc, :xyz)
262
+ helper.render_document_partial(doc, :xyz)
289
263
  end
290
264
  end
291
265
 
292
266
  describe "#document_partial_name" do
293
267
  let(:blacklight_config) { Blacklight::Configuration.new }
294
-
295
268
  before do
296
269
  allow(helper).to receive_messages(blacklight_config: blacklight_config)
297
270
  end
@@ -305,7 +278,6 @@ describe BlacklightHelper do
305
278
 
306
279
  context "with a solr document with the display type field set" do
307
280
  let(:document) { SolrDocument.new 'my_field' => 'xyz'}
308
-
309
281
  before do
310
282
  blacklight_config.show.display_type_field = 'my_field'
311
283
  end
@@ -313,68 +285,60 @@ describe BlacklightHelper do
313
285
  it "uses the value in the configured display type field" do
314
286
  expect(helper.document_partial_name(document)).to eq 'xyz'
315
287
  end
316
-
317
288
  it "uses the value in the configured display type field if the action-specific field is empty" do
318
289
  expect(helper.document_partial_name(document, :some_action)).to eq 'xyz'
319
290
  end
320
291
  end
321
292
 
322
293
  context "with a solr doucment with an action-specific field set" do
323
-
324
294
  let(:document) { SolrDocument.new 'my_field' => 'xyz', 'other_field' => 'abc' }
325
-
326
295
  before do
327
296
  blacklight_config.show.media_display_type_field = 'my_field'
328
297
  blacklight_config.show.metadata_display_type_field = 'other_field'
329
298
  end
330
-
331
299
  it "uses the value in the action-specific fields" do
332
300
  expect(helper.document_partial_name(document, :media)).to eq 'xyz'
333
301
  expect(helper.document_partial_name(document, :metadata)).to eq 'abc'
334
302
  end
335
-
336
303
  end
337
304
  end
305
+
338
306
  describe "#type_field_to_partial_name" do
339
307
  let(:document) { double }
340
308
  context "with default value" do
341
309
  subject { helper.type_field_to_partial_name(document, 'default') }
342
- it { should eq 'default' }
310
+ it { should eq 'default' }
343
311
  end
344
312
  context "with spaces" do
345
313
  subject { helper.type_field_to_partial_name(document, 'one two three') }
346
- it { should eq 'one_two_three' }
314
+ it { should eq 'one_two_three' }
347
315
  end
348
316
  context "with hyphens" do
349
317
  subject { helper.type_field_to_partial_name(document, 'one-two-three') }
350
- it { should eq 'one_two_three' }
318
+ it { should eq 'one_two_three' }
351
319
  end
352
320
  context "an array" do
353
321
  subject { helper.type_field_to_partial_name(document, ['one', 'two', 'three']) }
354
- it { should eq 'one_two_three' }
322
+ it { should eq 'one_two_three' }
355
323
  end
356
324
  end
357
-
325
+
358
326
  describe "#opensearch_description_tag" do
359
327
  subject { helper.opensearch_description_tag 'title', 'href' }
360
-
361
328
  it "has a search rel" do
362
329
  expect(subject).to have_selector "link[rel='search']", visible: false
363
330
  end
364
-
365
331
  it "has the correct mime type" do
366
332
  expect(subject).to have_selector "link[type='application/opensearchdescription+xml']", visible: false
367
333
  end
368
-
369
334
  it "has a title attribute" do
370
335
  expect(subject).to have_selector "link[title='title']", visible: false
371
336
  end
372
-
373
337
  it "has an href attribute" do
374
338
  expect(subject).to have_selector "link[href='href']", visible: false
375
339
  end
376
340
  end
377
-
341
+
378
342
  describe "#render_document_index" do
379
343
  it "renders the document index with the current view type" do
380
344
  allow(helper).to receive_messages(document_index_view_type: :current_view)
@@ -382,10 +346,9 @@ describe BlacklightHelper do
382
346
  helper.render_document_index [], a: 1, b: 2
383
347
  end
384
348
  end
385
-
349
+
386
350
  describe "#render_document_index_with_view" do
387
351
  let(:obj1) { SolrDocument.new }
388
-
389
352
  before do
390
353
  allow(helper).to receive(:blacklight_config).and_return(CatalogController.blacklight_config)
391
354
  assign(:response, double("Solr::Response", grouped?: false, start: 0))
@@ -416,7 +379,7 @@ describe BlacklightHelper do
416
379
  allow(helper).to receive(:document_index_views).and_return(a: 1, b: 2)
417
380
  expect(helper.document_index_view_type(view: :c)).to eq :xyz
418
381
  end
419
-
382
+
420
383
  context "when they have a preferred view" do
421
384
  before do
422
385
  session[:preferred_view] = :b
@@ -443,76 +406,55 @@ describe BlacklightHelper do
443
406
  end
444
407
  end
445
408
 
446
- describe "#presenter_class" do
447
- before do
448
- allow(helper).to receive(:blacklight_config).and_return(blacklight_config)
449
- end
450
-
451
- it "uses the value defined in the blacklight configuration" do
452
- expect(Deprecation).to receive(:warn).exactly(4).times
453
- blacklight_config.document_presenter_class = presenter_class
454
- expect(helper.presenter_class).to eq presenter_class
455
- end
456
-
457
- it "defaults to Blacklight::DocumentPresenter" do
458
- expect(Deprecation).to receive(:warn)
459
- expect(helper.presenter_class).to eq Blacklight::DocumentPresenter
460
- end
461
- end
462
-
463
- describe "#index_presenter_class" do
409
+ context "related classes" do
410
+ let(:presenter_class) { double }
411
+ let(:blacklight_config) { Blacklight::Configuration.new }
464
412
  before do
465
413
  allow(helper).to receive(:blacklight_config).and_return(blacklight_config)
466
414
  end
467
415
 
468
- let :blacklight_config do
469
- Blacklight::Configuration.new
470
- end
471
-
472
- let :presenter_class do
473
- double
474
- end
475
-
476
- it "uses the value defined in the blacklight configuration" do
477
- blacklight_config.index.document_presenter_class = presenter_class
478
- expect(helper.index_presenter_class(nil)).to eq presenter_class
479
- end
480
-
481
- it "defaults to Blacklight::IndexPresenter" do
482
- expect(helper.index_presenter_class(nil)).to eq Blacklight::IndexPresenter
483
- end
484
- end
416
+ describe "#presenter_class" do
417
+ it "uses the value defined in the blacklight configuration" do
418
+ expect(Deprecation).to receive(:warn).exactly(2).times
419
+ blacklight_config.document_presenter_class = presenter_class
420
+ expect(helper.presenter_class).to eq presenter_class
421
+ end
485
422
 
486
- describe "#show_presenter_class" do
487
- before do
488
- allow(helper).to receive(:blacklight_config).and_return(blacklight_config)
423
+ it "defaults to Blacklight::DocumentPresenter" do
424
+ expect(Deprecation).to receive(:warn)
425
+ expect(helper.presenter_class).to eq Blacklight::DocumentPresenter
426
+ end
489
427
  end
490
428
 
491
- let :blacklight_config do
492
- Blacklight::Configuration.new
493
- end
429
+ describe "#index_presenter_class" do
430
+ it "uses the value defined in the blacklight configuration" do
431
+ blacklight_config.index.document_presenter_class = presenter_class
432
+ expect(helper.index_presenter_class(nil)).to eq presenter_class
433
+ end
494
434
 
495
- let :presenter_class do
496
- double
435
+ it "defaults to Blacklight::IndexPresenter" do
436
+ expect(helper.index_presenter_class(nil)).to eq Blacklight::IndexPresenter
437
+ end
497
438
  end
498
439
 
499
- it "uses the value defined in the blacklight configuration" do
500
- blacklight_config.show.document_presenter_class = presenter_class
501
- expect(helper.show_presenter_class(nil)).to eq presenter_class
502
- end
440
+ describe "#show_presenter_class" do
441
+ it "uses the value defined in the blacklight configuration" do
442
+ blacklight_config.show.document_presenter_class = presenter_class
443
+ expect(helper.show_presenter_class(nil)).to eq presenter_class
444
+ end
503
445
 
504
- it "defaults to Blacklight::DocumentPresenter" do
505
- expect(helper.show_presenter_class(nil)).to eq Blacklight::ShowPresenter
446
+ it "defaults to Blacklight::DocumentPresenter" do
447
+ expect(helper.show_presenter_class(nil)).to eq Blacklight::ShowPresenter
448
+ end
506
449
  end
507
450
  end
508
451
 
509
452
  describe "#render_document_heading" do
453
+ let(:document) { double }
510
454
  before do
511
455
  allow(helper).to receive(:presenter).and_return(double(heading: "Heading"))
512
456
  end
513
457
 
514
- let(:document) { double }
515
-
516
458
  it "accepts no arguments and render the document heading" do
517
459
  expect(helper.render_document_heading).to have_selector "h4", text: "Heading"
518
460
  end
@@ -525,7 +467,7 @@ describe BlacklightHelper do
525
467
  allow(helper).to receive(:presenter).with(document).and_return(double(heading: "Document Heading"))
526
468
  expect(helper.render_document_heading(document)).to have_selector "h4", text: "Document Heading"
527
469
  end
528
-
470
+
529
471
  it "accepts the document with a tag option" do
530
472
  allow(helper).to receive(:presenter).with(document).and_return(double(heading: "Document Heading"))
531
473
  expect(helper.render_document_heading(document, tag: "h3")).to have_selector "h3", text: "Document Heading"