Skip to content
This repository
Browse code

Fix failing tests and use new hash style in deprecation messages

  • Loading branch information...
commit 008154e23705e732f5fa5292aa60605efb92d163 1 parent d1c95d9
Carlos Antonio da Silva authored October 29, 2012
2  actionpack/lib/action_view/helpers/form_options_helper.rb
@@ -519,7 +519,7 @@ def grouped_options_for_select(grouped_options, selected_key = nil, options = {}
519 519
         else
520 520
           prompt  = options
521 521
           options = {}
522  
-          message = "Passing the prompt to grouped_options_for_select as an argument is deprecated. " /
  522
+          message = "Passing the prompt to grouped_options_for_select as an argument is deprecated. " \
523 523
                     "Please use an options hash like `{ prompt: #{prompt.inspect} }`."
524 524
           ActiveSupport::Deprecation.warn(message, caller)
525 525
         end
20  actionpack/lib/action_view/helpers/form_tag_helper.rb
@@ -425,16 +425,16 @@ def submit_tag(value = "Save changes", options = {})
425 425
         options = options.stringify_keys
426 426
 
427 427
         if disable_with = options.delete("disable_with")
428  
-          message = ":disable_with option is deprecated and will be removed from Rails 4.1. " /
429  
-                    "Use ':data => { :disable_with => \'Text\' }' instead."
  428
+          message = ":disable_with option is deprecated and will be removed from Rails 4.1. " \
  429
+                    "Use 'data: { disable_with: \'Text\' }' instead."
430 430
           ActiveSupport::Deprecation.warn(message, caller)
431 431
 
432 432
           options["data-disable-with"] = disable_with
433 433
         end
434 434
 
435 435
         if confirm = options.delete("confirm")
436  
-          message = ":confirm option is deprecated and will be removed from Rails 4.1. " /
437  
-                    "Use ':data => { :confirm => \'Text\' }' instead'."
  436
+          message = ":confirm option is deprecated and will be removed from Rails 4.1. " \
  437
+                    "Use 'data: { confirm: \'Text\' }' instead'."
438 438
           ActiveSupport::Deprecation.warn(message, caller)
439 439
 
440 440
           options["data-confirm"] = confirm
@@ -487,16 +487,16 @@ def button_tag(content_or_options = nil, options = nil, &block)
487 487
         options = options.stringify_keys
488 488
 
489 489
         if disable_with = options.delete("disable_with")
490  
-          message = ":disable_with option is deprecated and will be removed from Rails 4.1. " /
491  
-                    "Use ':data => { :disable_with => \'Text\' }' instead."
  490
+          message = ":disable_with option is deprecated and will be removed from Rails 4.1. " \
  491
+                    "Use 'data: { disable_with: \'Text\' }' instead."
492 492
           ActiveSupport::Deprecation.warn(message, caller)
493 493
 
494 494
           options["data-disable-with"] = disable_with
495 495
         end
496 496
 
497 497
         if confirm = options.delete("confirm")
498  
-          message = ":confirm option is deprecated and will be removed from Rails 4.1. " /
499  
-                    "Use ':data => { :confirm => \'Text\' }' instead'."
  498
+          message = ":confirm option is deprecated and will be removed from Rails 4.1. " \
  499
+                    "Use 'data: { confirm: \'Text\' }' instead'."
500 500
           ActiveSupport::Deprecation.warn(message, caller)
501 501
 
502 502
           options["data-confirm"] = confirm
@@ -541,8 +541,8 @@ def image_submit_tag(source, options = {})
541 541
         options = options.stringify_keys
542 542
 
543 543
         if confirm = options.delete("confirm")
544  
-          message = ":confirm option is deprecated and will be removed from Rails 4.1. " /
545  
-                    "Use ':data => { :confirm => \'Text\' }' instead'."
  544
+          message = ":confirm option is deprecated and will be removed from Rails 4.1. " \
  545
+                    "Use 'data: { confirm: \'Text\' }' instead'."
546 546
           ActiveSupport::Deprecation.warn(message, caller)
547 547
 
548 548
           options["data-confirm"] = confirm
8  actionpack/lib/action_view/helpers/url_helper.rb
@@ -577,8 +577,8 @@ def convert_options_to_data_attributes(options, html_options)
577 577
             method  = html_options.delete('method')
578 578
 
579 579
             if confirm
580  
-              message = ":confirm option is deprecated and will be removed from Rails 4.1. " /
581  
-                        "Use ':data => { :confirm => \'Text\' }' instead."
  580
+              message = ":confirm option is deprecated and will be removed from Rails 4.1. " \
  581
+                        "Use 'data: { confirm: \'Text\' }' instead."
582 582
               ActiveSupport::Deprecation.warn(message, caller)
583 583
 
584 584
               html_options["data-confirm"] = confirm
@@ -587,8 +587,8 @@ def convert_options_to_data_attributes(options, html_options)
587 587
             add_method_to_attributes!(html_options, method) if method
588 588
 
589 589
             if disable_with
590  
-              message = ":disable_with option is deprecated and will be removed from Rails 4.1. " /
591  
-                        "Use ':data => { :disable_with => \'Text\' }' instead."
  590
+              message = ":disable_with option is deprecated and will be removed from Rails 4.1. " \
  591
+                        "Use 'data: { disable_with: \'Text\' }' instead."
592 592
               ActiveSupport::Deprecation.warn(message, caller)
593 593
 
594 594
               html_options["data-disable-with"] = disable_with
2  actionpack/lib/action_view/template/resolver.rb
@@ -235,7 +235,7 @@ def extract_handler_and_format(path, default_formats)
235 235
 
236 236
       extension = pieces.pop
237 237
       unless extension
238  
-        message = "The file #{path} did not specify a template handler. The default is currently ERB, " /
  238
+        message = "The file #{path} did not specify a template handler. The default is currently ERB, " \
239 239
                   "but will change to RAW in the future."
240 240
         ActiveSupport::Deprecation.warn(message, caller)
241 241
       end
6  actionpack/test/template/form_tag_helper_test.rb
@@ -411,7 +411,7 @@ def test_submit_tag_with_confirmation
411 411
   end
412 412
 
413 413
   def test_submit_tag_with_deprecated_confirmation
414  
-    assert_deprecated ":confirm option is deprecated and will be removed from Rails 4.1. Use ':data => { :confirm => \'Text\' }' instead" do
  414
+    assert_deprecated ":confirm option is deprecated and will be removed from Rails 4.1. Use 'data: { confirm: \'Text\' }' instead" do
415 415
       assert_dom_equal(
416 416
         %(<input name='commit' type='submit' value='Save' data-confirm="Are you sure?" />),
417 417
         submit_tag("Save", :confirm => "Are you sure?")
@@ -478,7 +478,7 @@ def test_button_tag_with_confirmation
478 478
   end
479 479
 
480 480
   def test_button_tag_with_deprecated_confirmation
481  
-    assert_deprecated ":confirm option is deprecated and will be removed from Rails 4.1. Use ':data => { :confirm => \'Text\' }' instead" do
  481
+    assert_deprecated ":confirm option is deprecated and will be removed from Rails 4.1. Use 'data: { confirm: \'Text\' }' instead" do
482 482
       assert_dom_equal(
483 483
         %(<button name="button" type="submit" data-confirm="Are you sure?">Save</button>),
484 484
         button_tag("Save", :type => "submit", :confirm => "Are you sure?")
@@ -494,7 +494,7 @@ def test_image_submit_tag_with_confirmation
494 494
   end
495 495
 
496 496
   def test_image_submit_tag_with_deprecated_confirmation
497  
-    assert_deprecated ":confirm option is deprecated and will be removed from Rails 4.1. Use ':data => { :confirm => \'Text\' }' instead" do
  497
+    assert_deprecated ":confirm option is deprecated and will be removed from Rails 4.1. Use 'data: { confirm: \'Text\' }' instead" do
498 498
       assert_dom_equal(
499 499
         %(<input type="image" src="/images/save.gif" data-confirm="Are you sure?" />),
500 500
         image_submit_tag("save.gif", :confirm => "Are you sure?")
18  actionpack/test/template/url_helper_test.rb
@@ -95,7 +95,7 @@ def test_button_to_with_javascript_confirm
95 95
   end
96 96
 
97 97
   def test_button_to_with_deprecated_confirm
98  
-    assert_deprecated ":confirm option is deprecated and will be removed from Rails 4.1. Use ':data => { :confirm => \'Text\' }' instead" do
  98
+    assert_deprecated ":confirm option is deprecated and will be removed from Rails 4.1. Use 'data: { confirm: \'Text\' }' instead" do
99 99
       assert_dom_equal(
100 100
         %{<form method="post" action="http://www.example.com" class="button_to"><div><input data-confirm="Are you sure?" type="submit" value="Hello" /></div></form>},
101 101
         button_to("Hello", "http://www.example.com", confirm: "Are you sure?")
@@ -111,7 +111,7 @@ def test_button_to_with_javascript_disable_with
111 111
   end
112 112
 
113 113
   def test_button_to_with_javascript_deprecated_disable_with
114  
-    assert_deprecated ":disable_with option is deprecated and will be removed from Rails 4.1. Use ':data => { :disable_with => \'Text\' }' instead" do
  114
+    assert_deprecated ":disable_with option is deprecated and will be removed from Rails 4.1. Use 'data: { disable_with: \'Text\' }' instead" do
115 115
       assert_dom_equal(
116 116
         %{<form method="post" action="http://www.example.com" class="button_to"><div><input data-disable-with="Greeting..." type="submit" value="Hello" /></div></form>},
117 117
         button_to("Hello", "http://www.example.com", disable_with: "Greeting...")
@@ -134,7 +134,7 @@ def test_button_to_with_remote_and_javascript_confirm
134 134
   end
135 135
 
136 136
   def test_button_to_with_remote_and_javascript_with_deprecated_confirm
137  
-    assert_deprecated ":confirm option is deprecated and will be removed from Rails 4.1. Use ':data => { :confirm => \'Text\' }' instead" do
  137
+    assert_deprecated ":confirm option is deprecated and will be removed from Rails 4.1. Use 'data: { confirm: \'Text\' }' instead" do
138 138
       assert_dom_equal(
139 139
         %{<form method="post" action="http://www.example.com" class="button_to" data-remote="true"><div><input data-confirm="Are you sure?" type="submit" value="Hello" /></div></form>},
140 140
         button_to("Hello", "http://www.example.com", remote: true, confirm: "Are you sure?")
@@ -150,7 +150,7 @@ def test_button_to_with_remote_and_javascript_disable_with
150 150
   end
151 151
 
152 152
   def test_button_to_with_remote_and_javascript_deprecated_disable_with
153  
-    assert_deprecated ":disable_with option is deprecated and will be removed from Rails 4.1. Use ':data => { :disable_with => \'Text\' }' instead" do
  153
+    assert_deprecated ":disable_with option is deprecated and will be removed from Rails 4.1. Use 'data: { disable_with: \'Text\' }' instead" do
154 154
       assert_dom_equal(
155 155
         %{<form method="post" action="http://www.example.com" class="button_to" data-remote="true"><div><input data-disable-with="Greeting..." type="submit" value="Hello" /></div></form>},
156 156
         button_to("Hello", "http://www.example.com", remote: true, disable_with: "Greeting...")
@@ -267,19 +267,19 @@ def test_link_tag_with_javascript_confirm
267 267
   end
268 268
 
269 269
   def test_link_tag_with_deprecated_confirm
270  
-    assert_deprecated ":confirm option is deprecated and will be removed from Rails 4.1. Use ':data => { :confirm => \'Text\' }' instead" do
  270
+    assert_deprecated ":confirm option is deprecated and will be removed from Rails 4.1. Use 'data: { confirm: \'Text\' }' instead" do
271 271
       assert_dom_equal(
272 272
         %{<a href="http://www.example.com" data-confirm="Are you sure?">Hello</a>},
273 273
         link_to("Hello", "http://www.example.com", confirm: "Are you sure?")
274 274
       )
275 275
     end
276  
-    assert_deprecated ":confirm option is deprecated and will be removed from Rails 4.1. Use ':data => { :confirm => \'Text\' }' instead" do
  276
+    assert_deprecated ":confirm option is deprecated and will be removed from Rails 4.1. Use 'data: { confirm: \'Text\' }' instead" do
277 277
       assert_dom_equal(
278 278
         %{<a href="http://www.example.com" data-confirm="You cant possibly be sure, can you?">Hello</a>},
279 279
         link_to("Hello", "http://www.example.com", confirm: "You cant possibly be sure, can you?")
280 280
       )
281 281
     end
282  
-    assert_deprecated ":confirm option is deprecated and will be removed from Rails 4.1. Use ':data => { :confirm => \'Text\' }' instead" do
  282
+    assert_deprecated ":confirm option is deprecated and will be removed from Rails 4.1. Use 'data: { confirm: \'Text\' }' instead" do
283 283
       assert_dom_equal(
284 284
         %{<a href="http://www.example.com" data-confirm="You cant possibly be sure,\n can you?">Hello</a>},
285 285
         link_to("Hello", "http://www.example.com", confirm: "You cant possibly be sure,\n can you?")
@@ -351,7 +351,7 @@ def test_link_tag_using_post_javascript_and_confirm
351 351
   end
352 352
 
353 353
   def test_link_tag_using_post_javascript_and_with_deprecated_confirm
354  
-    assert_deprecated ":confirm option is deprecated and will be removed from Rails 4.1. Use ':data => { :confirm => \'Text\' }' instead" do
  354
+    assert_deprecated ":confirm option is deprecated and will be removed from Rails 4.1. Use 'data: { confirm: \'Text\' }' instead" do
355 355
       assert_dom_equal(
356 356
         %{<a href="http://www.example.com" data-method="post" rel="nofollow" data-confirm="Are you serious?">Hello</a>},
357 357
         link_to("Hello", "http://www.example.com", method: :post, confirm: "Are you serious?")
@@ -367,7 +367,7 @@ def test_link_tag_using_delete_javascript_and_href_and_confirm
367 367
   end
368 368
 
369 369
   def test_link_tag_using_delete_javascript_and_href_and_with_deprecated_confirm
370  
-    assert_deprecated ":confirm option is deprecated and will be removed from Rails 4.1. Use ':data => { :confirm => \'Text\' }' instead" do
  370
+    assert_deprecated ":confirm option is deprecated and will be removed from Rails 4.1. Use 'data: { confirm: \'Text\' }' instead" do
371 371
       assert_dom_equal(
372 372
         %{<a href="\#" rel="nofollow" data-confirm="Are you serious?" data-method="delete">Destroy</a>},
373 373
         link_to("Destroy", "http://www.example.com", method: :delete, href: '#', confirm: "Are you serious?")

0 notes on commit 008154e

Please sign in to comment.
Something went wrong with that request. Please try again.