diff options
author | Xavier Noria <fxn@hashref.com> | 2016-08-06 19:44:11 +0200 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2016-08-06 19:44:11 +0200 |
commit | 411ccbdab2608c62aabdb320d52cb02d446bb39c (patch) | |
tree | 05671553ac2a23dd1db4d11949c1ac43c3dd1367 /actionview | |
parent | 60b67d76dc1d98e4269aac7705e9d8323eb42942 (diff) | |
download | rails-411ccbdab2608c62aabdb320d52cb02d446bb39c.tar.gz rails-411ccbdab2608c62aabdb320d52cb02d446bb39c.tar.bz2 rails-411ccbdab2608c62aabdb320d52cb02d446bb39c.zip |
remove redundant curlies from hash arguments
Diffstat (limited to 'actionview')
-rw-r--r-- | actionview/test/abstract_unit.rb | 2 | ||||
-rw-r--r-- | actionview/test/actionpack/controller/view_paths_test.rb | 4 | ||||
-rw-r--r-- | actionview/test/activerecord/polymorphic_routes_test.rb | 6 | ||||
-rw-r--r-- | actionview/test/template/date_helper_test.rb | 34 | ||||
-rw-r--r-- | actionview/test/template/digestor_test.rb | 2 | ||||
-rw-r--r-- | actionview/test/template/form_collections_helper_test.rb | 8 | ||||
-rw-r--r-- | actionview/test/template/form_helper_test.rb | 14 | ||||
-rw-r--r-- | actionview/test/template/form_options_helper_test.rb | 8 | ||||
-rw-r--r-- | actionview/test/template/form_tag_helper_test.rb | 30 | ||||
-rw-r--r-- | actionview/test/template/resolver_patterns_test.rb | 8 | ||||
-rw-r--r-- | actionview/test/template/tag_helper_test.rb | 14 | ||||
-rw-r--r-- | actionview/test/template/testing/fixture_resolver_test.rb | 4 | ||||
-rw-r--r-- | actionview/test/template/testing/null_resolver_test.rb | 2 |
13 files changed, 64 insertions, 72 deletions
diff --git a/actionview/test/abstract_unit.rb b/actionview/test/abstract_unit.rb index 26b72a09e8..92989dfbe8 100644 --- a/actionview/test/abstract_unit.rb +++ b/actionview/test/abstract_unit.rb @@ -137,7 +137,7 @@ class BasicController config.assets_dir = public_dir config.javascripts_dir = "#{public_dir}/javascripts" config.stylesheets_dir = "#{public_dir}/stylesheets" - config.assets = ActiveSupport::InheritableOptions.new({ prefix: "assets" }) + config.assets = ActiveSupport::InheritableOptions.new(prefix: "assets") config end end diff --git a/actionview/test/actionpack/controller/view_paths_test.rb b/actionview/test/actionpack/controller/view_paths_test.rb index 0ce515bba5..e676a2ecd4 100644 --- a/actionview/test/actionpack/controller/view_paths_test.rb +++ b/actionview/test/actionpack/controller/view_paths_test.rb @@ -131,10 +131,8 @@ class ViewLoadPathsTest < ActionController::TestCase "Decorated body", template.identifier, template.handler, - { - virtual_path: template.virtual_path, + virtual_path: template.virtual_path, format: template.formats - } ) end end diff --git a/actionview/test/activerecord/polymorphic_routes_test.rb b/actionview/test/activerecord/polymorphic_routes_test.rb index 1aac4b9c56..952ed72aa9 100644 --- a/actionview/test/activerecord/polymorphic_routes_test.rb +++ b/actionview/test/activerecord/polymorphic_routes_test.rb @@ -179,7 +179,7 @@ class PolymorphicRoutesTest < ActionController::TestCase def test_with_nil_id with_test_routes do exception = assert_raise ArgumentError do - polymorphic_url({ id: nil }) + polymorphic_url(id: nil) end assert_equal "Nil location provided. Can't build URI.", exception.message end @@ -233,8 +233,8 @@ class PolymorphicRoutesTest < ActionController::TestCase def test_class_with_options with_test_routes do - assert_equal "http://example.com/projects?foo=bar", polymorphic_url(@project.class, { foo: :bar }) - assert_equal "/projects?foo=bar", polymorphic_path(@project.class, { foo: :bar }) + assert_equal "http://example.com/projects?foo=bar", polymorphic_url(@project.class, foo: :bar) + assert_equal "/projects?foo=bar", polymorphic_path(@project.class, foo: :bar) end end diff --git a/actionview/test/template/date_helper_test.rb b/actionview/test/template/date_helper_test.rb index c74e3549bf..0f1f22c43a 100644 --- a/actionview/test/template/date_helper_test.rb +++ b/actionview/test/template/date_helper_test.rb @@ -667,7 +667,7 @@ class DateHelperTest < ActionView::TestCase expected << %(<option value=""></option>\n<option value="00">00</option>\n<option value="15">15</option>\n<option value="30">30</option>\n<option value="45">45</option>\n) expected << "</select>\n" - assert_dom_equal expected, select_minute(Time.mktime(2003, 8, 16, 8, 4, 18), { include_blank: true , minute_step: 15 }) + assert_dom_equal expected, select_minute(Time.mktime(2003, 8, 16, 8, 4, 18), include_blank: true , minute_step: 15) end def test_select_minute_nil_with_blank @@ -683,7 +683,7 @@ class DateHelperTest < ActionView::TestCase expected << %(<option value=""></option>\n<option value="00">00</option>\n<option value="15">15</option>\n<option value="30">30</option>\n<option value="45">45</option>\n) expected << "</select>\n" - assert_dom_equal expected, select_minute(nil, { include_blank: true , minute_step: 15 }) + assert_dom_equal expected, select_minute(nil, include_blank: true , minute_step: 15) end def test_select_minute_with_hidden @@ -1066,7 +1066,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), { date_separator: " / ", start_year: 2003, end_year: 2005, prefix: "date[first]"}) + assert_dom_equal expected, select_date(Time.mktime(2003, 8, 16), date_separator: " / ", start_year: 2003, end_year: 2005, prefix: "date[first]") end def test_select_date_with_separator_and_discard_day @@ -1082,7 +1082,7 @@ class DateHelperTest < ActionView::TestCase expected << %(<input type="hidden" id="date_first_day" name="date[first][day]" value="1" />\n) - assert_dom_equal expected, select_date(Time.mktime(2003, 8, 16), { date_separator: " / ", discard_day: true, start_year: 2003, end_year: 2005, prefix: "date[first]"}) + assert_dom_equal expected, select_date(Time.mktime(2003, 8, 16), date_separator: " / ", discard_day: true, start_year: 2003, end_year: 2005, prefix: "date[first]") end def test_select_date_with_separator_discard_month_and_day @@ -1093,7 +1093,7 @@ class DateHelperTest < ActionView::TestCase expected << %(<input type="hidden" id="date_first_month" name="date[first][month]" value="8" />\n) expected << %(<input type="hidden" id="date_first_day" name="date[first][day]" value="1" />\n) - assert_dom_equal expected, select_date(Time.mktime(2003, 8, 16), { date_separator: " / ", discard_month: true, discard_day: true, start_year: 2003, end_year: 2005, prefix: "date[first]"}) + assert_dom_equal expected, select_date(Time.mktime(2003, 8, 16), date_separator: " / ", discard_month: true, discard_day: true, start_year: 2003, end_year: 2005, prefix: "date[first]") end def test_select_date_with_hidden @@ -1101,8 +1101,8 @@ class DateHelperTest < ActionView::TestCase expected << %(<input id="date_first_month" name="date[first][month]" type="hidden" value="8" />\n) expected << %(<input id="date_first_day" name="date[first][day]" type="hidden" value="16" />\n) - assert_dom_equal expected, select_date(Time.mktime(2003, 8, 16), { prefix: "date[first]", use_hidden: true }) - assert_dom_equal expected, select_date(Time.mktime(2003, 8, 16), { date_separator: " / ", prefix: "date[first]", use_hidden: true }) + assert_dom_equal expected, select_date(Time.mktime(2003, 8, 16), prefix: "date[first]", use_hidden: true) + assert_dom_equal expected, select_date(Time.mktime(2003, 8, 16), date_separator: " / ", prefix: "date[first]", use_hidden: true) end def test_select_date_with_css_classes_option @@ -1118,7 +1118,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}) + assert_dom_equal expected, select_date(Time.mktime(2003, 8, 16), start_year: 2003, end_year: 2005, prefix: "date[first]", with_css_classes: true) end def test_select_date_with_custom_with_css_classes @@ -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 @@ -1198,7 +1198,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 }, { class: "date optional custom-grid" }) + assert_dom_equal expected, select_date(Time.mktime(2003, 8, 16), { start_year: 2003, end_year: 2005 }, class: "date optional custom-grid") end def test_select_datetime @@ -2201,7 +2201,7 @@ class DateHelperTest < ActionView::TestCase expected << "</select>\n" - assert_dom_equal expected, date_select("post", "written_on", { date_separator: " / " }) + assert_dom_equal expected, date_select("post", "written_on", date_separator: " / ") end def test_date_select_with_separator_and_order @@ -2224,7 +2224,7 @@ class DateHelperTest < ActionView::TestCase expected << %{<option value="1999">1999</option>\n<option value="2000">2000</option>\n<option value="2001">2001</option>\n<option value="2002">2002</option>\n<option value="2003">2003</option>\n<option value="2004" selected="selected">2004</option>\n<option value="2005">2005</option>\n<option value="2006">2006</option>\n<option value="2007">2007</option>\n<option value="2008">2008</option>\n<option value="2009">2009</option>\n} expected << "</select>\n" - assert_dom_equal expected, date_select("post", "written_on", { order: [:day, :month, :year], date_separator: " / " }) + assert_dom_equal expected, date_select("post", "written_on", order: [:day, :month, :year], date_separator: " / ") end def test_date_select_with_separator_and_order_and_year_discarded @@ -2242,7 +2242,7 @@ class DateHelperTest < ActionView::TestCase expected << "</select>\n" expected << %{<input type="hidden" id="post_written_on_1i" name="post[written_on(1i)]" value="2004" />\n} - assert_dom_equal expected, date_select("post", "written_on", { order: [:day, :month, :year], discard_year: true, date_separator: " / " }) + assert_dom_equal expected, date_select("post", "written_on", order: [:day, :month, :year], discard_year: true, date_separator: " / ") end def test_date_select_with_default_prompt @@ -2486,7 +2486,7 @@ class DateHelperTest < ActionView::TestCase 0.upto(59) { |i| expected << %(<option value="#{sprintf("%02d", i)}"#{' selected="selected"' if i == 35}>#{sprintf("%02d", i)}</option>\n) } expected << "</select>\n" - assert_dom_equal expected, time_select("post", "written_on", { time_separator: " - ", include_seconds: true }) + assert_dom_equal expected, time_select("post", "written_on", time_separator: " - ", include_seconds: true) end def test_time_select_with_default_prompt @@ -2773,7 +2773,7 @@ class DateHelperTest < ActionView::TestCase 0.upto(59) { |i| expected << %(<option value="#{sprintf("%02d", i)}"#{' selected="selected"' if i == 35}>#{sprintf("%02d", i)}</option>\n) } expected << "</select>\n" - assert_dom_equal expected, datetime_select("post", "updated_at", { date_separator: " / ", datetime_separator: " , ", time_separator: " - ", include_seconds: true }) + assert_dom_equal expected, datetime_select("post", "updated_at", date_separator: " / ", datetime_separator: " , ", time_separator: " - ", include_seconds: true) end def test_datetime_select_with_integer diff --git a/actionview/test/template/digestor_test.rb b/actionview/test/template/digestor_test.rb index 7547026dd1..dec75268aa 100644 --- a/actionview/test/template/digestor_test.rb +++ b/actionview/test/template/digestor_test.rb @@ -216,7 +216,7 @@ class TemplateDigestorTest < ActionView::TestCase def test_details_are_included_in_cache_key # Cache the template digest. - @finder = FixtureFinder.new({formats: [:html]}) + @finder = FixtureFinder.new(formats: [:html]) old_digest = digest("events/_event") # Change the template; the cached digest remains unchanged. diff --git a/actionview/test/template/form_collections_helper_test.rb b/actionview/test/template/form_collections_helper_test.rb index 10f7ce90ee..9eb4d8f58f 100644 --- a/actionview/test/template/form_collections_helper_test.rb +++ b/actionview/test/template/form_collections_helper_test.rb @@ -207,14 +207,14 @@ class FormCollectionsHelperTest < ActionView::TestCase test "collection radio buttons generates a hidden field using the given :name in :html_options" do collection = [Category.new(1, "Category 1"), Category.new(2, "Category 2")] - with_collection_radio_buttons :user, :category_ids, collection, :id, :name, {}, { name: "user[other_category_ids]" } + with_collection_radio_buttons :user, :category_ids, collection, :id, :name, {}, name: "user[other_category_ids]" assert_select "input[type=hidden][name='user[other_category_ids]'][value='']", count: 1 end test "collection radio buttons generates a hidden field with index if it was provided" do collection = [Category.new(1, "Category 1"), Category.new(2, "Category 2")] - with_collection_radio_buttons :user, :category_ids, collection, :id, :name, { index: 322 } + with_collection_radio_buttons :user, :category_ids, collection, :id, :name, index: 322 assert_select "input[type=hidden][name='user[322][category_ids]'][value='']", count: 1 end @@ -251,14 +251,14 @@ class FormCollectionsHelperTest < ActionView::TestCase test "collection check boxes generates a hidden field using the given :name in :html_options" do collection = [Category.new(1, "Category 1"), Category.new(2, "Category 2")] - with_collection_check_boxes :user, :category_ids, collection, :id, :name, {}, {name: "user[other_category_ids][]"} + with_collection_check_boxes :user, :category_ids, collection, :id, :name, {}, name: "user[other_category_ids][]" assert_select "input[type=hidden][name='user[other_category_ids][]'][value='']", count: 1 end test "collection check boxes generates a hidden field with index if it was provided" do collection = [Category.new(1, "Category 1"), Category.new(2, "Category 2")] - with_collection_check_boxes :user, :category_ids, collection, :id, :name, { index: 322 } + with_collection_check_boxes :user, :category_ids, collection, :id, :name, index: 322 assert_select "input[type=hidden][name='user[322][category_ids][]'][value='']", count: 1 end diff --git a/actionview/test/template/form_helper_test.rb b/actionview/test/template/form_helper_test.rb index e40b104c8d..716cb3a00a 100644 --- a/actionview/test/template/form_helper_test.rb +++ b/actionview/test/template/form_helper_test.rb @@ -16,8 +16,7 @@ class FormHelperTest < ActionView::TestCase setup do # Create "label" locale for testing I18n label helpers - I18n.backend.store_translations "label", { - activemodel: { + I18n.backend.store_translations "label", activemodel: { attributes: { post: { cost: "Total cost" @@ -46,11 +45,9 @@ class FormHelperTest < ActionView::TestCase } } } - } # Create "submit" locale for testing I18n submit helpers - I18n.backend.store_translations "submit", { - helpers: { + I18n.backend.store_translations "submit", helpers: { submit: { create: "Create %{model}", update: "Confirm %{model} changes", @@ -60,10 +57,8 @@ class FormHelperTest < ActionView::TestCase } } } - } - I18n.backend.store_translations "placeholder", { - activemodel: { + I18n.backend.store_translations "placeholder", activemodel: { attributes: { post: { cost: "Total cost" @@ -92,7 +87,6 @@ class FormHelperTest < ActionView::TestCase } } } - } @post = Post.new @comment = Comment.new @@ -776,7 +770,7 @@ class FormHelperTest < ActionView::TestCase def test_checkbox_disabled_disables_hidden_field assert_dom_equal( '<input name="post[secret]" type="hidden" value="0" disabled="disabled"/><input checked="checked" disabled="disabled" id="post_secret" name="post[secret]" type="checkbox" value="1" />', - check_box("post", "secret", { disabled: true }) + check_box("post", "secret", disabled: true) ) end diff --git a/actionview/test/template/form_options_helper_test.rb b/actionview/test/template/form_options_helper_test.rb index 948887742d..69c43dacb0 100644 --- a/actionview/test/template/form_options_helper_test.rb +++ b/actionview/test/template/form_options_helper_test.rb @@ -388,7 +388,7 @@ class FormOptionsHelperTest < ActionView::TestCase def test_optgroups_with_with_options_with_hash assert_dom_equal( "<optgroup label=\"North America\"><option value=\"United States\">United States</option>\n<option value=\"Canada\">Canada</option></optgroup><optgroup label=\"Europe\"><option value=\"Denmark\">Denmark</option>\n<option value=\"Germany\">Germany</option></optgroup>", - grouped_options_for_select({"North America" => ["United States","Canada"], "Europe" => ["Denmark","Germany"]}) + grouped_options_for_select("North America" => ["United States","Canada"], "Europe" => ["Denmark","Germany"]) ) end @@ -752,7 +752,7 @@ class FormOptionsHelperTest < ActionView::TestCase @post.category = "" assert_dom_equal( "<select class=\"disabled\" disabled=\"disabled\" name=\"post[category]\" id=\"post_category\"><option value=\"\">Please select</option>\n<option value=\"\"></option>\n</select>", - select("post", "category", [], { prompt: true, include_blank: true }, { class: "disabled", disabled: true }) + select("post", "category", [], { prompt: true, include_blank: true }, class: "disabled", disabled: true) ) end @@ -842,7 +842,7 @@ class FormOptionsHelperTest < ActionView::TestCase assert_dom_equal( expected, - select("album[]", "genre", %w[rap rock country], {}, { index: nil }) + select("album[]", "genre", %w[rap rock country], {}, index: nil) ) end @@ -997,7 +997,7 @@ class FormOptionsHelperTest < ActionView::TestCase assert_dom_equal( %{<select id="post_author_name" name="post[author_name]"><option value=""></option>\n<option value="<Abe>" selected="selected"><Abe></option>\n<option value="Babe">Babe</option>\n<option value="Cabe">Cabe</option></select>}, - collection_select("post", "author_name", dummy_posts, "author_name", "author_name", {include_blank: true, selected: "<Abe>"}) + collection_select("post", "author_name", dummy_posts, "author_name", "author_name", include_blank: true, selected: "<Abe>") ) end diff --git a/actionview/test/template/form_tag_helper_test.rb b/actionview/test/template/form_tag_helper_test.rb index f94dd21c71..603fddc09e 100644 --- a/actionview/test/template/form_tag_helper_test.rb +++ b/actionview/test/template/form_tag_helper_test.rb @@ -88,25 +88,25 @@ class FormTagHelperTest < ActionView::TestCase end def test_form_tag_multipart - actual = form_tag({}, { "multipart" => true }) + actual = form_tag({}, "multipart" => true) expected = whole_form("http://www.example.com", enctype: true) assert_dom_equal expected, actual end def test_form_tag_with_method_patch - actual = form_tag({}, { method: :patch }) + actual = form_tag({}, method: :patch) expected = whole_form("http://www.example.com", method: :patch) assert_dom_equal expected, actual end def test_form_tag_with_method_put - actual = form_tag({}, { method: :put }) + actual = form_tag({}, method: :put) expected = whole_form("http://www.example.com", method: :put) assert_dom_equal expected, actual end def test_form_tag_with_method_delete - actual = form_tag({}, { method: :delete }) + actual = form_tag({}, method: :delete) expected = whole_form("http://www.example.com", method: :delete) assert_dom_equal expected, actual @@ -127,14 +127,14 @@ class FormTagHelperTest < ActionView::TestCase end def test_form_tag_enforce_utf8_true - actual = form_tag({}, { enforce_utf8: true }) + actual = form_tag({}, enforce_utf8: true) expected = whole_form("http://www.example.com", enforce_utf8: true) assert_dom_equal expected, actual assert actual.html_safe? end def test_form_tag_enforce_utf8_false - actual = form_tag({}, { enforce_utf8: false }) + actual = form_tag({}, enforce_utf8: false) expected = whole_form("http://www.example.com", enforce_utf8: false) assert_dom_equal expected, actual assert actual.html_safe? @@ -471,21 +471,21 @@ class FormTagHelperTest < ActionView::TestCase def test_submit_tag_having_data_disable_with_string assert_dom_equal( %(<input data-disable-with="Processing..." data-confirm="Are you sure?" name='commit' type="submit" value="Save" />), - submit_tag("Save", { "data-disable-with" => "Processing...", "data-confirm" => "Are you sure?" }) + submit_tag("Save", "data-disable-with" => "Processing...", "data-confirm" => "Are you sure?") ) end def test_submit_tag_having_data_disable_with_boolean assert_dom_equal( %(<input data-confirm="Are you sure?" name='commit' type="submit" value="Save" />), - submit_tag("Save", { "data-disable-with" => false, "data-confirm" => "Are you sure?" }) + submit_tag("Save", "data-disable-with" => false, "data-confirm" => "Are you sure?") ) end def test_submit_tag_having_data_hash_disable_with_boolean assert_dom_equal( %(<input data-confirm="Are you sure?" name='commit' type="submit" value="Save" />), - submit_tag("Save", { data: { confirm: "Are you sure?", disable_with: false } }) + submit_tag("Save", data: { confirm: "Are you sure?", disable_with: false }) ) end @@ -506,7 +506,7 @@ class FormTagHelperTest < ActionView::TestCase def test_submit_tag_doesnt_have_data_disable_with_twice assert_equal( %(<input type="submit" name="commit" value="Save" data-confirm="Are you sure?" data-disable-with="Processing..." />), - submit_tag("Save", { "data-disable-with" => "Processing...", "data-confirm" => "Are you sure?" }) + submit_tag("Save", "data-disable-with" => "Processing...", "data-confirm" => "Are you sure?") ) end @@ -695,31 +695,31 @@ class FormTagHelperTest < ActionView::TestCase def test_text_area_tag_options_symbolize_keys_side_effects options = { option: "random_option" } text_area_tag "body", "hello world", options - assert_equal options, { option: "random_option" } + assert_equal options, option: "random_option" end def test_submit_tag_options_symbolize_keys_side_effects options = { option: "random_option" } submit_tag "submit value", options - assert_equal options, { option: "random_option" } + assert_equal options, option: "random_option" end def test_button_tag_options_symbolize_keys_side_effects options = { option: "random_option" } button_tag "button value", options - assert_equal options, { option: "random_option" } + assert_equal options, option: "random_option" end def test_image_submit_tag_options_symbolize_keys_side_effects options = { option: "random_option" } image_submit_tag "submit source", options - assert_equal options, { option: "random_option" } + assert_equal options, option: "random_option" end def test_image_label_tag_options_symbolize_keys_side_effects options = { option: "random_option" } label_tag "submit source", "title", options - assert_equal options, { option: "random_option" } + assert_equal options, option: "random_option" end def protect_against_forgery? diff --git a/actionview/test/template/resolver_patterns_test.rb b/actionview/test/template/resolver_patterns_test.rb index 2a4a0da197..43e3f21076 100644 --- a/actionview/test/template/resolver_patterns_test.rb +++ b/actionview/test/template/resolver_patterns_test.rb @@ -8,12 +8,12 @@ class ResolverPatternsTest < ActiveSupport::TestCase end def test_should_return_empty_list_for_unknown_path - templates = @resolver.find_all("unknown", "custom_pattern", false, {locale: [], formats: [:html], variants: [], handlers: [:erb]}) + templates = @resolver.find_all("unknown", "custom_pattern", false, locale: [], formats: [:html], variants: [], handlers: [:erb]) assert_equal [], templates, "expected an empty list of templates" end def test_should_return_template_for_declared_path - templates = @resolver.find_all("path", "custom_pattern", false, {locale: [], formats: [:html], variants: [], handlers: [:erb]}) + templates = @resolver.find_all("path", "custom_pattern", false, locale: [], formats: [:html], variants: [], handlers: [:erb]) assert_equal 1, templates.size, "expected one template" assert_equal "Hello custom patterns!", templates.first.source assert_equal "custom_pattern/path", templates.first.virtual_path @@ -21,7 +21,7 @@ class ResolverPatternsTest < ActiveSupport::TestCase end def test_should_return_all_templates_when_ambiguous_pattern - templates = @resolver.find_all("another", "custom_pattern", false, {locale: [], formats: [:html], variants: [], handlers: [:erb]}) + templates = @resolver.find_all("another", "custom_pattern", false, locale: [], formats: [:html], variants: [], handlers: [:erb]) assert_equal 2, templates.size, "expected two templates" assert_equal "Another template!", templates[0].source assert_equal "custom_pattern/another", templates[0].virtual_path @@ -30,7 +30,7 @@ class ResolverPatternsTest < ActiveSupport::TestCase end def test_should_return_all_variants_for_any - templates = @resolver.find_all("hello_world", "test", false, {locale: [], formats: [:html, :text], variants: :any, handlers: [:erb]}) + templates = @resolver.find_all("hello_world", "test", false, locale: [], formats: [:html, :text], variants: :any, handlers: [:erb]) assert_equal 3, templates.size, "expected three templates" assert_equal "Hello phone!", templates[0].source assert_equal "test/hello_world", templates[0].virtual_path diff --git a/actionview/test/template/tag_helper_test.rb b/actionview/test/template/tag_helper_test.rb index 5b67b657be..4e691c9490 100644 --- a/actionview/test/template/tag_helper_test.rb +++ b/actionview/test/template/tag_helper_test.rb @@ -211,7 +211,7 @@ class TagHelperTest < ActionView::TestCase end def test_content_tag_with_empty_array_class - str = content_tag("p", "limelight", {class: []}) + str = content_tag("p", "limelight", class: []) assert_equal '<p class="">limelight</p>', str end @@ -296,7 +296,7 @@ class TagHelperTest < ActionView::TestCase 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"' }) } @@ -305,21 +305,21 @@ class TagHelperTest < ActionView::TestCase 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"' }) } 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_type1 = 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_type1 = 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/testing/fixture_resolver_test.rb b/actionview/test/template/testing/fixture_resolver_test.rb index 4ae4324860..effe453fc0 100644 --- a/actionview/test/template/testing/fixture_resolver_test.rb +++ b/actionview/test/template/testing/fixture_resolver_test.rb @@ -3,13 +3,13 @@ require "abstract_unit" class FixtureResolverTest < ActiveSupport::TestCase def test_should_return_empty_list_for_unknown_path resolver = ActionView::FixtureResolver.new() - templates = resolver.find_all("path", "arbitrary", false, {locale: [], formats: [:html], variants: [], handlers: []}) + templates = resolver.find_all("path", "arbitrary", false, locale: [], formats: [:html], variants: [], handlers: []) assert_equal [], templates, "expected an empty list of templates" end def test_should_return_template_for_declared_path resolver = ActionView::FixtureResolver.new("arbitrary/path.erb" => "this text") - templates = resolver.find_all("path", "arbitrary", false, {locale: [], formats: [:html], variants: [], handlers: [:erb]}) + templates = resolver.find_all("path", "arbitrary", false, locale: [], formats: [:html], variants: [], handlers: [:erb]) assert_equal 1, templates.size, "expected one template" assert_equal "this text", templates.first.source assert_equal "arbitrary/path", templates.first.virtual_path diff --git a/actionview/test/template/testing/null_resolver_test.rb b/actionview/test/template/testing/null_resolver_test.rb index 907431389c..5346fd3368 100644 --- a/actionview/test/template/testing/null_resolver_test.rb +++ b/actionview/test/template/testing/null_resolver_test.rb @@ -3,7 +3,7 @@ require "abstract_unit" class NullResolverTest < ActiveSupport::TestCase def test_should_return_template_for_any_path resolver = ActionView::NullResolver.new() - templates = resolver.find_all("path.erb", "arbitrary", false, {locale: [], formats: [:html], handlers: []}) + templates = resolver.find_all("path.erb", "arbitrary", false, locale: [], formats: [:html], handlers: []) assert_equal 1, templates.size, "expected one template" assert_equal "Template generated by Null Resolver", templates.first.source assert_equal "arbitrary/path.erb", templates.first.virtual_path.to_s |