Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add test for label_text method

  • Loading branch information...
commit 716b998008103ac3e85623cc0a2c0e939f6a8ce2 1 parent a8df7c3
@NOX73 authored
Showing with 16 additions and 0 deletions.
  1. +10 −0 test/form_builder/label_test.rb
  2. +6 −0 test/support/misc_helpers.rb
View
10 test/form_builder/label_test.rb
@@ -68,4 +68,14 @@ def with_label_for(object, *args, &block)
assert_select 'label.integer[for=user_age]', "Age:"
end
end
+
+ test 'configuration allow set label text for wrappers' do
+ swap_wrapper :default, self.custom_wrapper_with_label_text do
+ with_concat_form_for(@user) do |f|
+ concat f.input :age
+ end
+ assert_select "label.integer[for=user_age]", "**Age**"
+ end
+ end
+
end
View
6 test/support/misc_helpers.rb
@@ -84,6 +84,12 @@ def custom_wrapper_with_label_html_option
end
end
+ def custom_wrapper_with_label_text
+ SimpleForm.build :label_text => lambda { |label, required| "**#{label}**" } do |b|
+ b.use :label_input
+ end
+ end
+
def custom_form_for(object, *args, &block)
simple_form_for(object, *(args << { :builder => CustomFormBuilder }), &block)
end
Please sign in to comment.
Something went wrong with that request. Please try again.