Remove extra self

This commit is contained in:
Carlos Antonio da Silva 2015-03-25 08:17:42 -03:00
parent 33ee5da122
commit 96cf04fb21
6 changed files with 28 additions and 28 deletions

View File

@ -146,14 +146,14 @@ class ErrorTest < ActionView::TestCase
# FULL_ERROR_WRAPPER
test 'full error finds errors on association' do
swap_wrapper :default, self.custom_wrapper_with_full_error do
swap_wrapper :default, custom_wrapper_with_full_error do
with_form_for @user, :company_id, as: :select
assert_select 'span.error', 'Company must be valid'
end
end
test 'full error finds errors on association with reflection' do
swap_wrapper :default, self.custom_wrapper_with_full_error do
swap_wrapper :default, custom_wrapper_with_full_error do
with_form_for @user, :company_id, as: :select,
reflection: Association.new(Company, :company, {})
assert_select 'span.error', 'Company must be valid'
@ -161,14 +161,14 @@ class ErrorTest < ActionView::TestCase
end
test 'full error can be disabled' do
swap_wrapper :default, self.custom_wrapper_with_full_error do
swap_wrapper :default, custom_wrapper_with_full_error do
with_form_for @user, :company_id, as: :select, full_error: false
assert_no_select 'span.error'
end
end
test 'full error can be disabled setting error to false' do
swap_wrapper :default, self.custom_wrapper_with_full_error do
swap_wrapper :default, custom_wrapper_with_full_error do
with_form_for @user, :company_id, as: :select, error: false
assert_no_select 'span.error'
end
@ -196,7 +196,7 @@ class ErrorTest < ActionView::TestCase
end
test 'input with custom error works when using full_error component' do
swap_wrapper :default, self.custom_wrapper_with_full_error do
swap_wrapper :default, custom_wrapper_with_full_error do
error_text = "Super User Name! cannot be blank"
with_form_for @user, :name, error: error_text
@ -219,7 +219,7 @@ class ErrorTest < ActionView::TestCase
end
test 'input with custom error escapes the error text using full_error component' do
swap_wrapper :default, self.custom_wrapper_with_full_error do
swap_wrapper :default, custom_wrapper_with_full_error do
with_form_for @user, :name, error: 'error must not contain <b>markup</b>'
assert_select 'span.error'
@ -228,7 +228,7 @@ class ErrorTest < ActionView::TestCase
end
test 'input with custom error does not escape the error text if it is safe using full_error component' do
swap_wrapper :default, self.custom_wrapper_with_full_error do
swap_wrapper :default, custom_wrapper_with_full_error do
with_form_for @user, :name, error: 'error must contain <b>markup</b>'.html_safe
assert_select 'span.error'
@ -237,7 +237,7 @@ class ErrorTest < ActionView::TestCase
end
test 'input with custom error when using full_error component does not generate the error if there is no error on the attribute' do
swap_wrapper :default, self.custom_wrapper_with_full_error do
swap_wrapper :default, custom_wrapper_with_full_error do
with_form_for @user, :active, error: "Super User Active! can't be blank"
assert_no_select 'span.error'

View File

@ -256,7 +256,7 @@ class FormBuilderTest < ActionView::TestCase
end
test 'builder does not propagate input options to wrapper with custom wrapper' do
swap_wrapper :default, self.custom_wrapper_with_wrapped_input do
swap_wrapper :default, custom_wrapper_with_wrapped_input do
with_form_for @user, :name, input_html: { class: 'my_input' }
assert_no_select 'form div.input.my_input'
assert_select 'form input.my_input.string'
@ -264,7 +264,7 @@ class FormBuilderTest < ActionView::TestCase
end
test 'builder does not propagate label options to wrapper with custom wrapper' do
swap_wrapper :default, self.custom_wrapper_with_wrapped_label do
swap_wrapper :default, custom_wrapper_with_wrapped_label do
with_form_for @user, :name, label_html: { class: 'my_label' }
assert_no_select 'form div.label.my_label'
assert_select 'form label.my_label.string'

View File

@ -148,7 +148,7 @@ class InputFieldTest < ActionView::TestCase
end
test 'build input_field without pattern component use the pattern string' do
swap_wrapper :default, self.custom_wrapper_with_html5_components do
swap_wrapper :default, custom_wrapper_with_html5_components do
with_concat_form_for(@user) do |f|
f.input_field :name, pattern: '\w+'
end
@ -158,7 +158,7 @@ class InputFieldTest < ActionView::TestCase
end
test 'build input_field without placeholder component use the placeholder string' do
swap_wrapper :default, self.custom_wrapper_with_html5_components do
swap_wrapper :default, custom_wrapper_with_html5_components do
with_concat_form_for(@user) do |f|
f.input_field :name, placeholder: 'Placeholder'
end
@ -168,7 +168,7 @@ class InputFieldTest < ActionView::TestCase
end
test 'build input_field without maxlength component use the maxlength string' do
swap_wrapper :default, self.custom_wrapper_with_html5_components do
swap_wrapper :default, custom_wrapper_with_html5_components do
with_concat_form_for(@user) do |f|
f.input_field :name, maxlength: 5
end
@ -178,7 +178,7 @@ class InputFieldTest < ActionView::TestCase
end
test 'build input_field without readonly component use the readonly string' do
swap_wrapper :default, self.custom_wrapper_with_html5_components do
swap_wrapper :default, custom_wrapper_with_html5_components do
with_concat_form_for(@user) do |f|
f.input_field :name, readonly: true
end

