blacklight_range_limit 9.0.0.beta2 → 9.0.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4e201cd7f8b701d21bf9e6b97410f4559b10a727ac170941acbafbf30ca42d2b
|
4
|
+
data.tar.gz: eacc2e3ec1f19a84436f36b0ae5379ad8af4a1c0895c7f4bf0aabe743301407c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ebe7cd1f8b4aff796900985f5f5b2ef1d38191ef2682d331963a18f715191d266ca41de8f3b6882ebd0de5556ed6a4bf0c0486bd1229eb80890b06cf50898b2a
|
7
|
+
data.tar.gz: e678a32a7854cb0310e834ece0f4d82577829288a03eb7944665f1f799dfb4178bae51ddb36c90a8550064d0162edc19b25d9465641b6004d3ce1eb63853210a
|
data/Rakefile
CHANGED
@@ -32,10 +32,11 @@ task :guard_version_match do
|
|
32
32
|
|
33
33
|
# 9.0.0.beta1 in gem becomes 9.0.0-beta1 in npm
|
34
34
|
gem_version_parts = gem_version.split(".")
|
35
|
+
|
35
36
|
npm_version_required = [
|
36
37
|
gem_version_parts.slice(0, 3).join("."),
|
37
38
|
gem_version_parts.slice(3, gem_version_parts.length).join(".")
|
38
|
-
].join("-")
|
39
|
+
].collect {|s| s if s && !s.empty? }.compact.join("-")
|
39
40
|
|
40
41
|
if npm_version != npm_version_required
|
41
42
|
raise <<~EOS
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
9.0.0
|
1
|
+
9.0.0
|
@@ -48,6 +48,12 @@ module BlacklightRangeLimit
|
|
48
48
|
# range_field, range_start, range_end
|
49
49
|
def fetch_specific_range_limit(solr_params)
|
50
50
|
field_key = blacklight_params[:range_field] # what field to fetch for
|
51
|
+
|
52
|
+
unless blacklight_params[:range_start].present? && blacklight_params[:range_start].kind_of?(String) &&
|
53
|
+
blacklight_params[:range_end].present? && blacklight_params[:range_end].kind_of?(String)
|
54
|
+
raise BlacklightRangeLimit::InvalidRange
|
55
|
+
end
|
56
|
+
|
51
57
|
start = blacklight_params[:range_start].to_i
|
52
58
|
finish = blacklight_params[:range_end].to_i
|
53
59
|
|
@@ -61,6 +67,9 @@ module BlacklightRangeLimit
|
|
61
67
|
solr_params[:rows] = 0
|
62
68
|
|
63
69
|
return solr_params
|
70
|
+
rescue BlacklightRangeLimit::InvalidRange
|
71
|
+
# This will make Rails return a 400
|
72
|
+
raise ActionController::BadRequest, "invalid range_start (#{blacklight_params[:range_start]}) or range_end (#{blacklight_params[:range_end]})"
|
64
73
|
end
|
65
74
|
|
66
75
|
# hacky polyfill for new Blacklight behavior we need, if we don't have it yet
|
data/package.json
CHANGED
@@ -0,0 +1,61 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe CatalogController, type: :controller do
|
4
|
+
# Note that ActionController::BadRequest is caught by rails and turned into a 400
|
5
|
+
# response, and ActionController::RoutingError is caught by raisl and turned into 404
|
6
|
+
describe "bad params" do
|
7
|
+
let (:facet_field) { "pub_date_si" }
|
8
|
+
|
9
|
+
it "without start param present raise BadRequest " do
|
10
|
+
expect {
|
11
|
+
get :range_limit, params: {
|
12
|
+
"range_field"=> facet_field,
|
13
|
+
"range_start"=>"1931"
|
14
|
+
}
|
15
|
+
}.to raise_error(ActionController::BadRequest)
|
16
|
+
end
|
17
|
+
|
18
|
+
it "without end param raise BadRequest " do
|
19
|
+
expect {
|
20
|
+
get :range_limit, params: {
|
21
|
+
"range_field"=> facet_field,
|
22
|
+
"range_start"=>"1931"
|
23
|
+
}
|
24
|
+
}.to raise_error(ActionController::BadRequest)
|
25
|
+
end
|
26
|
+
|
27
|
+
it "without either boundary raise BadRequest" do
|
28
|
+
expect {
|
29
|
+
get :range_limit, params: {
|
30
|
+
"range_field"=> facet_field,
|
31
|
+
}
|
32
|
+
}.to raise_error(ActionController::BadRequest)
|
33
|
+
end
|
34
|
+
|
35
|
+
it "without a range_field raise RoutingError" do
|
36
|
+
expect {
|
37
|
+
get :range_limit, params: {}
|
38
|
+
}.to raise_error(ActionController::RoutingError)
|
39
|
+
end
|
40
|
+
|
41
|
+
it "with params out of order raise BadRequest" do
|
42
|
+
expect {
|
43
|
+
get :range_limit, params: {
|
44
|
+
"range_field"=> facet_field,
|
45
|
+
"range_start"=>"1940",
|
46
|
+
"range_end"=>"1930"
|
47
|
+
}
|
48
|
+
}.to raise_error(ActionController::BadRequest)
|
49
|
+
end
|
50
|
+
|
51
|
+
it "with one of the params is an array raise BadRequest" do
|
52
|
+
expect {
|
53
|
+
get :range_limit, params: {
|
54
|
+
"range_field"=> facet_field,
|
55
|
+
"range_start"=>"1931",
|
56
|
+
"range_end"=>["1940"]
|
57
|
+
}
|
58
|
+
}.to raise_error(ActionController::BadRequest)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -13,9 +13,13 @@ class TestAppGenerator < Rails::Generators::Base
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def run_bl8_jsbundling_fixup
|
16
|
-
#
|
17
|
-
#
|
18
|
-
|
16
|
+
# BL 8.7.0 doesn't seem to need anything, but BL8 before that the automatic BL
|
17
|
+
# install process doesn't do everything we need.
|
18
|
+
#
|
19
|
+
# By manually triggering the BL8 assets:propshaft generator, we can get what we need
|
20
|
+
# for jsbundling, even though it's named confusingly for that, it works in these
|
21
|
+
# versions.
|
22
|
+
if File.exist?("package.json") && Gem::Requirement.create("~> 8.0", "< 8.7.0").satisfied_by?(Gem::Version.new(Blacklight::VERSION))
|
19
23
|
generate "blacklight:assets:propshaft"
|
20
24
|
end
|
21
25
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blacklight_range_limit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 9.0.0
|
4
|
+
version: 9.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan Rochkind
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2025-01-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: blacklight
|
@@ -250,6 +250,7 @@ files:
|
|
250
250
|
- spec/components/range_facet_component_spec.rb
|
251
251
|
- spec/components/range_form_component_spec.rb
|
252
252
|
- spec/components/range_segments_component_spec.rb
|
253
|
+
- spec/controllers/range_limit_action_method_spec.rb
|
253
254
|
- spec/features/blacklight_range_limit_spec.rb
|
254
255
|
- spec/features/run_through_spec.rb
|
255
256
|
- spec/fixtures/solr_documents/unknown_year.yml
|
@@ -290,6 +291,7 @@ test_files:
|
|
290
291
|
- spec/components/range_facet_component_spec.rb
|
291
292
|
- spec/components/range_form_component_spec.rb
|
292
293
|
- spec/components/range_segments_component_spec.rb
|
294
|
+
- spec/controllers/range_limit_action_method_spec.rb
|
293
295
|
- spec/features/blacklight_range_limit_spec.rb
|
294
296
|
- spec/features/run_through_spec.rb
|
295
297
|
- spec/fixtures/solr_documents/unknown_year.yml
|