From fe1f4b2ad56f010a4e9b93d547d63a15953d9dc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Sat, 29 Oct 2016 01:05:58 -0200 Subject: Add more rubocop rules about whitespaces --- .../test/actionpack/controller/render_test.rb | 4 +- .../test/activerecord/relation_cache_test.rb | 2 +- actionview/test/lib/controller/fake_models.rb | 4 +- actionview/test/template/date_helper_test.rb | 92 +++++++++++----------- actionview/test/template/digestor_test.rb | 6 +- actionview/test/template/form_helper_test.rb | 42 +++++----- .../test/template/form_options_helper_test.rb | 70 ++++++++-------- actionview/test/template/form_tag_helper_test.rb | 4 +- actionview/test/template/javascript_helper_test.rb | 8 +- .../test/template/output_safety_helper_test.rb | 4 +- actionview/test/template/text_helper_test.rb | 18 ++--- 11 files changed, 127 insertions(+), 127 deletions(-) (limited to 'actionview/test') diff --git a/actionview/test/actionpack/controller/render_test.rb b/actionview/test/actionpack/controller/render_test.rb index cd89dceb45..b4a757d6b8 100644 --- a/actionview/test/actionpack/controller/render_test.rb +++ b/actionview/test/actionpack/controller/render_test.rb @@ -11,7 +11,7 @@ class Customer < Struct.new(:name, :id) undef_method :to_json - def to_xml(options={}) + def to_xml(options = {}) if options[:builder] options[:builder].name name else @@ -19,7 +19,7 @@ class Customer < Struct.new(:name, :id) end end - def to_js(options={}) + def to_js(options = {}) "name: #{name.inspect}" end alias :to_text :to_js diff --git a/actionview/test/activerecord/relation_cache_test.rb b/actionview/test/activerecord/relation_cache_test.rb index 880e80a8dc..43f7242ee9 100644 --- a/actionview/test/activerecord/relation_cache_test.rb +++ b/actionview/test/activerecord/relation_cache_test.rb @@ -1,6 +1,6 @@ require "active_record_unit" -class RelationCacheTest < ActionView::TestCase +class RelationCacheTest < ActionView::TestCase tests ActionView::Helpers::CacheHelper def setup diff --git a/actionview/test/lib/controller/fake_models.rb b/actionview/test/lib/controller/fake_models.rb index cc5f5c1d59..80649db88b 100644 --- a/actionview/test/lib/controller/fake_models.rb +++ b/actionview/test/lib/controller/fake_models.rb @@ -6,7 +6,7 @@ class Customer < Struct.new(:name, :id) undef_method :to_json - def to_xml(options={}) + def to_xml(options = {}) if options[:builder] options[:builder].name name else @@ -14,7 +14,7 @@ class Customer < Struct.new(:name, :id) end end - def to_js(options={}) + def to_js(options = {}) "name: #{name.inspect}" end alias :to_text :to_js diff --git a/actionview/test/template/date_helper_test.rb b/actionview/test/template/date_helper_test.rb index 44e5a8c346..a84ac18bee 100644 --- a/actionview/test/template/date_helper_test.rb +++ b/actionview/test/template/date_helper_test.rb @@ -18,7 +18,7 @@ class DateHelperTest < ActionView::TestCase end end - def assert_distance_of_time_in_words(from, to=nil) + def assert_distance_of_time_in_words(from, to = nil) to ||= from # 0..1 minute with :include_seconds => true @@ -167,9 +167,9 @@ class DateHelperTest < ActionView::TestCase def test_distance_in_words_with_integers assert_equal "1 minute", distance_of_time_in_words(59) - assert_equal "about 1 hour", distance_of_time_in_words(60*60) + assert_equal "about 1 hour", distance_of_time_in_words(60 * 60) assert_equal "1 minute", distance_of_time_in_words(0, 59) - assert_equal "about 1 hour", distance_of_time_in_words(60*60, 0) + assert_equal "about 1 hour", distance_of_time_in_words(60 * 60, 0) assert_equal "about 3 years", distance_of_time_in_words(10**8) assert_equal "about 3 years", distance_of_time_in_words(0, 10**8) end @@ -385,7 +385,7 @@ class DateHelperTest < ActionView::TestCase month_names = %w(Januar Februar Marts April Maj Juni Juli August September Oktober November December) expected = %(\n" assert_dom_equal expected, select_month(Time.mktime(2003, 8, 16), use_month_names: month_names) @@ -848,7 +848,7 @@ class DateHelperTest < ActionView::TestCase expected << %(\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n) expected << "\n" - expected << %(\n) expected << %(\n\n\n) expected << "\n" @@ -881,8 +881,8 @@ class DateHelperTest < ActionView::TestCase end def test_select_date_with_no_start_year - expected = %(\n) + (Date.today.year - 5).upto(Date.today.year + 1) do |y| if y == Date.today.year expected << %(\n) else @@ -900,12 +900,12 @@ class DateHelperTest < ActionView::TestCase expected << "\n" assert_dom_equal expected, select_date( - Time.mktime(Date.today.year, 8, 16), end_year: Date.today.year+1, prefix: "date[first]" + Time.mktime(Date.today.year, 8, 16), end_year: Date.today.year + 1, prefix: "date[first]" ) end def test_select_date_with_no_end_year - expected = %(\n) 2003.upto(2008) do |y| if y == 2003 expected << %(\n) @@ -929,8 +929,8 @@ class DateHelperTest < ActionView::TestCase end def test_select_date_with_no_start_or_end_year - expected = %(\n) + (Date.today.year - 5).upto(Date.today.year + 5) do |y| if y == Date.today.year expected << %(\n) else @@ -969,8 +969,8 @@ class DateHelperTest < ActionView::TestCase end def test_select_date_with_zero_value_and_no_start_year - expected = %(\n) + (Date.today.year - 5).upto(Date.today.year + 1) { |y| expected << %(\n) } expected << "\n" expected << %(\n" - assert_dom_equal expected, select_date(0, end_year: Date.today.year+1, prefix: "date[first]") + assert_dom_equal expected, select_date(0, end_year: Date.today.year + 1, prefix: "date[first]") end def test_select_date_with_zero_value_and_no_end_year @@ -1002,8 +1002,8 @@ class DateHelperTest < ActionView::TestCase end def test_select_date_with_zero_value_and_no_start_and_end_year - expected = %(\n) + (Date.today.year - 5).upto(Date.today.year + 5) { |y| expected << %(\n) } expected << "\n" expected << %(\n) - (Date.today.year-5).upto(Date.today.year+5) { |y| expected << %(\n) } + expected = %(\n" expected << %(\n) - (Date.today.year-5).upto(Date.today.year+5) { |y| expected << %(\n) } + expected = %(\n" expected << %(\n) + expected = %(\n) expected << %(\n) expected << %(\n) @@ -1733,7 +1733,7 @@ class DateHelperTest < ActionView::TestCase end def test_select_time_with_custom_with_css_classes - expected = %(\n) + expected = %(\n) expected << %(\n) expected << %(\n) @@ -1851,7 +1851,7 @@ class DateHelperTest < ActionView::TestCase expected = "\n" - expected << %{\n} expected << %{\n\n\n\n\n\n\n\n\n\n\n\n} expected << "\n" @@ -1882,7 +1882,7 @@ class DateHelperTest < ActionView::TestCase expected = "\n" - expected << %{\n} expected << %{\n\n\n\n\n\n\n\n\n\n\n\n} expected << "\n" @@ -1901,7 +1901,7 @@ class DateHelperTest < ActionView::TestCase expected = "\n" - expected << %{\n} expected << %{\n\n\n\n\n\n\n\n\n\n\n\n} expected << "\n" @@ -2003,7 +2003,7 @@ class DateHelperTest < ActionView::TestCase @post = Post.new @post.written_on = Date.new(2004, 6, 15) - expected = %{\n} 1.upto(31) { |i| expected << %(\n) } expected << "\n" @@ -2011,7 +2011,7 @@ class DateHelperTest < ActionView::TestCase 1.upto(12) { |i| expected << %(\n) } expected << "\n" - expected << %{\n} 1999.upto(2009) { |i| expected << %(\n) } expected << "\n" @@ -2021,8 +2021,8 @@ class DateHelperTest < ActionView::TestCase def test_date_select_with_nil @post = Post.new - start_year = Time.now.year-5 - end_year = Time.now.year+5 + start_year = Time.now.year - 5 + end_year = Time.now.year + 5 expected = %{\n" @@ -2041,8 +2041,8 @@ class DateHelperTest < ActionView::TestCase def test_date_select_with_nil_and_blank @post = Post.new - start_year = Time.now.year-5 - end_year = Time.now.year+5 + start_year = Time.now.year - 5 + end_year = Time.now.year + 5 expected = %{' + "\n" - expected << %{\n} expected << "\n" start_year.upto(end_year) { |i| expected << %(\n) } expected << "\n" @@ -2084,8 +2084,8 @@ class DateHelperTest < ActionView::TestCase def test_date_select_with_nil_and_blank_and_discard_month @post = Post.new - start_year = Time.now.year-5 - end_year = Time.now.year+5 + start_year = Time.now.year - 5 + end_year = Time.now.year + 5 expected = %{\n) - (Date.today.year-5).upto(Date.today.year+1) { |y| expected << %(\n) } + expected = %(\n" expected << %(\n" - assert_dom_equal expected, select_date(0, end_year: Date.today.year+1, prefix: "date[first]") + assert_dom_equal expected, select_date(0, end_year: Date.today.year + 1, prefix: "date[first]") end def test_date_select_with_zero_value_and_no_end_year @@ -2936,8 +2936,8 @@ class DateHelperTest < ActionView::TestCase end def test_date_select_with_zero_value_and_no_start_and_end_year - expected = %(\n) + (Date.today.year - 5).upto(Date.today.year + 5) { |y| expected << %(\n) } expected << "\n" expected << %(\n) - (Date.today.year-5).upto(Date.today.year+5) { |y| expected << %(\n) } + expected = %(\n" expected << %(\n) - (Date.today.year-5).upto(Date.today.year+5) { |y| expected << %(\n) } + expected = %(\n" expected << %(', - check_box("post", "secret", "checked"=>"checked") + check_box("post", "secret", "checked" => "checked") ) end @@ -746,7 +746,7 @@ class FormHelperTest < ActionView::TestCase end def test_check_box_with_multiple_behavior - @post.comment_ids = [2,3] + @post.comment_ids = [2, 3] assert_dom_equal( '', check_box("post", "comment_ids", { multiple: true }, 1) @@ -758,7 +758,7 @@ class FormHelperTest < ActionView::TestCase end def test_check_box_with_multiple_behavior_and_index - @post.comment_ids = [2,3] + @post.comment_ids = [2, 3] assert_dom_equal( '', check_box("post", "comment_ids", { multiple: true, index: "foo" }, 1) @@ -1033,7 +1033,7 @@ class FormHelperTest < ActionView::TestCase def test_date_field_with_value_attr expected = %{} - value = Date.new(2013,6,29) + value = Date.new(2013, 6, 29) assert_dom_equal(expected, date_field("post", "written_on", value: value)) end @@ -1141,7 +1141,7 @@ class FormHelperTest < ActionView::TestCase def test_datetime_field_with_value_attr expected = %{} - value = DateTime.new(2013,6,29,13,37) + value = DateTime.new(2013, 6, 29, 13, 37) assert_dom_equal(expected, datetime_field("post", "written_on", value: value)) end @@ -1436,7 +1436,7 @@ class FormHelperTest < ActionView::TestCase ) assert_dom_equal( %{}, - text_field("post[]","title") + text_field("post[]", "title") ) assert_dom_equal( %{}, @@ -1559,10 +1559,10 @@ class FormHelperTest < ActionView::TestCase expected = whole_form("/posts", "new_post", "new_post") do "" + - "