Fix failing tests and use new hash style in deprecation messages
This commit is contained in:
parent
d1c95d912e
commit
008154e237
@ -519,7 +519,7 @@ def grouped_options_for_select(grouped_options, selected_key = nil, options = {}
|
|||||||
else
|
else
|
||||||
prompt = options
|
prompt = options
|
||||||
options = {}
|
options = {}
|
||||||
message = "Passing the prompt to grouped_options_for_select as an argument is deprecated. " /
|
message = "Passing the prompt to grouped_options_for_select as an argument is deprecated. " \
|
||||||
"Please use an options hash like `{ prompt: #{prompt.inspect} }`."
|
"Please use an options hash like `{ prompt: #{prompt.inspect} }`."
|
||||||
ActiveSupport::Deprecation.warn(message, caller)
|
ActiveSupport::Deprecation.warn(message, caller)
|
||||||
end
|
end
|
||||||
|
@ -425,16 +425,16 @@ def submit_tag(value = "Save changes", options = {})
|
|||||||
options = options.stringify_keys
|
options = options.stringify_keys
|
||||||
|
|
||||||
if disable_with = options.delete("disable_with")
|
if disable_with = options.delete("disable_with")
|
||||||
message = ":disable_with option is deprecated and will be removed from Rails 4.1. " /
|
message = ":disable_with option is deprecated and will be removed from Rails 4.1. " \
|
||||||
"Use ':data => { :disable_with => \'Text\' }' instead."
|
"Use 'data: { disable_with: \'Text\' }' instead."
|
||||||
ActiveSupport::Deprecation.warn(message, caller)
|
ActiveSupport::Deprecation.warn(message, caller)
|
||||||
|
|
||||||
options["data-disable-with"] = disable_with
|
options["data-disable-with"] = disable_with
|
||||||
end
|
end
|
||||||
|
|
||||||
if confirm = options.delete("confirm")
|
if confirm = options.delete("confirm")
|
||||||
message = ":confirm option is deprecated and will be removed from Rails 4.1. " /
|
message = ":confirm option is deprecated and will be removed from Rails 4.1. " \
|
||||||
"Use ':data => { :confirm => \'Text\' }' instead'."
|
"Use 'data: { confirm: \'Text\' }' instead'."
|
||||||
ActiveSupport::Deprecation.warn(message, caller)
|
ActiveSupport::Deprecation.warn(message, caller)
|
||||||
|
|
||||||
options["data-confirm"] = confirm
|
options["data-confirm"] = confirm
|
||||||
@ -487,16 +487,16 @@ def button_tag(content_or_options = nil, options = nil, &block)
|
|||||||
options = options.stringify_keys
|
options = options.stringify_keys
|
||||||
|
|
||||||
if disable_with = options.delete("disable_with")
|
if disable_with = options.delete("disable_with")
|
||||||
message = ":disable_with option is deprecated and will be removed from Rails 4.1. " /
|
message = ":disable_with option is deprecated and will be removed from Rails 4.1. " \
|
||||||
"Use ':data => { :disable_with => \'Text\' }' instead."
|
"Use 'data: { disable_with: \'Text\' }' instead."
|
||||||
ActiveSupport::Deprecation.warn(message, caller)
|
ActiveSupport::Deprecation.warn(message, caller)
|
||||||
|
|
||||||
options["data-disable-with"] = disable_with
|
options["data-disable-with"] = disable_with
|
||||||
end
|
end
|
||||||
|
|
||||||
if confirm = options.delete("confirm")
|
if confirm = options.delete("confirm")
|
||||||
message = ":confirm option is deprecated and will be removed from Rails 4.1. " /
|
message = ":confirm option is deprecated and will be removed from Rails 4.1. " \
|
||||||
"Use ':data => { :confirm => \'Text\' }' instead'."
|
"Use 'data: { confirm: \'Text\' }' instead'."
|
||||||
ActiveSupport::Deprecation.warn(message, caller)
|
ActiveSupport::Deprecation.warn(message, caller)
|
||||||
|
|
||||||
options["data-confirm"] = confirm
|
options["data-confirm"] = confirm
|
||||||
@ -541,8 +541,8 @@ def image_submit_tag(source, options = {})
|
|||||||
options = options.stringify_keys
|
options = options.stringify_keys
|
||||||
|
|
||||||
if confirm = options.delete("confirm")
|
if confirm = options.delete("confirm")
|
||||||
message = ":confirm option is deprecated and will be removed from Rails 4.1. " /
|
message = ":confirm option is deprecated and will be removed from Rails 4.1. " \
|
||||||
"Use ':data => { :confirm => \'Text\' }' instead'."
|
"Use 'data: { confirm: \'Text\' }' instead'."
|
||||||
ActiveSupport::Deprecation.warn(message, caller)
|
ActiveSupport::Deprecation.warn(message, caller)
|
||||||
|
|
||||||
options["data-confirm"] = confirm
|
options["data-confirm"] = confirm
|
||||||
|
@ -577,8 +577,8 @@ def convert_options_to_data_attributes(options, html_options)
|
|||||||
method = html_options.delete('method')
|
method = html_options.delete('method')
|
||||||
|
|
||||||
if confirm
|
if confirm
|
||||||
message = ":confirm option is deprecated and will be removed from Rails 4.1. " /
|
message = ":confirm option is deprecated and will be removed from Rails 4.1. " \
|
||||||
"Use ':data => { :confirm => \'Text\' }' instead."
|
"Use 'data: { confirm: \'Text\' }' instead."
|
||||||
ActiveSupport::Deprecation.warn(message, caller)
|
ActiveSupport::Deprecation.warn(message, caller)
|
||||||
|
|
||||||
html_options["data-confirm"] = confirm
|
html_options["data-confirm"] = confirm
|
||||||
@ -587,8 +587,8 @@ def convert_options_to_data_attributes(options, html_options)
|
|||||||
add_method_to_attributes!(html_options, method) if method
|
add_method_to_attributes!(html_options, method) if method
|
||||||
|
|
||||||
if disable_with
|
if disable_with
|
||||||
message = ":disable_with option is deprecated and will be removed from Rails 4.1. " /
|
message = ":disable_with option is deprecated and will be removed from Rails 4.1. " \
|
||||||
"Use ':data => { :disable_with => \'Text\' }' instead."
|
"Use 'data: { disable_with: \'Text\' }' instead."
|
||||||
ActiveSupport::Deprecation.warn(message, caller)
|
ActiveSupport::Deprecation.warn(message, caller)
|
||||||
|
|
||||||
html_options["data-disable-with"] = disable_with
|
html_options["data-disable-with"] = disable_with
|
||||||
|
@ -235,7 +235,7 @@ def extract_handler_and_format(path, default_formats)
|
|||||||
|
|
||||||
extension = pieces.pop
|
extension = pieces.pop
|
||||||
unless extension
|
unless extension
|
||||||
message = "The file #{path} did not specify a template handler. The default is currently ERB, " /
|
message = "The file #{path} did not specify a template handler. The default is currently ERB, " \
|
||||||
"but will change to RAW in the future."
|
"but will change to RAW in the future."
|
||||||
ActiveSupport::Deprecation.warn(message, caller)
|
ActiveSupport::Deprecation.warn(message, caller)
|
||||||
end
|
end
|
||||||
|
@ -411,7 +411,7 @@ def test_submit_tag_with_confirmation
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_submit_tag_with_deprecated_confirmation
|
def test_submit_tag_with_deprecated_confirmation
|
||||||
assert_deprecated ":confirm option is deprecated and will be removed from Rails 4.1. Use ':data => { :confirm => \'Text\' }' instead" do
|
assert_deprecated ":confirm option is deprecated and will be removed from Rails 4.1. Use 'data: { confirm: \'Text\' }' instead" do
|
||||||
assert_dom_equal(
|
assert_dom_equal(
|
||||||
%(<input name='commit' type='submit' value='Save' data-confirm="Are you sure?" />),
|
%(<input name='commit' type='submit' value='Save' data-confirm="Are you sure?" />),
|
||||||
submit_tag("Save", :confirm => "Are you sure?")
|
submit_tag("Save", :confirm => "Are you sure?")
|
||||||
@ -478,7 +478,7 @@ def test_button_tag_with_confirmation
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_button_tag_with_deprecated_confirmation
|
def test_button_tag_with_deprecated_confirmation
|
||||||
assert_deprecated ":confirm option is deprecated and will be removed from Rails 4.1. Use ':data => { :confirm => \'Text\' }' instead" do
|
assert_deprecated ":confirm option is deprecated and will be removed from Rails 4.1. Use 'data: { confirm: \'Text\' }' instead" do
|
||||||
assert_dom_equal(
|
assert_dom_equal(
|
||||||
%(<button name="button" type="submit" data-confirm="Are you sure?">Save</button>),
|
%(<button name="button" type="submit" data-confirm="Are you sure?">Save</button>),
|
||||||
button_tag("Save", :type => "submit", :confirm => "Are you sure?")
|
button_tag("Save", :type => "submit", :confirm => "Are you sure?")
|
||||||
@ -494,7 +494,7 @@ def test_image_submit_tag_with_confirmation
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_image_submit_tag_with_deprecated_confirmation
|
def test_image_submit_tag_with_deprecated_confirmation
|
||||||
assert_deprecated ":confirm option is deprecated and will be removed from Rails 4.1. Use ':data => { :confirm => \'Text\' }' instead" do
|
assert_deprecated ":confirm option is deprecated and will be removed from Rails 4.1. Use 'data: { confirm: \'Text\' }' instead" do
|
||||||
assert_dom_equal(
|
assert_dom_equal(
|
||||||
%(<input type="image" src="/images/save.gif" data-confirm="Are you sure?" />),
|
%(<input type="image" src="/images/save.gif" data-confirm="Are you sure?" />),
|
||||||
image_submit_tag("save.gif", :confirm => "Are you sure?")
|
image_submit_tag("save.gif", :confirm => "Are you sure?")
|
||||||
|
@ -95,7 +95,7 @@ def test_button_to_with_javascript_confirm
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_button_to_with_deprecated_confirm
|
def test_button_to_with_deprecated_confirm
|
||||||
assert_deprecated ":confirm option is deprecated and will be removed from Rails 4.1. Use ':data => { :confirm => \'Text\' }' instead" do
|
assert_deprecated ":confirm option is deprecated and will be removed from Rails 4.1. Use 'data: { confirm: \'Text\' }' instead" do
|
||||||
assert_dom_equal(
|
assert_dom_equal(
|
||||||
%{<form method="post" action="http://www.example.com" class="button_to"><div><input data-confirm="Are you sure?" type="submit" value="Hello" /></div></form>},
|
%{<form method="post" action="http://www.example.com" class="button_to"><div><input data-confirm="Are you sure?" type="submit" value="Hello" /></div></form>},
|
||||||
button_to("Hello", "http://www.example.com", confirm: "Are you sure?")
|
button_to("Hello", "http://www.example.com", confirm: "Are you sure?")
|
||||||
@ -111,7 +111,7 @@ def test_button_to_with_javascript_disable_with
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_button_to_with_javascript_deprecated_disable_with
|
def test_button_to_with_javascript_deprecated_disable_with
|
||||||
assert_deprecated ":disable_with option is deprecated and will be removed from Rails 4.1. Use ':data => { :disable_with => \'Text\' }' instead" do
|
assert_deprecated ":disable_with option is deprecated and will be removed from Rails 4.1. Use 'data: { disable_with: \'Text\' }' instead" do
|
||||||
assert_dom_equal(
|
assert_dom_equal(
|
||||||
%{<form method="post" action="http://www.example.com" class="button_to"><div><input data-disable-with="Greeting..." type="submit" value="Hello" /></div></form>},
|
%{<form method="post" action="http://www.example.com" class="button_to"><div><input data-disable-with="Greeting..." type="submit" value="Hello" /></div></form>},
|
||||||
button_to("Hello", "http://www.example.com", disable_with: "Greeting...")
|
button_to("Hello", "http://www.example.com", disable_with: "Greeting...")
|
||||||
@ -134,7 +134,7 @@ def test_button_to_with_remote_and_javascript_confirm
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_button_to_with_remote_and_javascript_with_deprecated_confirm
|
def test_button_to_with_remote_and_javascript_with_deprecated_confirm
|
||||||
assert_deprecated ":confirm option is deprecated and will be removed from Rails 4.1. Use ':data => { :confirm => \'Text\' }' instead" do
|
assert_deprecated ":confirm option is deprecated and will be removed from Rails 4.1. Use 'data: { confirm: \'Text\' }' instead" do
|
||||||
assert_dom_equal(
|
assert_dom_equal(
|
||||||
%{<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>},
|
%{<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>},
|
||||||
button_to("Hello", "http://www.example.com", remote: true, confirm: "Are you sure?")
|
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
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_button_to_with_remote_and_javascript_deprecated_disable_with
|
def test_button_to_with_remote_and_javascript_deprecated_disable_with
|
||||||
assert_deprecated ":disable_with option is deprecated and will be removed from Rails 4.1. Use ':data => { :disable_with => \'Text\' }' instead" do
|
assert_deprecated ":disable_with option is deprecated and will be removed from Rails 4.1. Use 'data: { disable_with: \'Text\' }' instead" do
|
||||||
assert_dom_equal(
|
assert_dom_equal(
|
||||||
%{<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>},
|
%{<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>},
|
||||||
button_to("Hello", "http://www.example.com", remote: true, disable_with: "Greeting...")
|
button_to("Hello", "http://www.example.com", remote: true, disable_with: "Greeting...")
|
||||||
@ -267,19 +267,19 @@ def test_link_tag_with_javascript_confirm
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_link_tag_with_deprecated_confirm
|
def test_link_tag_with_deprecated_confirm
|
||||||
assert_deprecated ":confirm option is deprecated and will be removed from Rails 4.1. Use ':data => { :confirm => \'Text\' }' instead" do
|
assert_deprecated ":confirm option is deprecated and will be removed from Rails 4.1. Use 'data: { confirm: \'Text\' }' instead" do
|
||||||
assert_dom_equal(
|
assert_dom_equal(
|
||||||
%{<a href="http://www.example.com" data-confirm="Are you sure?">Hello</a>},
|
%{<a href="http://www.example.com" data-confirm="Are you sure?">Hello</a>},
|
||||||
link_to("Hello", "http://www.example.com", confirm: "Are you sure?")
|
link_to("Hello", "http://www.example.com", confirm: "Are you sure?")
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
assert_deprecated ":confirm option is deprecated and will be removed from Rails 4.1. Use ':data => { :confirm => \'Text\' }' instead" do
|
assert_deprecated ":confirm option is deprecated and will be removed from Rails 4.1. Use 'data: { confirm: \'Text\' }' instead" do
|
||||||
assert_dom_equal(
|
assert_dom_equal(
|
||||||
%{<a href="http://www.example.com" data-confirm="You cant possibly be sure, can you?">Hello</a>},
|
%{<a href="http://www.example.com" data-confirm="You cant possibly be sure, can you?">Hello</a>},
|
||||||
link_to("Hello", "http://www.example.com", confirm: "You cant possibly be sure, can you?")
|
link_to("Hello", "http://www.example.com", confirm: "You cant possibly be sure, can you?")
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
assert_deprecated ":confirm option is deprecated and will be removed from Rails 4.1. Use ':data => { :confirm => \'Text\' }' instead" do
|
assert_deprecated ":confirm option is deprecated and will be removed from Rails 4.1. Use 'data: { confirm: \'Text\' }' instead" do
|
||||||
assert_dom_equal(
|
assert_dom_equal(
|
||||||
%{<a href="http://www.example.com" data-confirm="You cant possibly be sure,\n can you?">Hello</a>},
|
%{<a href="http://www.example.com" data-confirm="You cant possibly be sure,\n can you?">Hello</a>},
|
||||||
link_to("Hello", "http://www.example.com", confirm: "You cant possibly be sure,\n can you?")
|
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
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_link_tag_using_post_javascript_and_with_deprecated_confirm
|
def test_link_tag_using_post_javascript_and_with_deprecated_confirm
|
||||||
assert_deprecated ":confirm option is deprecated and will be removed from Rails 4.1. Use ':data => { :confirm => \'Text\' }' instead" do
|
assert_deprecated ":confirm option is deprecated and will be removed from Rails 4.1. Use 'data: { confirm: \'Text\' }' instead" do
|
||||||
assert_dom_equal(
|
assert_dom_equal(
|
||||||
%{<a href="http://www.example.com" data-method="post" rel="nofollow" data-confirm="Are you serious?">Hello</a>},
|
%{<a href="http://www.example.com" data-method="post" rel="nofollow" data-confirm="Are you serious?">Hello</a>},
|
||||||
link_to("Hello", "http://www.example.com", method: :post, confirm: "Are you serious?")
|
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
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_link_tag_using_delete_javascript_and_href_and_with_deprecated_confirm
|
def test_link_tag_using_delete_javascript_and_href_and_with_deprecated_confirm
|
||||||
assert_deprecated ":confirm option is deprecated and will be removed from Rails 4.1. Use ':data => { :confirm => \'Text\' }' instead" do
|
assert_deprecated ":confirm option is deprecated and will be removed from Rails 4.1. Use 'data: { confirm: \'Text\' }' instead" do
|
||||||
assert_dom_equal(
|
assert_dom_equal(
|
||||||
%{<a href="\#" rel="nofollow" data-confirm="Are you serious?" data-method="delete">Destroy</a>},
|
%{<a href="\#" rel="nofollow" data-confirm="Are you serious?" data-method="delete">Destroy</a>},
|
||||||
link_to("Destroy", "http://www.example.com", method: :delete, href: '#', confirm: "Are you serious?")
|
link_to("Destroy", "http://www.example.com", method: :delete, href: '#', confirm: "Are you serious?")
|
||||||
|
Loading…
Reference in New Issue
Block a user