blacklight 5.18.0 → 5.19.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3a0b1d1a62262bce3d881921729256a4171e29b8
4
- data.tar.gz: b245309f402218cf2a31ecc8140b2ded3415b6f8
3
+ metadata.gz: 1d95698b0c62bbcfda4b25ab964d44e561038f2a
4
+ data.tar.gz: bf198778fca1e08d985d5f25bcdb81d618d265d4
5
5
  SHA512:
6
- metadata.gz: 982f053854b9ace7a94da7f6f5590ab79a5d516855b556ea8f48aa79e71dda90adbe7caf80cd17ddc7d486de4c7b4f1077f32de4e65daea5362614b2c3ea8953
7
- data.tar.gz: f96310c7a544d0179e42253dba5255f8cdfceb1c231ad13ed156e68b043ee8dff64f836bd8f85c8349b3093478dbef378eb3075759794a3d0cc266ef5ebda817
6
+ metadata.gz: 920425d9d9c2a45bde71b8fb12dc53071bfcca0e4e26579052ca8e8e7b40d9d9a0e01dae1c4a1665d7525a7302dca3cb612217fc23b6da272db702d6bff08a7b
7
+ data.tar.gz: 646bb31cea472f1211ea0d3bca51e422eec059a473b4c56cc0a2b43489039071e4c212992d30b3daf93122ec784590931f08ba15c7f03823077b9d3372e1be73
data/.gitignore CHANGED
@@ -13,3 +13,4 @@ lib/solrmarc.log.*
13
13
  tmp/*
14
14
  pkg/*
15
15
  .internal_test_app
16
+ /spec/examples.txt
@@ -648,10 +648,6 @@ Style/Blocks:
648
648
  ugly). Prefer {...} over do...end for single-line blocks.
649
649
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#single-line-blocks
650
650
  Enabled: true
651
- Style/CaseEquality:
652
- Description: Avoid explicit use of the case equality operator(===).
653
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-case-equality
654
- Enabled: false
655
651
  Style/CharacterLiteral:
656
652
  Description: Checks for uses of character literals.
657
653
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-character-literals
@@ -5,26 +5,24 @@ notifications:
5
5
  email: false
6
6
 
7
7
  rvm:
8
- - 2.2.3
8
+ - 2.3.1
9
9
 
10
10
  matrix:
11
11
  include:
12
- - rvm: 2.2.3
12
+ - rvm: 2.2.5
13
13
  env: "RAILS_VERSION=4.0.13"
14
- - rvm: 2.2.3
14
+ - rvm: 2.2.5
15
15
  env: "RAILS_VERSION=4.1.13"
16
- - rvm: 2.1.7
17
- env: "RAILS_VERSION=4.2.4"
18
- - rvm: jruby
19
- env: "RAILS_VERSION=4.2.4 JRUBY_OPTS=\"-J-Xms512m -J-Xmx1024m\""
20
- - rvm: 1.9.3
21
- env: "RAILS_VERSION=4.2.4"
16
+ - rvm: 2.1.5
17
+ env: "RAILS_VERSION=4.2.7.1"
18
+ - rvm: jruby-9.0.5.0
19
+ env: "RAILS_VERSION=4.2.7.1 JRUBY_OPTS=\"-J-Xms512m -J-Xmx1024m\""
22
20
 
23
21
  before_install:
24
22
  - gem install bundler
25
23
 
26
24
  env:
27
- - "RAILS_VERSION=4.2.4"
25
+ - "RAILS_VERSION=4.2.7.1"
28
26
 
29
27
  notifications:
30
28
  irc: "irc.freenode.org#blacklight"
data/VERSION CHANGED
@@ -1 +1 @@
1
- 5.18.0
1
+ 5.19.0
@@ -9,17 +9,31 @@ Blacklight = function() {
9
9
  for(var i = 0; i < buffer.length; i++) {
10
10
  buffer[i].call();
11
11
  }
12
+ },
13
+
14
+ listeners: function () {
15
+ var listeners = [];
16
+ if (Turbolinks && Turbolinks.supported) {
17
+ // Turbolinks 5
18
+ if (Turbolinks.BrowserAdapter) {
19
+ listeners.push('turbolinks:load');
20
+ } else {
21
+ // Turbolinks < 5
22
+ listeners.push('page:load', 'ready');
23
+ }
24
+ } else {
25
+ listeners.push('ready');
26
+ }
27
+
28
+ return listeners.join(' ');
12
29
  }
13
- }
30
+ };
14
31
  }();
15
32
 
16
33
  // turbolinks triggers page:load events on page transition
17
34
  // If app isn't using turbolinks, this event will never be triggered, no prob.
18
- $(document).on('page:load', function() {
35
+ $(document).on(Blacklight.listeners(), function() {
19
36
  Blacklight.activate();
20
37
  });
21
38
 
22
- $(document).ready(function() {
23
- Blacklight.activate();
24
- });
25
39
 
@@ -187,7 +187,7 @@ module Blacklight::CatalogHelperBehavior
187
187
  end
188
188
 
189
189
  if value
190
- if url_options === false || url_options[:suppress_link]
190
+ if url_options == false || url_options[:suppress_link]
191
191
  value
192
192
  else
193
193
  link_to_document document, value, url_options
@@ -196,7 +196,7 @@ module Blacklight::ConfigurationHelperBehavior
196
196
  # @param displayable_config [#if,#unless] an object that responds to if/unless
197
197
  # @return [Boolean]
198
198
  def evaluate_if_unless_configuration displayable_config, *args
199
- return displayable_config if displayable_config === true or displayable_config === false
199
+ return displayable_config if displayable_config == true or displayable_config == false
200
200
 
201
201
  if_value = !displayable_config.respond_to?(:if) ||
202
202
  displayable_config.if.nil? ||
@@ -218,7 +218,7 @@ module Blacklight::FacetsHelperBehavior
218
218
  facet_config.query[value][:label]
219
219
  when facet_config.date
220
220
  localization_options = {}
221
- localization_options = facet_config.date unless facet_config.date === true
221
+ localization_options = facet_config.date unless facet_config.date == true
222
222
  l(value.to_datetime, localization_options)
223
223
  else
224
224
  value
@@ -167,7 +167,7 @@ module Blacklight
167
167
  @document.highlight_field(field_config.field).map(&:html_safe) if @document.has_highlight_field? field_config.field
168
168
  when (field_config and field_config.accessor)
169
169
  # implicit method call
170
- if field_config.accessor === true
170
+ if field_config.accessor == true
171
171
  @document.send(field)
172
172
  # arity-1 method call (include the field name in the call)
173
173
  elsif !field_config.accessor.is_a?(Array) && @document.method(field_config.accessor).arity != 0
@@ -194,7 +194,7 @@ module Blacklight
194
194
  when (field_config and field_config.helper_method)
195
195
  @controller.send(field_config.helper_method, options.merge(document: @document, field: field, config: field_config, value: value))
196
196
  when (field_config and field_config.link_to_search)
197
- link_field = if field_config.link_to_search === true
197
+ link_field = if field_config.link_to_search == true
198
198
  field_config.key
199
199
  else
200
200
  field_config.link_to_search
@@ -125,7 +125,7 @@ module Blacklight
125
125
 
126
126
  protected
127
127
  def luke_fields
128
- if @table[:luke_fields] === false
128
+ if @table[:luke_fields] == false
129
129
  return nil
130
130
  end
131
131
 
@@ -15,7 +15,7 @@ module Blacklight
15
15
  # @param [List<Symbol>,TrueClass] processor_chain a list of filter methods to run or true, to use the default methods
16
16
  # @param [Object] scope the scope where the filter methods reside in.
17
17
  def initialize(processor_chain, scope)
18
- @processor_chain = if processor_chain === true
18
+ @processor_chain = if processor_chain == true
19
19
  default_processor_chain.dup
20
20
  else
21
21
  processor_chain
@@ -57,7 +57,7 @@ module Blacklight::Solr::Response::Spelling
57
57
  # origFreq =>
58
58
  # suggestion => [{ frequency =>, word => }] # for extended results
59
59
  # suggestion => ['word'] # for non-extended results
60
- if suggestions.index("correctlySpelled")
60
+ if term_info['suggestion'].first.is_a?(Hash) or suggestions.index("correctlySpelled")
61
61
  word_suggestions << term_info['suggestion'].map do |suggestion|
62
62
  suggestion['word'] if suggestion['freq'] > term_info['origFreq']
63
63
  end
@@ -6,10 +6,15 @@ describe "Search Formats" do
6
6
  before do
7
7
  # Get all the fields from Solr, so the #index documents have the MARC field (to trigger appropriate
8
8
  # export formats)
9
+ @current = CatalogController.blacklight_config.default_solr_params.dup
9
10
  CatalogController.blacklight_config.default_solr_params[:fl] = '*'
10
11
  end
11
12
 
12
- it "should have an RSS XML response" do
13
+ after do
14
+ CatalogController.blacklight_config.default_solr_params = @current
15
+ end
16
+
17
+ it "has an RSS XML response" do
13
18
  visit "/catalog.rss?q="
14
19
  expect(page).to have_content "Blacklight Search Results"
15
20
  doc = Nokogiri::XML(page.body)
@@ -10,13 +10,13 @@ describe HashAsHiddenFieldsHelper do
10
10
 
11
11
  generated = render_hash_as_hidden_fields(@hash)
12
12
 
13
- expect(generated).to have_selector("input[type='hidden'][name='q'][value='query']")
14
- expect(generated).to have_selector("input[type='hidden'][name='per_page'][value='10']")
15
- expect(generated).to have_selector("input[type='hidden'][name='page'][value='5']")
16
- expect(generated).to have_selector("input[type='hidden'][name='extra_arbitrary_key'][value='arbitrary_value']")
17
- expect(generated).to have_selector("input[type='hidden'][name='f[field2][]'][value='z']")
18
- expect(generated).to have_selector("input[type='hidden'][name='f[field1][]'][value='a']")
19
- expect(generated).to have_selector("input[type='hidden'][name='f[field1][]'][value='b']")
13
+ expect(generated).to have_selector("input[type='hidden'][name='q'][value='query']", visible: false)
14
+ expect(generated).to have_selector("input[type='hidden'][name='per_page'][value='10']", visible: false)
15
+ expect(generated).to have_selector("input[type='hidden'][name='page'][value='5']", visible: false)
16
+ expect(generated).to have_selector("input[type='hidden'][name='extra_arbitrary_key'][value='arbitrary_value']", visible: false)
17
+ expect(generated).to have_selector("input[type='hidden'][name='f[field2][]'][value='z']", visible: false)
18
+ expect(generated).to have_selector("input[type='hidden'][name='f[field1][]'][value='a']", visible: false)
19
+ expect(generated).to have_selector("input[type='hidden'][name='f[field1][]'][value='b']", visible: false)
20
20
 
21
21
  end
22
22
 
@@ -139,6 +139,13 @@ describe Blacklight::Solr::Response do
139
139
  expect(r.spelling.words).to include("dell")
140
140
  expect(r.spelling.words).to include("ultrasharp")
141
141
  end
142
+
143
+ it 'provides spelling suggestions for solr 5 spellcheck results' do
144
+ raw_response = eval(mock_response_with_solr5_spellcheck)
145
+ r = Blacklight::Solr::Response.new(raw_response, {})
146
+ expect(r.spelling.words).to include("political", "politics", "policy")
147
+ end
148
+
142
149
 
143
150
  it 'should provide spelling suggestions for extended spellcheck results' do
144
151
  raw_response = eval(mock_response_with_spellcheck_extended)
@@ -232,4 +239,8 @@ describe Blacklight::Solr::Response do
232
239
  def mock_response_with_more_like_this
233
240
  %({'responseHeader'=>{'status'=>0,'QTime'=>8,'params'=>{'facet'=>'false','mlt.mindf'=>'1','mlt.fl'=>'subject_t','fl'=>'id','mlt.count'=>'3','mlt.mintf'=>'0','mlt'=>'true','q.alt'=>'*:*','qt'=>'search','wt'=>'ruby'}},'response'=>{'numFound'=>30,'start'=>0,'docs'=>[{'id'=>'00282214'},{'id'=>'00282371'},{'id'=>'00313831'},{'id'=>'00314247'},{'id'=>'43037890'},{'id'=>'53029833'},{'id'=>'77826928'},{'id'=>'78908283'},{'id'=>'79930185'},{'id'=>'85910001'}]},'moreLikeThis'=>{'00282214'=>{'numFound'=>0,'start'=>0,'docs'=>[]},'00282371'=>{'numFound'=>0,'start'=>0,'docs'=>[]},'00313831'=>{'numFound'=>1,'start'=>0,'docs'=>[{'id'=>'96933325'}]},'00314247'=>{'numFound'=>3,'start'=>0,'docs'=>[{'id'=>'2008543486'},{'id'=>'96933325'},{'id'=>'2009373513'}]},'43037890'=>{'numFound'=>0,'start'=>0,'docs'=>[]},'53029833'=>{'numFound'=>0,'start'=>0,'docs'=>[]},'77826928'=>{'numFound'=>1,'start'=>0,'docs'=>[{'id'=>'94120425'}]},'78908283'=>{'numFound'=>0,'start'=>0,'docs'=>[]},'79930185'=>{'numFound'=>2,'start'=>0,'docs'=>[{'id'=>'94120425'},{'id'=>'2007020969'}]},'85910001'=>{'numFound'=>0,'start'=>0,'docs'=>[]}}})
234
241
  end
242
+
243
+ def mock_response_with_solr5_spellcheck
244
+ %|{'responseHeader'=>{'status'=>0,'QTime'=>1,'params'=>{'q'=>'politica','wt'=>'ruby'}},'response'=>{'numFound'=>0,'start'=>0,'maxScore'=>0.0,'docs'=>[]},'facet_counts'=>{'facet_queries'=>{},'facet_fields'=>{'format'=>[],'lc_1letter_facet'=>[],'lc_alpha_facet'=>[],'lc_b4cutter_facet'=>[],'language_facet'=>[],'pub_date'=>[],'subject_era_facet'=>[],'subject_geo_facet'=>[],'subject_topic_facet'=>[]},'facet_ranges'=>{},'facet_intervals'=>{},'facet_heatmaps'=>{}},'spellcheck'=>{'suggestions'=>['politica',{'numFound'=>3,'startOffset'=>0,'endOffset'=>8,'origFreq'=>0,'suggestion'=>[{'word'=>'political','freq'=>3},{'word'=>'politics','freq'=>3},{'word'=>'policy','freq'=>2}]}],'correctlySpelled'=>false}}|
245
+ end
235
246
  end
@@ -56,4 +56,47 @@ RSpec.configure do |config|
56
56
 
57
57
  config.include Devise::TestHelpers, type: :controller
58
58
  config.infer_spec_type_from_file_location!
59
+
60
+ config.expect_with :rspec do |expectations|
61
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
62
+ end
63
+
64
+ config.default_formatter = 'doc' if config.files_to_run.one?
65
+
66
+ config.shared_context_metadata_behavior = :apply_to_host_groups
67
+
68
+ # This allows you to limit a spec run to individual examples or groups
69
+ # you care about by tagging them with `:focus` metadata. When nothing
70
+ # is tagged with `:focus`, all examples get run. RSpec also provides
71
+ # aliases for `it`, `describe`, and `context` that include `:focus`
72
+ # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
73
+ config.filter_run_when_matching :focus
74
+
75
+ config.example_status_persistence_file_path = 'spec/examples.txt'
76
+ # Many RSpec users commonly either run the entire suite or an individual
77
+ # file, and it's useful to allow more verbose output when running an
78
+ # individual spec file.
79
+ if config.files_to_run.one?
80
+ # Use the documentation formatter for detailed output,
81
+ # unless a formatter has already been configured
82
+ # (e.g. via a command-line flag).
83
+ config.default_formatter = 'doc'
84
+ end
85
+
86
+ # Print the 10 slowest examples and example groups at the
87
+ # end of the spec run, to help surface which specs are running
88
+ # particularly slow.
89
+ config.profile_examples = 10
90
+
91
+ # Run specs in random order to surface order dependencies. If you find an
92
+ # order dependency and want to debug it, you can fix the order by providing
93
+ # the seed, which is printed after each run.
94
+ # --seed 1234
95
+ config.order = :random
96
+
97
+ # Seed global randomization in this process using the `--seed` CLI option.
98
+ # Setting this allows you to use `--seed` to deterministically reproduce
99
+ # test failures related to randomization by passing the same `--seed` value
100
+ # as the one that triggered the failure.
101
+ Kernel.srand config.seed
59
102
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blacklight
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.18.0
4
+ version: 5.19.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Rochkind
@@ -17,7 +17,7 @@ authors:
17
17
  autorequire:
18
18
  bindir: bin
19
19
  cert_chain: []
20
- date: 2016-01-21 00:00:00.000000000 Z
20
+ date: 2016-08-30 00:00:00.000000000 Z
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
23
  name: rails
@@ -609,7 +609,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
609
609
  version: '0'
610
610
  requirements: []
611
611
  rubyforge_project:
612
- rubygems_version: 2.4.5.1
612
+ rubygems_version: 2.5.1
613
613
  signing_key:
614
614
  specification_version: 4
615
615
  summary: Blacklight provides a discovery interface for any Solr (http://lucene.apache.org/solr)