View File

@ -90,7 +90,7 @@ class LabelTest < ActionView::TestCase
end
test 'configuration allow set label text for wrappers' do
swap_wrapper :default, self.custom_wrapper_with_label_text do
swap_wrapper :default, custom_wrapper_with_label_text do
with_concat_form_for(@user) do |f|
concat f.input :age
end
@ -99,7 +99,7 @@ class LabelTest < ActionView::TestCase
end
test 'configuration allow set rewrited label tag for wrappers' do
swap_wrapper :default, self.custom_wrapper_with_custom_label_component do
swap_wrapper :default, custom_wrapper_with_custom_label_component do
with_concat_form_for(@user) do |f|
concat f.input :age
end

View File

@ -129,7 +129,7 @@ class WrapperTest < ActionView::TestCase
end
test 'custom wrappers can have additional attributes' do
swap_wrapper :default, self.custom_wrapper_with_additional_attributes do
swap_wrapper :default, custom_wrapper_with_additional_attributes do
with_form_for @user, :name
assert_select "div.custom_wrapper[title='some title'][data-wrapper='test']"
@ -137,7 +137,7 @@ class WrapperTest < ActionView::TestCase
end
test 'custom wrappers can have full error message on attributes' do
swap_wrapper :default, self.custom_wrapper_with_full_error do
swap_wrapper :default, custom_wrapper_with_full_error do
with_form_for @user, :name
assert_select 'span.error', "Name cannot be blank"
end
@ -188,7 +188,7 @@ class WrapperTest < ActionView::TestCase
end
test 'does not duplicate label classes for different inputs' do
swap_wrapper :default, self.custom_wrapper_with_label_html_option do
swap_wrapper :default, custom_wrapper_with_label_html_option do
with_concat_form_for(@user) do |f|
concat f.input :name, required: false
concat f.input :email, as: :email, required: true
@ -243,7 +243,7 @@ class WrapperTest < ActionView::TestCase
end
test 'input accepts attributes in the DSL' do
swap_wrapper :default, self.custom_wrapper_with_input_class do
swap_wrapper :default, custom_wrapper_with_input_class do
with_concat_form_for @user do |f|
concat f.input :name
end
@ -253,7 +253,7 @@ class WrapperTest < ActionView::TestCase
end
test 'label accepts attributes in the DSL' do
swap_wrapper :default, self.custom_wrapper_with_label_class do
swap_wrapper :default, custom_wrapper_with_label_class do
with_concat_form_for @user do |f|
concat f.input :name
end
@ -263,7 +263,7 @@ class WrapperTest < ActionView::TestCase
end
test 'label_input accepts attributes in the DSL' do
swap_wrapper :default, self.custom_wrapper_with_label_input_class do
swap_wrapper :default, custom_wrapper_with_label_input_class do
with_concat_form_for @user do |f|
concat f.input :name
end
@ -274,7 +274,7 @@ class WrapperTest < ActionView::TestCase
end
test 'input accepts data attributes in the DSL' do
swap_wrapper :default, self.custom_wrapper_with_input_attributes do
swap_wrapper :default, custom_wrapper_with_input_attributes do
with_concat_form_for @user do |f|
concat f.input :name
end
@ -284,7 +284,7 @@ class WrapperTest < ActionView::TestCase
end
test 'inline wrapper displays when there is content' do
swap_wrapper :default, self.custom_wrapper_with_wrapped_optional_component do
swap_wrapper :default, custom_wrapper_with_wrapped_optional_component do
with_form_for @user, :name, hint: "cannot be blank"
assert_select 'section.custom_wrapper div.no_output_wrapper p.omg_hint', "cannot be blank"
assert_select 'p.omg_hint'
@ -292,7 +292,7 @@ class WrapperTest < ActionView::TestCase
end
test 'inline wrapper does not display when there is no content' do
swap_wrapper :default, self.custom_wrapper_with_wrapped_optional_component do
swap_wrapper :default, custom_wrapper_with_wrapped_optional_component do
with_form_for @user, :name
assert_select 'section.custom_wrapper div.no_output_wrapper'
assert_no_select 'p.omg_hint'
@ -300,7 +300,7 @@ class WrapperTest < ActionView::TestCase
end
test 'optional wrapper does not display when there is content' do
swap_wrapper :default, self.custom_wrapper_with_unless_blank do
swap_wrapper :default, custom_wrapper_with_unless_blank do
with_form_for @user, :name, hint: "can't be blank"
assert_select 'section.custom_wrapper div.no_output_wrapper'
assert_select 'div.no_output_wrapper'
@ -309,7 +309,7 @@ class WrapperTest < ActionView::TestCase
end
test 'optional wrapper does not display when there is no content' do
swap_wrapper :default, self.custom_wrapper_with_unless_blank do
swap_wrapper :default, custom_wrapper_with_unless_blank do
with_form_for @user, :name
assert_no_select 'section.custom_wrapper div.no_output_wrapper'
assert_no_select 'div.no_output_wrapper'

View File

@ -46,7 +46,7 @@ module MiscHelpers
end
end
def swap_wrapper(name = :default, wrapper = self.custom_wrapper)
def swap_wrapper(name = :default, wrapper = custom_wrapper)
old = SimpleForm.wrappers[name.to_s]
SimpleForm.wrappers[name.to_s] = wrapper
yield