summaryrefslogtreecommitdiffstats
path: root/test/unit
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2016-11-18 16:00:27 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2016-11-18 16:00:27 +0000
commitcbe5e02203aa2f96824fb726a2c28506f65d4ced (patch)
tree6337bc6007b83e60705320b5cf44773c2e988be0 /test/unit
parent06b97bd91d2b916a3f21ea4bd626e941d235cb44 (diff)
downloadredmine-cbe5e02203aa2f96824fb726a2c28506f65d4ced.tar.gz
redmine-cbe5e02203aa2f96824fb726a2c28506f65d4ced.zip
Adds tests for #hours_field (#23996).
git-svn-id: http://svn.redmine.org/redmine/trunk@15974 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/lib/redmine/views/labelled_form_builder_test.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/unit/lib/redmine/views/labelled_form_builder_test.rb b/test/unit/lib/redmine/views/labelled_form_builder_test.rb
index 2680c83c6..25834915a 100644
--- a/test/unit/lib/redmine/views/labelled_form_builder_test.rb
+++ b/test/unit/lib/redmine/views/labelled_form_builder_test.rb
@@ -27,4 +27,22 @@ class Redmine::Views::LabelledFormBuilderTest < Redmine::HelperTest
assert_equal output, '<label for="issue_subject">Subject</label>'
end
end
+
+ def test_hours_field_should_display_formatted_value_if_valid
+ entry = TimeEntry.new(:hours => '2.5')
+ entry.validate
+
+ labelled_form_for(entry) do |f|
+ assert_include 'value="2.50"', f.hours_field(:hours)
+ end
+ end
+
+ def test_hours_field_should_display_entered_value_if_invalid
+ entry = TimeEntry.new(:hours => '2.z')
+ entry.validate
+
+ labelled_form_for(entry) do |f|
+ assert_include 'value="2.z"', f.hours_field(:hours)
+ end
+ end
end