Skip to content

Commit 35646d7

Browse files
committed
Test that out of bounds ranges do not result in error
One test applying to formerly without tests #294. In process, I realize that the values displayed in the "constraint" aren't clamped, so that'd be an area of improvement -- but I'm not too worried about it, I don't personally have a use case for it. The main thing is ensuring this bad data doesn't result in an uncaught exception, which this regression test now does.
1 parent dac0a60 commit 35646d7

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

spec/requests/bad_param_requests_spec.rb

+15
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,20 @@
4242
expect(response.code).to eq("200")
4343
expect(parsed_body.css("span.applied-filter")).not_to be_present
4444
end
45+
46+
describe "out of bounds range config" do
47+
let(:max) { BlacklightRangeLimit.default_range_config[:range_config][:max_value] }
48+
let(:min) { BlacklightRangeLimit.default_range_config[:range_config][:min_value] }
49+
50+
let(:too_high) { max.abs * 2 }
51+
let(:too_low) { min.abs * -2 }
52+
53+
it "does not error" do
54+
get "/catalog?#{ {"range"=>{ range_facet_field => {"begin"=> too_low, "end"=> too_high }}}.to_param }"
55+
56+
expect(response.code).to eq("200")
57+
expect(parsed_body.css("span.applied-filter")).to be_present
58+
end
59+
end
4560
end
4661
end

0 commit comments

Comments
 (0)