From bb1ecdcc677bf6e68e0252505509c089619b5b90 Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Thu, 1 Sep 2016 23:41:49 +0200 Subject: fixes remaining RuboCop issues [Vipul A M, Xavier Noria] --- actionview/Rakefile | 2 +- actionview/lib/action_view/helpers/capture_helper.rb | 2 +- actionview/lib/action_view/helpers/form_helper.rb | 2 +- actionview/test/template/tag_helper_test.rb | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) (limited to 'actionview') diff --git a/actionview/Rakefile b/actionview/Rakefile index f9a7112ade..6c3fc59b0a 100644 --- a/actionview/Rakefile +++ b/actionview/Rakefile @@ -14,7 +14,7 @@ namespace :test do task :isolated do Dir.glob("test/{actionpack,activerecord,template}/**/*_test.rb").all? do |file| sh(Gem.ruby, "-w", "-Ilib:test", file) - end or raise "Failures" + end || raise("Failures") end Rake::TestTask.new(:template) do |t| diff --git a/actionview/lib/action_view/helpers/capture_helper.rb b/actionview/lib/action_view/helpers/capture_helper.rb index 5b569b5923..719592b5c5 100644 --- a/actionview/lib/action_view/helpers/capture_helper.rb +++ b/actionview/lib/action_view/helpers/capture_helper.rb @@ -37,7 +37,7 @@ module ActionView def capture(*args) value = nil buffer = with_output_buffer { value = yield(*args) } - if string = buffer.presence || value and string.is_a?(String) + if (string = buffer.presence || value) && string.is_a?(String) ERB::Util.html_escape string end end diff --git a/actionview/lib/action_view/helpers/form_helper.rb b/actionview/lib/action_view/helpers/form_helper.rb index b82dff1c17..124a14f1d9 100644 --- a/actionview/lib/action_view/helpers/form_helper.rb +++ b/actionview/lib/action_view/helpers/form_helper.rb @@ -1287,7 +1287,7 @@ module ActionView @object_name, @object, @template, @options = object_name, object, template, options @default_options = @options ? @options.slice(:index, :namespace) : {} if @object_name.to_s.match(/\[\]$/) - if object ||= @template.instance_variable_get("@#{Regexp.last_match.pre_match}") and object.respond_to?(:to_param) + if (object ||= @template.instance_variable_get("@#{Regexp.last_match.pre_match}")) && object.respond_to?(:to_param) @auto_index = object.to_param else raise ArgumentError, "object[] naming but object param and @object var don't exist or don't respond to to_param: #{object.inspect}" diff --git a/actionview/test/template/tag_helper_test.rb b/actionview/test/template/tag_helper_test.rb index 278c3e855f..f1e5946e14 100644 --- a/actionview/test/template/tag_helper_test.rb +++ b/actionview/test/template/tag_helper_test.rb @@ -284,12 +284,12 @@ class TagHelperTest < ActionView::TestCase def test_tag_does_not_honor_html_safe_double_quotes_as_attributes assert_dom_equal '

content

', - content_tag('p', "content", title: '"'.html_safe) + content_tag("p", "content", title: '"'.html_safe) end def test_data_tag_does_not_honor_html_safe_double_quotes_as_attributes assert_dom_equal '

content

', - content_tag('p', "content", data: { title: '"'.html_safe }) + content_tag("p", "content", data: { title: '"'.html_safe }) end def test_skip_invalid_escaped_attributes -- cgit v1.2.3