diff options
Diffstat (limited to 'actionview/test/template')
18 files changed, 96 insertions, 96 deletions
diff --git a/actionview/test/template/asset_tag_helper_test.rb b/actionview/test/template/asset_tag_helper_test.rb index 135c3b5fab..3bdab42f7a 100644 --- a/actionview/test/template/asset_tag_helper_test.rb +++ b/actionview/test/template/asset_tag_helper_test.rb @@ -470,9 +470,9 @@ class AssetTagHelperTest < ActionView::TestCase end def test_image_tag_does_not_modify_options - options = {size: "16x10"} + options = { size: "16x10" } image_tag("icon", options) - assert_equal({size: "16x10"}, options) + assert_equal({ size: "16x10" }, options) end def test_image_tag_raises_an_error_for_competing_size_arguments @@ -532,11 +532,11 @@ class AssetTagHelperTest < ActionView::TestCase end def test_video_audio_tag_does_not_modify_options - options = {autoplay: true} + options = { autoplay: true } video_tag("video", options) - assert_equal({autoplay: true}, options) + assert_equal({ autoplay: true }, options) audio_tag("audio", options) - assert_equal({autoplay: true}, options) + assert_equal({ autoplay: true }, options) end def test_image_tag_interpreting_email_cid_correctly diff --git a/actionview/test/template/capture_helper_test.rb b/actionview/test/template/capture_helper_test.rb index 84f5b721b0..54bf9b4c33 100644 --- a/actionview/test/template/capture_helper_test.rb +++ b/actionview/test/template/capture_helper_test.rb @@ -42,7 +42,7 @@ class CaptureHelperTest < ActionView::TestCase content_for :foo, "foo" assert_equal "foo", content_for(:foo) - content_for(:bar){ "bar" } + content_for(:bar) { "bar" } assert_equal "bar", content_for(:bar) end diff --git a/actionview/test/template/date_helper_i18n_test.rb b/actionview/test/template/date_helper_i18n_test.rb index a6559bd54f..207c8a683e 100644 --- a/actionview/test/template/date_helper_i18n_test.rb +++ b/actionview/test/template/date_helper_i18n_test.rb @@ -112,8 +112,8 @@ class DateHelperSelectTagsI18nTests < ActiveSupport::TestCase end def test_date_or_time_select_translates_prompts - prompt_defaults = {year: "Year", month: "Month", day: "Day", hour: "Hour", minute: "Minute", second: "Seconds"} - defaults = {[:'date.order', locale: "en", default: []] => %w(year month day)} + prompt_defaults = { year: "Year", month: "Month", day: "Day", hour: "Hour", minute: "Minute", second: "Seconds" } + defaults = { [:'date.order', locale: "en", default: []] => %w(year month day) } prompt_defaults.each do |key, prompt| defaults[[("datetime.prompts." + key.to_s).to_sym, locale: "en"]] = prompt @@ -143,7 +143,7 @@ class DateHelperSelectTagsI18nTests < ActiveSupport::TestCase end def test_date_or_time_select_given_no_order_options_translates_order - assert_called_with(I18n, :translate, [ [:'date.order', locale: "en", default: []], [:"date.month_names", {locale: "en"}] ], returns: %w(year month day)) do + assert_called_with(I18n, :translate, [ [:'date.order', locale: "en", default: []], [:"date.month_names", { locale: "en" }] ], returns: %w(year month day)) do datetime_select("post", "updated_at", locale: "en") end end @@ -157,7 +157,7 @@ class DateHelperSelectTagsI18nTests < ActiveSupport::TestCase end def test_date_or_time_select_given_symbol_keys - assert_called_with(I18n, :translate, [ [:'date.order', locale: "en", default: []], [:"date.month_names", {locale: "en"}] ], returns: [:year, :month, :day]) do + assert_called_with(I18n, :translate, [ [:'date.order', locale: "en", default: []], [:"date.month_names", { locale: "en" }] ], returns: [:year, :month, :day]) do datetime_select("post", "updated_at", locale: "en") end end diff --git a/actionview/test/template/date_helper_test.rb b/actionview/test/template/date_helper_test.rb index d83be49f40..44e5a8c346 100644 --- a/actionview/test/template/date_helper_test.rb +++ b/actionview/test/template/date_helper_test.rb @@ -500,7 +500,7 @@ class DateHelperTest < ActionView::TestCase expected << %(<option value="2003" selected="selected">2003</option>\n<option value="2004">2004</option>\n<option value="2005">2005</option>\n) expected << "</select>\n" - assert_dom_equal expected, select_year(Time.mktime(2003, 8, 16), {start_year: 2003, end_year: 2005}, class: "selector", accesskey: "M") + assert_dom_equal expected, select_year(Time.mktime(2003, 8, 16), { start_year: 2003, end_year: 2005 }, class: "selector", accesskey: "M") end def test_select_year_with_default_prompt @@ -1046,7 +1046,7 @@ class DateHelperTest < ActionView::TestCase expected << %(<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16" selected="selected">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n) expected << "</select>\n" - assert_dom_equal expected, select_date(Time.mktime(2003, 8, 16), {start_year: 2003, end_year: 2005, prefix: "date[first]"}, class: "selector") + assert_dom_equal expected, select_date(Time.mktime(2003, 8, 16), { start_year: 2003, end_year: 2005, prefix: "date[first]" }, class: "selector") end def test_select_date_with_separator @@ -1150,7 +1150,7 @@ class DateHelperTest < ActionView::TestCase expected << %(<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16" selected="selected">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n) expected << "</select>\n" - assert_dom_equal expected, select_date(Time.mktime(2003, 8, 16), {start_year: 2003, end_year: 2005, prefix: "date[first]", with_css_classes: true}, class: "datetime optional") + assert_dom_equal expected, select_date(Time.mktime(2003, 8, 16), { start_year: 2003, end_year: 2005, prefix: "date[first]", with_css_classes: true }, class: "datetime optional") end def test_select_date_with_custom_with_css_classes_and_html_class_option @@ -1166,7 +1166,7 @@ class DateHelperTest < ActionView::TestCase expected << %(<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16" selected="selected">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n) expected << "</select>\n" - assert_dom_equal expected, select_date(Time.mktime(2003, 8, 16), {start_year: 2003, end_year: 2005, with_css_classes: { year: "my-year", month: "my-month", day: "my-day" }}, class: "date optional") + assert_dom_equal expected, select_date(Time.mktime(2003, 8, 16), { start_year: 2003, end_year: 2005, with_css_classes: { year: "my-year", month: "my-month", day: "my-day" } }, class: "date optional") end def test_select_date_with_partial_with_css_classes_and_html_class_option @@ -1182,7 +1182,7 @@ class DateHelperTest < ActionView::TestCase expected << %(<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16" selected="selected">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n) expected << "</select>\n" - assert_dom_equal expected, select_date(Time.mktime(2003, 8, 16), {start_year: 2003, end_year: 2005, with_css_classes: { month: "my-month custom-grid" }}, class: "date optional") + assert_dom_equal expected, select_date(Time.mktime(2003, 8, 16), { start_year: 2003, end_year: 2005, with_css_classes: { month: "my-month custom-grid" } }, class: "date optional") end def test_select_date_with_html_class_option @@ -1338,7 +1338,7 @@ class DateHelperTest < ActionView::TestCase expected << %(<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04" selected="selected">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n<option value="32">32</option>\n<option value="33">33</option>\n<option value="34">34</option>\n<option value="35">35</option>\n<option value="36">36</option>\n<option value="37">37</option>\n<option value="38">38</option>\n<option value="39">39</option>\n<option value="40">40</option>\n<option value="41">41</option>\n<option value="42">42</option>\n<option value="43">43</option>\n<option value="44">44</option>\n<option value="45">45</option>\n<option value="46">46</option>\n<option value="47">47</option>\n<option value="48">48</option>\n<option value="49">49</option>\n<option value="50">50</option>\n<option value="51">51</option>\n<option value="52">52</option>\n<option value="53">53</option>\n<option value="54">54</option>\n<option value="55">55</option>\n<option value="56">56</option>\n<option value="57">57</option>\n<option value="58">58</option>\n<option value="59">59</option>\n) expected << "</select>\n" - assert_dom_equal expected, select_datetime(Time.mktime(2003, 8, 16, 8, 4, 18), {start_year: 2003, end_year: 2005, prefix: "date[first]"}, class: "selector") + assert_dom_equal expected, select_datetime(Time.mktime(2003, 8, 16, 8, 4, 18), { start_year: 2003, end_year: 2005, prefix: "date[first]" }, class: "selector") end def test_select_datetime_with_all_separators @@ -1370,7 +1370,7 @@ class DateHelperTest < ActionView::TestCase expected << %(<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04" selected="selected">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n<option value="32">32</option>\n<option value="33">33</option>\n<option value="34">34</option>\n<option value="35">35</option>\n<option value="36">36</option>\n<option value="37">37</option>\n<option value="38">38</option>\n<option value="39">39</option>\n<option value="40">40</option>\n<option value="41">41</option>\n<option value="42">42</option>\n<option value="43">43</option>\n<option value="44">44</option>\n<option value="45">45</option>\n<option value="46">46</option>\n<option value="47">47</option>\n<option value="48">48</option>\n<option value="49">49</option>\n<option value="50">50</option>\n<option value="51">51</option>\n<option value="52">52</option>\n<option value="53">53</option>\n<option value="54">54</option>\n<option value="55">55</option>\n<option value="56">56</option>\n<option value="57">57</option>\n<option value="58">58</option>\n<option value="59">59</option>\n) expected << "</select>\n" - assert_dom_equal expected, select_datetime(Time.mktime(2003, 8, 16, 8, 4, 18), { datetime_separator: "—", date_separator: "/", time_separator: ":", start_year: 2003, end_year: 2005, prefix: "date[first]"}, class: "selector") + assert_dom_equal expected, select_datetime(Time.mktime(2003, 8, 16, 8, 4, 18), { datetime_separator: "—", date_separator: "/", time_separator: ":", start_year: 2003, end_year: 2005, prefix: "date[first]" }, class: "selector") end def test_select_datetime_should_work_with_date @@ -1433,7 +1433,7 @@ class DateHelperTest < ActionView::TestCase expected << "</select>\n" assert_dom_equal expected, select_datetime(Time.mktime(2003, 8, 16, 8, 4, 18), start_year: 2003, end_year: 2005, prefix: "date[first]", - prompt: {day: "Choose day", month: "Choose month", year: "Choose year", hour: "Choose hour", minute: "Choose minute"}) + prompt: { day: "Choose day", month: "Choose month", year: "Choose year", hour: "Choose hour", minute: "Choose minute" }) end def test_select_datetime_with_generic_with_css_classes @@ -1518,7 +1518,7 @@ class DateHelperTest < ActionView::TestCase expected << "</select>\n" assert_dom_equal expected, select_datetime(Time.mktime(2003, 8, 16, 8, 4, 18), start_year: 2003, end_year: 2005, start_hour: 1, end_hour: 9, prefix: "date[first]", - prompt: {day: "Choose day", month: "Choose month", year: "Choose year", hour: "Choose hour", minute: "Choose minute"}) + prompt: { day: "Choose day", month: "Choose month", year: "Choose year", hour: "Choose hour", minute: "Choose minute" }) end def test_select_datetime_with_hidden @@ -1652,7 +1652,7 @@ class DateHelperTest < ActionView::TestCase expected << "</select>\n" assert_dom_equal expected, select_time(Time.mktime(2003, 8, 16, 8, 4, 18), {}, class: "selector") - assert_dom_equal expected, select_time(Time.mktime(2003, 8, 16, 8, 4, 18), {include_seconds: false}, class: "selector") + assert_dom_equal expected, select_time(Time.mktime(2003, 8, 16, 8, 4, 18), { include_seconds: false }, class: "selector") end def test_select_time_should_work_with_date @@ -1705,7 +1705,7 @@ class DateHelperTest < ActionView::TestCase expected << "</select>\n" assert_dom_equal expected, select_time(Time.mktime(2003, 8, 16, 8, 4, 18), include_seconds: true, - prompt: {hour: "Choose hour", minute: "Choose minute", second: "Choose seconds"}) + prompt: { hour: "Choose hour", minute: "Choose minute", second: "Choose seconds" }) end def test_select_time_with_generic_with_css_classes @@ -1824,7 +1824,7 @@ class DateHelperTest < ActionView::TestCase expected << "</select>\n" - assert_dom_equal expected, date_select("post", "written_on", selected: {day: 10, month: 07, year: 2004}) + assert_dom_equal expected, date_select("post", "written_on", selected: { day: 10, month: 07, year: 2004 }) end def test_date_select_with_selected_nil @@ -2280,7 +2280,7 @@ class DateHelperTest < ActionView::TestCase expected << "</select>\n" - assert_dom_equal expected, date_select("post", "written_on", prompt: {year: "Choose year", month: "Choose month", day: "Choose day"}) + assert_dom_equal expected, date_select("post", "written_on", prompt: { year: "Choose year", month: "Choose month", day: "Choose day" }) end def test_date_select_with_generic_with_css_classes @@ -2526,7 +2526,7 @@ class DateHelperTest < ActionView::TestCase 0.upto(59) { |i| expected << %(<option value="#{sprintf("%02d", i)}"#{' selected="selected"' if i == 16}>#{sprintf("%02d", i)}</option>\n) } expected << "</select>\n" - assert_dom_equal expected, time_select("post", "written_on", prompt: {hour: "Choose hour", minute: "Choose minute"}) + assert_dom_equal expected, time_select("post", "written_on", prompt: { hour: "Choose hour", minute: "Choose minute" }) end def test_time_select_with_generic_with_css_classes @@ -2841,7 +2841,7 @@ class DateHelperTest < ActionView::TestCase expected << %{<option value="">Choose minute</option>\n<option value="00">00</option>\n<option value="01">01</option>\n<option value="02">02</option>\n<option value="03">03</option>\n<option value="04">04</option>\n<option value="05">05</option>\n<option value="06">06</option>\n<option value="07">07</option>\n<option value="08">08</option>\n<option value="09">09</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n<option value="32">32</option>\n<option value="33">33</option>\n<option value="34">34</option>\n<option value="35">35</option>\n<option value="36">36</option>\n<option value="37">37</option>\n<option value="38">38</option>\n<option value="39">39</option>\n<option value="40">40</option>\n<option value="41">41</option>\n<option value="42">42</option>\n<option value="43">43</option>\n<option value="44">44</option>\n<option value="45">45</option>\n<option value="46">46</option>\n<option value="47">47</option>\n<option value="48">48</option>\n<option value="49">49</option>\n<option value="50">50</option>\n<option value="51">51</option>\n<option value="52">52</option>\n<option value="53">53</option>\n<option value="54">54</option>\n<option value="55">55</option>\n<option value="56">56</option>\n<option value="57">57</option>\n<option value="58">58</option>\n<option value="59">59</option>\n} expected << "</select>\n" - assert_dom_equal expected, datetime_select("post", "updated_at", start_year: 1999, end_year: 2009, prompt: {year: "Choose year", month: "Choose month", day: "Choose day", hour: "Choose hour", minute: "Choose minute"}) + assert_dom_equal expected, datetime_select("post", "updated_at", start_year: 1999, end_year: 2009, prompt: { year: "Choose year", month: "Choose month", day: "Choose day", hour: "Choose hour", minute: "Choose minute" }) end def test_datetime_select_with_generic_with_css_classes @@ -3612,7 +3612,7 @@ class DateHelperTest < ActionView::TestCase end def test_time_tag_with_given_block - assert_match(/<time.*><span>Right now<\/span><\/time>/, time_tag(Time.now){ raw("<span>Right now</span>") }) + assert_match(/<time.*><span>Right now<\/span><\/time>/, time_tag(Time.now) { raw("<span>Right now</span>") }) end def test_time_tag_with_different_format diff --git a/actionview/test/template/dependency_tracker_test.rb b/actionview/test/template/dependency_tracker_test.rb index a077d4c448..89917035ff 100644 --- a/actionview/test/template/dependency_tracker_test.rb +++ b/actionview/test/template/dependency_tracker_test.rb @@ -15,8 +15,8 @@ class FakeTemplate end end -Neckbeard = lambda {|template| template.source } -Bowtie = lambda {|template| template.source } +Neckbeard = lambda { |template| template.source } +Bowtie = lambda { |template| template.source } class DependencyTrackerTest < ActionView::TestCase def tracker diff --git a/actionview/test/template/digestor_test.rb b/actionview/test/template/digestor_test.rb index dec75268aa..093ff28c14 100644 --- a/actionview/test/template/digestor_test.rb +++ b/actionview/test/template/digestor_test.rb @@ -139,7 +139,7 @@ class TemplateDigestorTest < ActionView::TestCase end def test_getting_of_doubly_nested_dependencies - doubly_nested = [{"comments/comments"=>["comments/comment"]}, "messages/message"] + doubly_nested = [{ "comments/comments"=>["comments/comment"] }, "messages/message"] assert_equal doubly_nested, nested_dependencies("messages/peek") end @@ -150,13 +150,13 @@ class TemplateDigestorTest < ActionView::TestCase end def test_nested_template_deps - nested_deps = ["messages/header", {"comments/comments"=>["comments/comment"]}, "messages/actions/move", "events/event", "messages/something_missing", "messages/something_missing_1", "messages/message", "messages/form"] + nested_deps = ["messages/header", { "comments/comments"=>["comments/comment"] }, "messages/actions/move", "events/event", "messages/something_missing", "messages/something_missing_1", "messages/message", "messages/form"] assert_equal nested_deps, nested_dependencies("messages/show") end def test_nested_template_deps_with_non_default_rendered_format finder.rendered_format = nil - nested_deps = [{"comments/comments"=>["comments/comment"]}] + nested_deps = [{ "comments/comments"=>["comments/comment"] }] assert_equal nested_deps, nested_dependencies("messages/thread") end diff --git a/actionview/test/template/form_collections_helper_test.rb b/actionview/test/template/form_collections_helper_test.rb index 9eb4d8f58f..3774dcf872 100644 --- a/actionview/test/template/form_collections_helper_test.rb +++ b/actionview/test/template/form_collections_helper_test.rb @@ -94,7 +94,7 @@ class FormCollectionsHelperTest < ActionView::TestCase end test "collection radio accepts html options as the last element of array" do - collection = [[1, true, {class: "foo"}], [0, false, {class: "bar"}]] + collection = [[1, true, { class: "foo" }], [0, false, { class: "bar" }]] with_collection_radio_buttons :user, :active, collection, :second, :first assert_select "input[type=radio][value=true].foo#user_active_true" @@ -102,7 +102,7 @@ class FormCollectionsHelperTest < ActionView::TestCase end test "collection radio sets the label class defined inside the block" do - collection = [[1, true, {class: "foo"}], [0, false, {class: "bar"}]] + collection = [[1, true, { class: "foo" }], [0, false, { class: "bar" }]] with_collection_radio_buttons :user, :active, collection, :second, :first do |b| b.label(class: "collection_radio_buttons") end @@ -112,7 +112,7 @@ class FormCollectionsHelperTest < ActionView::TestCase end test "collection radio does not include the input class in the respective label" do - collection = [[1, true, {class: "foo"}], [0, false, {class: "bar"}]] + collection = [[1, true, { class: "foo" }], [0, false, { class: "bar" }]] with_collection_radio_buttons :user, :active, collection, :second, :first assert_no_select "label.foo[for=user_active_true]" @@ -299,7 +299,7 @@ class FormCollectionsHelperTest < ActionView::TestCase end test "collection check boxes accepts html options as the last element of array" do - collection = [[1, "Category 1", {class: "foo"}], [2, "Category 2", {class: "bar"}]] + collection = [[1, "Category 1", { class: "foo" }], [2, "Category 2", { class: "bar" }]] with_collection_check_boxes :user, :active, collection, :first, :second assert_select 'input[type=checkbox][value="1"].foo' @@ -307,7 +307,7 @@ class FormCollectionsHelperTest < ActionView::TestCase end test "collection check boxes propagates input id to the label for attribute" do - collection = [[1, "Category 1", {id: "foo"}], [2, "Category 2", {id: "bar"}]] + collection = [[1, "Category 1", { id: "foo" }], [2, "Category 2", { id: "bar" }]] with_collection_check_boxes :user, :active, collection, :first, :second assert_select 'input[type=checkbox][value="1"]#foo' @@ -318,7 +318,7 @@ class FormCollectionsHelperTest < ActionView::TestCase end test "collection check boxes sets the label class defined inside the block" do - collection = [[1, "Category 1", {class: "foo"}], [2, "Category 2", {class: "bar"}]] + collection = [[1, "Category 1", { class: "foo" }], [2, "Category 2", { class: "bar" }]] with_collection_check_boxes :user, :active, collection, :second, :first do |b| b.label(class: "collection_check_boxes") end @@ -328,7 +328,7 @@ class FormCollectionsHelperTest < ActionView::TestCase end test "collection check boxes does not include the input class in the respective label" do - collection = [[1, "Category 1", {class: "foo"}], [2, "Category 2", {class: "bar"}]] + collection = [[1, "Category 1", { class: "foo" }], [2, "Category 2", { class: "bar" }]] with_collection_check_boxes :user, :active, collection, :second, :first assert_no_select "label.foo[for=user_active_category_1]" @@ -336,7 +336,7 @@ class FormCollectionsHelperTest < ActionView::TestCase end test "collection check boxes accepts selected values as :checked option" do - collection = (1..3).map{|i| [i, "Category #{i}"] } + collection = (1..3).map { |i| [i, "Category #{i}"] } with_collection_check_boxes :user, :category_ids, collection, :first, :last, checked: [1, 3] assert_select 'input[type=checkbox][value="1"][checked=checked]' @@ -345,7 +345,7 @@ class FormCollectionsHelperTest < ActionView::TestCase end test "collection check boxes accepts selected string values as :checked option" do - collection = (1..3).map{|i| [i, "Category #{i}"] } + collection = (1..3).map { |i| [i, "Category #{i}"] } with_collection_check_boxes :user, :category_ids, collection, :first, :last, checked: ["1", "3"] assert_select 'input[type=checkbox][value="1"][checked=checked]' @@ -354,7 +354,7 @@ class FormCollectionsHelperTest < ActionView::TestCase end test "collection check boxes accepts a single checked value" do - collection = (1..3).map{|i| [i, "Category #{i}"] } + collection = (1..3).map { |i| [i, "Category #{i}"] } with_collection_check_boxes :user, :category_ids, collection, :first, :last, checked: 3 assert_select 'input[type=checkbox][value="3"][checked=checked]' @@ -364,7 +364,7 @@ class FormCollectionsHelperTest < ActionView::TestCase test "collection check boxes accepts selected values as :checked option and override the model values" do user = Struct.new(:category_ids).new(2) - collection = (1..3).map{|i| [i, "Category #{i}"] } + collection = (1..3).map { |i| [i, "Category #{i}"] } @output_buffer = fields_for(:user, user) do |p| p.collection_check_boxes :category_ids, collection, :first, :last, checked: [1, 3] @@ -376,7 +376,7 @@ class FormCollectionsHelperTest < ActionView::TestCase end test "collection check boxes accepts multiple disabled items" do - collection = (1..3).map{|i| [i, "Category #{i}"] } + collection = (1..3).map { |i| [i, "Category #{i}"] } with_collection_check_boxes :user, :category_ids, collection, :first, :last, disabled: [1, 3] assert_select 'input[type=checkbox][value="1"][disabled=disabled]' @@ -385,7 +385,7 @@ class FormCollectionsHelperTest < ActionView::TestCase end test "collection check boxes accepts single disabled item" do - collection = (1..3).map{|i| [i, "Category #{i}"] } + collection = (1..3).map { |i| [i, "Category #{i}"] } with_collection_check_boxes :user, :category_ids, collection, :first, :last, disabled: 1 assert_select 'input[type=checkbox][value="1"][disabled=disabled]' @@ -394,7 +394,7 @@ class FormCollectionsHelperTest < ActionView::TestCase end test "collection check boxes accepts a proc to disabled items" do - collection = (1..3).map{|i| [i, "Category #{i}"] } + collection = (1..3).map { |i| [i, "Category #{i}"] } with_collection_check_boxes :user, :category_ids, collection, :first, :last, disabled: proc { |i| i.first == 1 } assert_select 'input[type=checkbox][value="1"][disabled=disabled]' @@ -403,7 +403,7 @@ class FormCollectionsHelperTest < ActionView::TestCase end test "collection check boxes accepts multiple readonly items" do - collection = (1..3).map{|i| [i, "Category #{i}"] } + collection = (1..3).map { |i| [i, "Category #{i}"] } with_collection_check_boxes :user, :category_ids, collection, :first, :last, readonly: [1, 3] assert_select 'input[type=checkbox][value="1"][readonly=readonly]' @@ -412,7 +412,7 @@ class FormCollectionsHelperTest < ActionView::TestCase end test "collection check boxes accepts single readonly item" do - collection = (1..3).map{|i| [i, "Category #{i}"] } + collection = (1..3).map { |i| [i, "Category #{i}"] } with_collection_check_boxes :user, :category_ids, collection, :first, :last, readonly: 1 assert_select 'input[type=checkbox][value="1"][readonly=readonly]' @@ -421,7 +421,7 @@ class FormCollectionsHelperTest < ActionView::TestCase end test "collection check boxes accepts a proc to readonly items" do - collection = (1..3).map{|i| [i, "Category #{i}"] } + collection = (1..3).map { |i| [i, "Category #{i}"] } with_collection_check_boxes :user, :category_ids, collection, :first, :last, readonly: proc { |i| i.first == 1 } assert_select 'input[type=checkbox][value="1"][readonly=readonly]' diff --git a/actionview/test/template/form_helper_test.rb b/actionview/test/template/form_helper_test.rb index 70f690478d..e82905175a 100644 --- a/actionview/test/template/form_helper_test.rb +++ b/actionview/test/template/form_helper_test.rb @@ -3439,7 +3439,7 @@ class FormHelperTest < ActionView::TestCase end end - form_for(@post, builder: builder_class) { } + form_for(@post, builder: builder_class) {} assert_equal 1, initialization_count, "form builder instantiated more than once" end diff --git a/actionview/test/template/form_options_helper_test.rb b/actionview/test/template/form_options_helper_test.rb index 18dfec1b37..477d4f9eca 100644 --- a/actionview/test/template/form_options_helper_test.rb +++ b/actionview/test/template/form_options_helper_test.rb @@ -74,7 +74,7 @@ class FormOptionsHelperTest < ActionView::TestCase def test_collection_options_with_proc_for_selected assert_dom_equal( "<option value=\"<Abe>\"><Abe> went home</option>\n<option value=\"Babe\" selected=\"selected\">Babe went home</option>\n<option value=\"Cabe\">Cabe went home</option>", - options_from_collection_for_select(dummy_posts, "author_name", "title", lambda{|p| p.author_name == "Babe" }) + options_from_collection_for_select(dummy_posts, "author_name", "title", lambda { |p| p.author_name == "Babe" }) ) end @@ -102,7 +102,7 @@ class FormOptionsHelperTest < ActionView::TestCase def test_collection_options_with_proc_for_disabled assert_dom_equal( "<option value=\"<Abe>\"><Abe> went home</option>\n<option value=\"Babe\" disabled=\"disabled\">Babe went home</option>\n<option value=\"Cabe\" disabled=\"disabled\">Cabe went home</option>", - options_from_collection_for_select(dummy_posts, "author_name", "title", disabled: lambda {|p| %w(Babe Cabe).include?(p.author_name)}) + options_from_collection_for_select(dummy_posts, "author_name", "title", disabled: lambda { |p| %w(Babe Cabe).include?(p.author_name) }) ) end @@ -636,7 +636,7 @@ class FormOptionsHelperTest < ActionView::TestCase end def test_select_with_multiple_and_without_hidden_input - output_buffer = select(:post, :category, "", {include_hidden: false}, multiple: true) + output_buffer = select(:post, :category, "", { include_hidden: false }, multiple: true) assert_dom_equal( "<select multiple=\"multiple\" id=\"post_category\" name=\"post[category][]\"></select>", output_buffer @@ -644,7 +644,7 @@ class FormOptionsHelperTest < ActionView::TestCase end def test_select_with_multiple_and_with_explicit_name_ending_with_brackets - output_buffer = select(:post, :category, [], {include_hidden: false}, multiple: true, name: "post[category][]") + output_buffer = select(:post, :category, [], { include_hidden: false }, multiple: true, name: "post[category][]") assert_dom_equal( "<select multiple=\"multiple\" id=\"post_category\" name=\"post[category][]\"></select>", output_buffer @@ -1313,21 +1313,21 @@ class FormOptionsHelperTest < ActionView::TestCase def test_option_html_attributes_with_single_element_hash assert_equal( - {class: "fancy"}, + { class: "fancy" }, option_html_attributes([ "foo", "bar", { class: "fancy" } ]) ) end def test_option_html_attributes_with_multiple_element_hash assert_equal( - {:class => "fancy", "onclick" => "alert('Hello World');"}, + { :class => "fancy", "onclick" => "alert('Hello World');" }, option_html_attributes([ "foo", "bar", { :class => "fancy", "onclick" => "alert('Hello World');" } ]) ) end def test_option_html_attributes_with_multiple_hashes assert_equal( - {:class => "fancy", "onclick" => "alert('Hello World');"}, + { :class => "fancy", "onclick" => "alert('Hello World');" }, option_html_attributes([ "foo", "bar", { class: "fancy" }, { "onclick" => "alert('Hello World');" } ]) ) end diff --git a/actionview/test/template/form_tag_helper_test.rb b/actionview/test/template/form_tag_helper_test.rb index a639b56b0b..da929cac8f 100644 --- a/actionview/test/template/form_tag_helper_test.rb +++ b/actionview/test/template/form_tag_helper_test.rb @@ -183,7 +183,7 @@ class FormTagHelperTest < ActionView::TestCase end def test_multiple_field_tags_with_same_options - options = {class: "important"} + options = { class: "important" } assert_dom_equal %(<input name="title" type="file" id="title" class="important"/>), file_field_tag("title", options) assert_dom_equal %(<input type="password" name="title" id="title" value="Hello!" class="important" />), password_field_tag("title", "Hello!", options) assert_dom_equal %(<input type="text" name="title" id="title" value="Hello!" class="important" />), text_field_tag("title", "Hello!", options) diff --git a/actionview/test/template/lookup_context_test.rb b/actionview/test/template/lookup_context_test.rb index 77fab5652f..40d8d6f3b8 100644 --- a/actionview/test/template/lookup_context_test.rb +++ b/actionview/test/template/lookup_context_test.rb @@ -279,7 +279,7 @@ class TestMissingTemplate < ActiveSupport::TestCase test "if a single prefix is passed as a string and the lookup fails, MissingTemplate accepts it" do e = assert_raise ActionView::MissingTemplate do - details = {handlers: [], formats: [], variants: [], locale: []} + details = { handlers: [], formats: [], variants: [], locale: [] } @lookup_context.view_paths.find("foo", "parent", true, details) end assert_match %r{Missing partial parent/_foo with .* Searched in:\n \* "/Path/to/views"\n}, e.message diff --git a/actionview/test/template/number_helper_test.rb b/actionview/test/template/number_helper_test.rb index d55651bd4a..2a2ada2b36 100644 --- a/actionview/test/template/number_helper_test.rb +++ b/actionview/test/template/number_helper_test.rb @@ -80,7 +80,7 @@ class NumberHelperTest < ActionView::TestCase #Including fractionals distance = { mili: "<b>mm</b>", centi: "<b>cm</b>", deci: "<b>dm</b>", unit: "<b>m</b>", ten: "<b>dam</b>", hundred: "<b>hm</b>", thousand: "<b>km</b>", - micro: "<b>um</b>", nano: "<b>nm</b>", pico: "<b>pm</b>", femto: "<b>fm</b>"} + micro: "<b>um</b>", nano: "<b>nm</b>", pico: "<b>pm</b>", femto: "<b>fm</b>" } assert_equal "1.23 <b>mm</b>", number_to_human(0.00123, units: distance) assert_equal "1.23 <b>cm</b>", number_to_human(0.0123, units: distance) assert_equal "1.23 <b>dm</b>", number_to_human(0.123, units: distance) @@ -117,7 +117,7 @@ class NumberHelperTest < ActionView::TestCase def test_number_to_human_with_custom_translation_scope I18n.backend.store_translations "ts", - custom_units_for_number_to_human: {mili: "mm", centi: "cm", deci: "dm", unit: "m", ten: "dam", hundred: "hm", thousand: "km"} + custom_units_for_number_to_human: { mili: "mm", centi: "cm", deci: "dm", unit: "m", ten: "dam", hundred: "hm", thousand: "km" } assert_equal "1.01 cm", number_to_human(0.0101, locale: "ts", units: :custom_units_for_number_to_human) ensure I18n.reload! diff --git a/actionview/test/template/render_test.rb b/actionview/test/template/render_test.rb index 173c2c4cec..7c8a6aae47 100644 --- a/actionview/test/template/render_test.rb +++ b/actionview/test/template/render_test.rb @@ -362,12 +362,12 @@ module RenderTestCases def test_render_partial_with_object_uses_render_partial_path assert_equal "Hello: lifo", - @controller_view.render(partial: Customer.new("lifo"), locals: {greeting: "Hello"}) + @controller_view.render(partial: Customer.new("lifo"), locals: { greeting: "Hello" }) end def test_render_partial_with_object_and_format_uses_render_partial_path assert_equal "<greeting>Hello</greeting><name>lifo</name>", - @controller_view.render(partial: Customer.new("lifo"), formats: :xml, locals: {greeting: "Hello"}) + @controller_view.render(partial: Customer.new("lifo"), formats: :xml, locals: { greeting: "Hello" }) end def test_render_partial_using_object @@ -520,12 +520,12 @@ module RenderTestCases def test_render_partial_and_layout_without_block_with_locals assert_equal %(Before (Foo!)\npartial html\nAfter), - @view.render(partial: "test/partial", layout: "test/layout_for_partial", locals: { name: "Foo!"}) + @view.render(partial: "test/partial", layout: "test/layout_for_partial", locals: { name: "Foo!" }) end def test_render_partial_and_layout_without_block_with_locals_and_rendering_another_partial assert_equal %(Before (Foo!)\npartial html\npartial with partial\n\nAfter), - @view.render(partial: "test/partial_with_partial", layout: "test/layout_for_partial", locals: { name: "Foo!"}) + @view.render(partial: "test/partial_with_partial", layout: "test/layout_for_partial", locals: { name: "Foo!" }) end def test_render_partial_shortcut_with_block_content @@ -535,17 +535,17 @@ module RenderTestCases def test_render_layout_with_a_nested_render_layout_call assert_equal %(Before (Foo!)\nBefore (Bar!)\npartial html\nAfter\npartial with layout\n\nAfter), - @view.render(partial: "test/partial_with_layout", layout: "test/layout_for_partial", locals: { name: "Foo!"}) + @view.render(partial: "test/partial_with_layout", layout: "test/layout_for_partial", locals: { name: "Foo!" }) end def test_render_layout_with_a_nested_render_layout_call_using_block_with_render_partial assert_equal %(Before (Foo!)\nBefore (Bar!)\n\n partial html\n\nAfterpartial with layout\n\nAfter), - @view.render(partial: "test/partial_with_layout_block_partial", layout: "test/layout_for_partial", locals: { name: "Foo!"}) + @view.render(partial: "test/partial_with_layout_block_partial", layout: "test/layout_for_partial", locals: { name: "Foo!" }) end def test_render_layout_with_a_nested_render_layout_call_using_block_with_render_content assert_equal %(Before (Foo!)\nBefore (Bar!)\n\n Content from inside layout!\n\nAfterpartial with layout\n\nAfter), - @view.render(partial: "test/partial_with_layout_block_content", layout: "test/layout_for_partial", locals: { name: "Foo!"}) + @view.render(partial: "test/partial_with_layout_block_content", layout: "test/layout_for_partial", locals: { name: "Foo!" }) end def test_render_partial_with_layout_raises_descriptive_error diff --git a/actionview/test/template/tag_helper_test.rb b/actionview/test/template/tag_helper_test.rb index d07312ace3..278c3e855f 100644 --- a/actionview/test/template/tag_helper_test.rb +++ b/actionview/test/template/tag_helper_test.rb @@ -171,7 +171,7 @@ class TagHelperTest < ActionView::TestCase content_tag("p") { content_tag("b", "Hello") }, output_buffer assert_equal tag.p(tag.b("Hello")), - tag.p {tag.b("Hello") }, + tag.p { tag.b("Hello") }, output_buffer end @@ -203,10 +203,10 @@ class TagHelperTest < ActionView::TestCase end def test_content_tag_with_unescaped_array_class - str = content_tag("p", "limelight", {class: ["song", "play>"]}, false) + str = content_tag("p", "limelight", { class: ["song", "play>"] }, false) assert_equal "<p class=\"song play>\">limelight</p>", str - str = content_tag("p", "limelight", {class: ["song", ["play>"]]}, false) + str = content_tag("p", "limelight", { class: ["song", ["play>"]] }, false) assert_equal "<p class=\"song play>\">limelight</p>", str end @@ -228,7 +228,7 @@ class TagHelperTest < ActionView::TestCase end def test_content_tag_with_unescaped_empty_array_class - str = content_tag("p", "limelight", {class: []}, false) + str = content_tag("p", "limelight", { class: [] }, false) assert_equal '<p class="">limelight</p>', str end @@ -305,39 +305,39 @@ class TagHelperTest < ActionView::TestCase def test_tag_builder_disable_escaping assert_equal '<a href="&"></a>', tag.a(href: "&", escape_attributes: false) - assert_equal '<a href="&">cnt</a>', tag.a(href: "&" , escape_attributes: false) { "cnt"} + assert_equal '<a href="&">cnt</a>', tag.a(href: "&" , escape_attributes: false) { "cnt" } assert_equal '<br data-hidden="&">', tag.br("data-hidden": "&" , escape_attributes: false) assert_equal '<a href="&">content</a>', tag.a("content", href: "&", escape_attributes: false) - assert_equal '<a href="&">content</a>', tag.a(href: "&", escape_attributes: false) { "content"} + assert_equal '<a href="&">content</a>', tag.a(href: "&", escape_attributes: false) { "content" } end def test_data_attributes ["data", :data].each { |data| assert_dom_equal '<a data-a-float="3.14" data-a-big-decimal="-123.456" data-a-number="1" data-array="[1,2,3]" data-hash="{"key":"value"}" data-string-with-quotes="double"quote"party"" data-string="hello" data-symbol="foo" />', - tag("a", data => { a_float: 3.14, a_big_decimal: BigDecimal.new("-123.456"), a_number: 1, string: "hello", symbol: :foo, array: [1, 2, 3], hash: { key: "value"}, string_with_quotes: 'double"quote"party"' }) + tag("a", data => { a_float: 3.14, a_big_decimal: BigDecimal.new("-123.456"), a_number: 1, string: "hello", symbol: :foo, array: [1, 2, 3], hash: { key: "value" }, string_with_quotes: 'double"quote"party"' }) assert_dom_equal '<a data-a-float="3.14" data-a-big-decimal="-123.456" data-a-number="1" data-array="[1,2,3]" data-hash="{"key":"value"}" data-string-with-quotes="double"quote"party"" data-string="hello" data-symbol="foo" />', - tag.a(data: { a_float: 3.14, a_big_decimal: BigDecimal.new("-123.456"), a_number: 1, string: "hello", symbol: :foo, array: [1, 2, 3], hash: { key: "value"}, string_with_quotes: 'double"quote"party"' }) + tag.a(data: { a_float: 3.14, a_big_decimal: BigDecimal.new("-123.456"), a_number: 1, string: "hello", symbol: :foo, array: [1, 2, 3], hash: { key: "value" }, string_with_quotes: 'double"quote"party"' }) } end def test_aria_attributes ["aria", :aria].each { |aria| assert_dom_equal '<a aria-a-float="3.14" aria-a-big-decimal="-123.456" aria-a-number="1" aria-array="[1,2,3]" aria-hash="{"key":"value"}" aria-string-with-quotes="double"quote"party"" aria-string="hello" aria-symbol="foo" />', - tag("a", aria => { a_float: 3.14, a_big_decimal: BigDecimal.new("-123.456"), a_number: 1, string: "hello", symbol: :foo, array: [1, 2, 3], hash: { key: "value"}, string_with_quotes: 'double"quote"party"' }) + tag("a", aria => { a_float: 3.14, a_big_decimal: BigDecimal.new("-123.456"), a_number: 1, string: "hello", symbol: :foo, array: [1, 2, 3], hash: { key: "value" }, string_with_quotes: 'double"quote"party"' }) assert_dom_equal '<a aria-a-float="3.14" aria-a-big-decimal="-123.456" aria-a-number="1" aria-array="[1,2,3]" aria-hash="{"key":"value"}" aria-string-with-quotes="double"quote"party"" aria-string="hello" aria-symbol="foo" />', - tag.a(aria: { a_float: 3.14, a_big_decimal: BigDecimal.new("-123.456"), a_number: 1, string: "hello", symbol: :foo, array: [1, 2, 3], hash: { key: "value"}, string_with_quotes: 'double"quote"party"' }) + tag.a(aria: { a_float: 3.14, a_big_decimal: BigDecimal.new("-123.456"), a_number: 1, string: "hello", symbol: :foo, array: [1, 2, 3], hash: { key: "value" }, string_with_quotes: 'double"quote"party"' }) } end def test_link_to_data_nil_equal div_type1 = content_tag(:div, "test", "data-tooltip" => nil) - div_type2 = content_tag(:div, "test", data: {tooltip: nil}) + div_type2 = content_tag(:div, "test", data: { tooltip: nil }) assert_dom_equal div_type1, div_type2 end def test_tag_builder_link_to_data_nil_equal div_type1 = tag.div "test", 'data-tooltip': nil - div_type2 = tag.div "test", data: {tooltip: nil} + div_type2 = tag.div "test", data: { tooltip: nil } assert_dom_equal div_type1, div_type2 end diff --git a/actionview/test/template/template_test.rb b/actionview/test/template/template_test.rb index 533c1c3219..2988f152be 100644 --- a/actionview/test/template/template_test.rb +++ b/actionview/test/template/template_test.rb @@ -35,7 +35,7 @@ class TestERBTemplate < ActiveSupport::TestCase "<%= @virtual_path %>", "partial", ERBHandler, - :virtual_path => "partial" + virtual_path: "partial" ) end @@ -53,7 +53,7 @@ class TestERBTemplate < ActiveSupport::TestCase end def new_template(body = "<%= hello %>", details = { format: :html }) - ActionView::Template.new(body, "hello template", details.fetch(:handler) { ERBHandler }, {:virtual_path => "hello"}.merge!(details)) + ActionView::Template.new(body, "hello template", details.fetch(:handler) { ERBHandler }, { virtual_path: "hello" }.merge!(details)) end def render(locals = {}) @@ -91,7 +91,7 @@ class TestERBTemplate < ActiveSupport::TestCase end def test_template_does_not_lose_its_source_after_rendering_if_it_does_not_have_a_virtual_path - @template = new_template("Hello", :virtual_path => nil) + @template = new_template("Hello", virtual_path: nil) render assert_equal "Hello", @template.source end @@ -99,7 +99,7 @@ class TestERBTemplate < ActiveSupport::TestCase def test_locals @template = new_template("<%= my_local %>") @template.locals = [:my_local] - assert_equal "I am a local", render(:my_local => "I am a local") + assert_equal "I am a local", render(my_local: "I am a local") end def test_restores_buffer @@ -116,23 +116,23 @@ class TestERBTemplate < ActiveSupport::TestCase end def test_refresh_with_templates - @template = new_template("Hello", :virtual_path => "test/foo/bar") + @template = new_template("Hello", virtual_path: "test/foo/bar") @template.locals = [:key] - assert_called_with(@context.lookup_context, :find_template,["bar", %w(test/foo), false, [:key]], returns: "template") do + assert_called_with(@context.lookup_context, :find_template, ["bar", %w(test/foo), false, [:key]], returns: "template") do assert_equal "template", @template.refresh(@context) end end def test_refresh_with_partials - @template = new_template("Hello", :virtual_path => "test/_foo") + @template = new_template("Hello", virtual_path: "test/_foo") @template.locals = [:key] - assert_called_with(@context.lookup_context, :find_template,[ "foo", %w(test), true, [:key]], returns: "partial") do + assert_called_with(@context.lookup_context, :find_template, ["foo", %w(test), true, [:key]], returns: "partial") do assert_equal "partial", @template.refresh(@context) end end def test_refresh_raises_an_error_without_virtual_path - @template = new_template("Hello", :virtual_path => nil) + @template = new_template("Hello", virtual_path: nil) assert_raise RuntimeError do @template.refresh(@context) end @@ -171,14 +171,14 @@ class TestERBTemplate < ActiveSupport::TestCase # inside Rails. def test_lying_with_magic_comment assert_raises(ActionView::Template::Error) do - @template = new_template("# encoding: UTF-8\nhello \xFCmlat", :virtual_path => nil) + @template = new_template("# encoding: UTF-8\nhello \xFCmlat", virtual_path: nil) render end end def test_encoding_can_be_specified_with_magic_comment_in_erb with_external_encoding Encoding::UTF_8 do - @template = new_template("<%# encoding: ISO-8859-1 %>hello \xFCmlat", :virtual_path => nil) + @template = new_template("<%# encoding: ISO-8859-1 %>hello \xFCmlat", virtual_path: nil) assert_equal Encoding::UTF_8, render.encoding assert_equal "hello \u{fc}mlat", render end @@ -186,7 +186,7 @@ class TestERBTemplate < ActiveSupport::TestCase def test_error_when_template_isnt_valid_utf8 e = assert_raises ActionView::Template::Error do - @template = new_template("hello \xFCmlat", :virtual_path => nil) + @template = new_template("hello \xFCmlat", virtual_path: nil) render end assert_match(/\xFC/, e.message) diff --git a/actionview/test/template/test_case_test.rb b/actionview/test/template/test_case_test.rb index 0b9d78d668..597b2aa8dd 100644 --- a/actionview/test/template/test_case_test.rb +++ b/actionview/test/template/test_case_test.rb @@ -59,7 +59,7 @@ module ActionView test "can render a layout with block" do assert_equal "Before (ChrisCruft)\n!\nAfter", - render(layout: "test/layout_for_partial", locals: {name: "ChrisCruft"}) {"!"} + render(layout: "test/layout_for_partial", locals: { name: "ChrisCruft" }) { "!" } end helper AnotherTestHelper @@ -155,7 +155,7 @@ module ActionView test "view_assigns returns a Hash of user defined ivars" do @a = "b" @c = "d" - assert_equal({a: "b", c: "d"}, view_assigns) + assert_equal({ a: "b", c: "d" }, view_assigns) end test "view_assigns excludes internal ivars" do diff --git a/actionview/test/template/text_helper_test.rb b/actionview/test/template/text_helper_test.rb index 9f57e6a6ae..d77e4c6913 100644 --- a/actionview/test/template/text_helper_test.rb +++ b/actionview/test/template/text_helper_test.rb @@ -71,7 +71,7 @@ class TextHelperTest < ActionView::TestCase end def test_simple_format_does_not_modify_the_html_options_hash - options = { class: "foobar"} + options = { class: "foobar" } passed_options = options.dup simple_format("some text", passed_options) assert_equal options, passed_options diff --git a/actionview/test/template/url_helper_test.rb b/actionview/test/template/url_helper_test.rb index 49ada352e0..2ef2be65d2 100644 --- a/actionview/test/template/url_helper_test.rb +++ b/actionview/test/template/url_helper_test.rb @@ -94,7 +94,7 @@ class UrlHelperTest < ActiveSupport::TestCase def test_to_form_params_with_namespace assert_equal( [{ name: "country[name]", value: "Denmark" }], - to_form_params({name: "Denmark"}, "country") + to_form_params({ name: "Denmark" }, "country") ) end @@ -260,7 +260,7 @@ class UrlHelperTest < ActiveSupport::TestCase end def test_link_tag_with_back - env = {"HTTP_REFERER" => "http://www.example.com/referer"} + env = { "HTTP_REFERER" => "http://www.example.com/referer" } @controller = Struct.new(:request).new(Struct.new(:env).new(env)) expected = %{<a href="#{env["HTTP_REFERER"]}">go back</a>} assert_dom_equal expected, link_to("go back", :back) |