Mercurial > hg > soundsoftware-site
diff test/unit/helpers/custom_fields_helper_test.rb @ 1517:dffacf8a6908 redmine-2.5
Update to Redmine SVN revision 13367 on 2.5-stable branch
author | Chris Cannam |
---|---|
date | Tue, 09 Sep 2014 09:29:00 +0100 |
parents | e248c7af89ec |
children |
line wrap: on
line diff
--- a/test/unit/helpers/custom_fields_helper_test.rb Tue Sep 09 09:28:31 2014 +0100 +++ b/test/unit/helpers/custom_fields_helper_test.rb Tue Sep 09 09:29:00 2014 +0100 @@ -18,14 +18,27 @@ require File.expand_path('../../../test_helper', __FILE__) class CustomFieldsHelperTest < ActionView::TestCase + include ApplicationHelper include CustomFieldsHelper include Redmine::I18n include ERB::Util def test_format_boolean_value I18n.locale = 'en' - assert_equal 'Yes', format_value('1', 'bool') - assert_equal 'No', format_value('0', 'bool') + assert_equal 'Yes', format_value('1', CustomField.new(:field_format => 'bool')) + assert_equal 'No', format_value('0', CustomField.new(:field_format => 'bool')) + end + + def test_label_tag_should_include_description_as_span_title_if_present + field = CustomField.new(:field_format => 'string', :description => 'This is the description') + tag = custom_field_label_tag('foo', CustomValue.new(:custom_field => field)) + assert_select_in tag, 'label span[title=?]', 'This is the description' + end + + def test_label_tag_should_not_include_title_if_description_is_blank + field = CustomField.new(:field_format => 'string') + tag = custom_field_label_tag('foo', CustomValue.new(:custom_field => field)) + assert_select_in tag, 'label span[title]', 0 end def test_unknow_field_format_should_be_edited_as_string