From c4db622757905b750f9b55038b8704e0dbf9caaf Mon Sep 17 00:00:00 2001 From: Balazs Nagy Date: Thu, 1 Mar 2012 00:08:24 +0100 Subject: [PATCH] Don't leak out minimum or maximum values when MinMax component is in use. It used to emit the last calculated value in bare string just before label. --- lib/simple_form/components/min_max.rb | 1 + test/inputs/numeric_input_test.rb | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/lib/simple_form/components/min_max.rb b/lib/simple_form/components/min_max.rb index bd8a9070f..51ae4a1f9 100644 --- a/lib/simple_form/components/min_max.rb +++ b/lib/simple_form/components/min_max.rb @@ -7,6 +7,7 @@ def min_max input_html_options[:min] ||= minimum_value(validator_options) input_html_options[:max] ||= maximum_value(validator_options) end + nil end private diff --git a/test/inputs/numeric_input_test.rb b/test/inputs/numeric_input_test.rb index 50193ce9f..e21ca1d69 100644 --- a/test/inputs/numeric_input_test.rb +++ b/test/inputs/numeric_input_test.rb @@ -164,4 +164,10 @@ class NumericInputTest < ActionView::TestCase assert_select 'input[max=99]' end end + + test 'min_max should not emit max value as bare string' do + with_input_for @other_validating_user, :age, :integer + assert_select 'div', {:count => 0, :text => %r{^99}} + end + end