提交 6ff923a1 编写于 作者: R Rafael Mendonça França

Merge pull request #10814 from kennyj/deprecations_4_1

Remove some deprecation methods / options / files.
......@@ -46,10 +46,6 @@ module ActionController
autoload :TestCase, 'action_controller/test_case'
autoload :TemplateAssertions, 'action_controller/test_case'
eager_autoload do
autoload :RecordIdentifier
end
def self.eager_load!
super
ActionController::Caching.eager_load!
......
......@@ -223,7 +223,6 @@ def self.without_modules(*modules)
ForceSSL,
Streaming,
DataStreaming,
RecordIdentifier,
HttpAuthentication::Basic::ControllerMethods,
HttpAuthentication::Digest::ControllerMethods,
HttpAuthentication::Token::ControllerMethods,
......
require 'action_view/record_identifier'
module ActionController
module RecordIdentifier
MODULE_MESSAGE = 'Calling ActionController::RecordIdentifier.%s is deprecated and ' \
'will be removed in Rails 4.1, please call using ActionView::RecordIdentifier instead.'
INSTANCE_MESSAGE = '%s method will no longer be included by default in controllers ' \
'since Rails 4.1. If you would like to use it in controllers, please include ' \
'ActionView::RecordIdentifier module.'
def dom_id(record, prefix = nil)
ActiveSupport::Deprecation.warn(INSTANCE_MESSAGE % 'dom_id')
ActionView::RecordIdentifier.dom_id(record, prefix)
end
def dom_class(record, prefix = nil)
ActiveSupport::Deprecation.warn(INSTANCE_MESSAGE % 'dom_class')
ActionView::RecordIdentifier.dom_class(record, prefix)
end
def self.dom_id(record, prefix = nil)
ActiveSupport::Deprecation.warn(MODULE_MESSAGE % 'dom_id')
ActionView::RecordIdentifier.dom_id(record, prefix)
end
def self.dom_class(record, prefix = nil)
ActiveSupport::Deprecation.warn(MODULE_MESSAGE % 'dom_class')
ActionView::RecordIdentifier.dom_class(record, prefix)
end
end
end
require 'action_view/vendor/html-scanner'
require 'active_support/deprecation'
ActiveSupport::Deprecation.warn 'Vendored html-scanner was moved to action_view, please require "action_view/vendor/html-scanner" instead. ' +
'This file will be removed in Rails 4.1'
......@@ -426,22 +426,6 @@ def radio_button_tag(name, value, checked = false, options = {})
def submit_tag(value = "Save changes", options = {})
options = options.stringify_keys
if disable_with = options.delete("disable_with")
message = ":disable_with option is deprecated and will be removed from Rails 4.1. " \
"Use 'data: { disable_with: \'Text\' }' instead."
ActiveSupport::Deprecation.warn message
options["data-disable-with"] = disable_with
end
if confirm = options.delete("confirm")
message = ":confirm option is deprecated and will be removed from Rails 4.1. " \
"Use 'data: { confirm: \'Text\' }' instead'."
ActiveSupport::Deprecation.warn message
options["data-confirm"] = confirm
end
tag :input, { "type" => "submit", "name" => "commit", "value" => value }.update(options)
end
......@@ -488,22 +472,6 @@ def button_tag(content_or_options = nil, options = nil, &block)
options ||= {}
options = options.stringify_keys
if disable_with = options.delete("disable_with")
message = ":disable_with option is deprecated and will be removed from Rails 4.1. " \
"Use 'data: { disable_with: \'Text\' }' instead."
ActiveSupport::Deprecation.warn message
options["data-disable-with"] = disable_with
end
if confirm = options.delete("confirm")
message = ":confirm option is deprecated and will be removed from Rails 4.1. " \
"Use 'data: { confirm: \'Text\' }' instead'."
ActiveSupport::Deprecation.warn message
options["data-confirm"] = confirm
end
options.reverse_merge! 'name' => 'button', 'type' => 'submit'
content_tag :button, content_or_options || 'Button', options, &block
......@@ -541,15 +509,6 @@ def button_tag(content_or_options = nil, options = nil, &block)
# # => <input alt="Save" src="/images/save.png" data-confirm="Are you sure?" type="image" />
def image_submit_tag(source, options = {})
options = options.stringify_keys
if confirm = options.delete("confirm")
message = ":confirm option is deprecated and will be removed from Rails 4.1. " \
"Use 'data: { confirm: \'Text\' }' instead'."
ActiveSupport::Deprecation.warn message
options["data-confirm"] = confirm
end
tag :input, { "alt" => image_alt(source), "type" => "image", "src" => path_to_image(source) }.update(options)
end
......
......@@ -70,48 +70,6 @@ def javascript_tag(content_or_options_with_block = nil, html_options = {}, &bloc
def javascript_cdata_section(content) #:nodoc:
"\n//#{cdata_section("\n#{content}\n//")}\n".html_safe
end
# Returns a button whose +onclick+ handler triggers the passed JavaScript.
#
# The helper receives a name, JavaScript code, and an optional hash of HTML options. The
# name is used as button label and the JavaScript code goes into its +onclick+ attribute.
# If +html_options+ has an <tt>:onclick</tt>, that one is put before +function+.
#
# button_to_function "Greeting", "alert('Hello world!')", class: "ok"
# # => <input class="ok" onclick="alert('Hello world!');" type="button" value="Greeting" />
#
def button_to_function(name, function=nil, html_options={})
message = "button_to_function is deprecated and will be removed from Rails 4.1. We recommend using Unobtrusive JavaScript instead. " +
"See http://guides.rubyonrails.org/working_with_javascript_in_rails.html#unobtrusive-javascript"
ActiveSupport::Deprecation.warn message
onclick = "#{"#{html_options[:onclick]}; " if html_options[:onclick]}#{function};"
tag(:input, html_options.merge(:type => 'button', :value => name, :onclick => onclick))
end
# Returns a link whose +onclick+ handler triggers the passed JavaScript.
#
# The helper receives a name, JavaScript code, and an optional hash of HTML options. The
# name is used as the link text and the JavaScript code goes into the +onclick+ attribute.
# If +html_options+ has an <tt>:onclick</tt>, that one is put before +function+. Once all
# the JavaScript is set, the helper appends "; return false;".
#
# The +href+ attribute of the tag is set to "#" unless +html_options+ has one.
#
# link_to_function "Greeting", "alert('Hello world!')", class: "nav_link"
# # => <a class="nav_link" href="#" onclick="alert('Hello world!'); return false;">Greeting</a>
#
def link_to_function(name, function, html_options={})
message = "link_to_function is deprecated and will be removed from Rails 4.1. We recommend using Unobtrusive JavaScript instead. " +
"See http://guides.rubyonrails.org/working_with_javascript_in_rails.html#unobtrusive-javascript"
ActiveSupport::Deprecation.warn message
onclick = "#{"#{html_options[:onclick]}; " if html_options[:onclick]}#{function}; return false;"
href = html_options[:href] || '#'
content_tag(:a, name, html_options.merge(:href => href, :onclick => onclick))
end
end
end
end
......@@ -548,28 +548,10 @@ def convert_options_to_data_attributes(options, html_options)
html_options = html_options.stringify_keys
html_options['data-remote'] = 'true' if link_to_remote_options?(options) || link_to_remote_options?(html_options)
disable_with = html_options.delete("disable_with")
confirm = html_options.delete('confirm')
method = html_options.delete('method')
if confirm
message = ":confirm option is deprecated and will be removed from Rails 4.1. " \
"Use 'data: { confirm: \'Text\' }' instead."
ActiveSupport::Deprecation.warn message
html_options["data-confirm"] = confirm
end
add_method_to_attributes!(html_options, method) if method
if disable_with
message = ":disable_with option is deprecated and will be removed from Rails 4.1. " \
"Use 'data: { disable_with: \'Text\' }' instead."
ActiveSupport::Deprecation.warn message
html_options["data-disable-with"] = disable_with
end
html_options
else
link_to_remote_options?(options) ? {'data-remote' => 'true'} : {}
......
......@@ -146,12 +146,6 @@ def render(view, locals, buffer=nil, &block)
handle_render_error(view, e)
end
def mime_type
message = 'Template#mime_type is deprecated and will be removed in Rails 4.1. Please use type method instead.'
ActiveSupport::Deprecation.warn message
@mime_type ||= Mime::Type.lookup_by_extension(@formats.first.to_s) if @formats.first
end
def type
@type ||= Types[@formats.first] if @formats.first
end
......
......@@ -61,10 +61,7 @@ def url_options
end
end
class RecordIdentifierController < ActionController::Base
end
class RecordIdentifierWithoutDeprecationController < ActionController::Base
class RecordIdentifierIncludedController < ActionController::Base
include ActionView::RecordIdentifier
end
......@@ -88,43 +85,20 @@ def test_controller_name
assert_equal 'contained_empty', Submodule::ContainedEmptyController.controller_name
end
def test_record_identifier
assert_respond_to RecordIdentifierController.new, :dom_id
assert_respond_to RecordIdentifierController.new, :dom_class
end
def test_record_identifier_is_deprecated
record = Comment.new
record.save
dom_id = nil
assert_deprecated 'dom_id method will no longer' do
dom_id = RecordIdentifierController.new.dom_id(record)
end
assert_equal 'comment_1', dom_id
dom_class = nil
assert_deprecated 'dom_class method will no longer' do
dom_class = RecordIdentifierController.new.dom_class(record)
end
assert_equal 'comment', dom_class
end
def test_no_deprecation_when_action_view_record_identifier_is_included
record = Comment.new
record.save
dom_id = nil
assert_not_deprecated do
dom_id = RecordIdentifierWithoutDeprecationController.new.dom_id(record)
dom_id = RecordIdentifierIncludedController.new.dom_id(record)
end
assert_equal 'comment_1', dom_id
dom_class = nil
assert_not_deprecated do
dom_class = RecordIdentifierWithoutDeprecationController.new.dom_class(record)
dom_class = RecordIdentifierIncludedController.new.dom_class(record)
end
assert_equal 'comment', dom_class
end
......
require 'abstract_unit'
require 'controller/fake_models'
class ControllerRecordIdentifierTest < ActiveSupport::TestCase
include ActionController::RecordIdentifier
def setup
@record = Comment.new
end
def test_dom_id_deprecation
assert_deprecated(/dom_id method will no longer be included by default in controllers/) do
dom_id(@record)
end
end
def test_dom_class_deprecation
assert_deprecated(/dom_class method will no longer be included by default in controllers/) do
dom_class(@record)
end
end
def test_dom_id_from_module_deprecation
assert_deprecated(/Calling ActionController::RecordIdentifier.dom_id is deprecated/) do
ActionController::RecordIdentifier.dom_id(@record)
end
end
def test_dom_class_from_module_deprecation
assert_deprecated(/Calling ActionController::RecordIdentifier.dom_class is deprecated/) do
ActionController::RecordIdentifier.dom_class(@record)
end
end
end
......@@ -410,15 +410,6 @@ def test_submit_tag_with_confirmation
)
end
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_dom_equal(
%(<input name='commit' type='submit' value='Save' data-confirm="Are you sure?" />),
submit_tag("Save", :confirm => "Are you sure?")
)
end
end
def test_button_tag
assert_dom_equal(
%(<button name="button" type="submit">Button</button>),
......@@ -477,15 +468,6 @@ def test_button_tag_with_confirmation
)
end
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_dom_equal(
%(<button name="button" type="submit" data-confirm="Are you sure?">Save</button>),
button_tag("Save", :type => "submit", :confirm => "Are you sure?")
)
end
end
def test_image_submit_tag_with_confirmation
assert_dom_equal(
%(<input alt="Save" type="image" src="/images/save.gif" data-confirm="Are you sure?" />),
......@@ -493,16 +475,6 @@ def test_image_submit_tag_with_confirmation
)
end
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_dom_equal(
%(<input alt="Save" type="image" src="/images/save.gif" data-confirm="Are you sure?" />),
image_submit_tag("save.gif", :confirm => "Are you sure?")
)
end
end
def test_color_field_tag
expected = %{<input id="car" name="car" type="color" />}
assert_dom_equal(expected, color_field_tag("car"))
......
......@@ -42,48 +42,6 @@ def test_escape_javascript_with_safebuffer
assert_instance_of ActiveSupport::SafeBuffer, escape_javascript(ActiveSupport::SafeBuffer.new(given))
end
def test_button_to_function
assert_deprecated do
assert_dom_equal %(<input type="button" onclick="alert(&#39;Hello world!&#39;);" value="Greeting" />),
button_to_function("Greeting", "alert('Hello world!')")
end
end
def test_button_to_function_with_onclick
assert_deprecated do
assert_dom_equal "<input onclick=\"alert(&#39;Goodbye World :(&#39;); alert(&#39;Hello world!&#39;);\" type=\"button\" value=\"Greeting\" />",
button_to_function("Greeting", "alert('Hello world!')", :onclick => "alert('Goodbye World :(')")
end
end
def test_button_to_function_without_function
assert_deprecated do
assert_dom_equal "<input onclick=\";\" type=\"button\" value=\"Greeting\" />",
button_to_function("Greeting")
end
end
def test_link_to_function
assert_deprecated do
assert_dom_equal %(<a href="#" onclick="alert(&#39;Hello world!&#39;); return false;">Greeting</a>),
link_to_function("Greeting", "alert('Hello world!')")
end
end
def test_link_to_function_with_existing_onclick
assert_deprecated do
assert_dom_equal %(<a href="#" onclick="confirm(&#39;Sanity!&#39;); alert(&#39;Hello world!&#39;); return false;">Greeting</a>),
link_to_function("Greeting", "alert('Hello world!')", :onclick => "confirm('Sanity!')")
end
end
def test_function_with_href
assert_deprecated do
assert_dom_equal %(<a href="http://example.com/" onclick="alert(&#39;Hello world!&#39;); return false;">Greeting</a>),
link_to_function("Greeting", "alert('Hello world!')", :href => 'http://example.com/')
end
end
def test_javascript_tag
self.output_buffer = 'foo'
......
......@@ -64,13 +64,6 @@ def setup
@context = Context.new
end
def test_mime_type_is_deprecated
template = new_template
assert_deprecated 'Template#mime_type is deprecated and will be removed' do
template.mime_type
end
end
def test_basic_template
@template = new_template
assert_equal "Hello", render
......
......@@ -93,15 +93,6 @@ def test_button_to_with_javascript_confirm
)
end
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_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>},
button_to("Hello", "http://www.example.com", confirm: "Are you sure?")
)
end
end
def test_button_to_with_javascript_disable_with
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>},
......@@ -109,15 +100,6 @@ def test_button_to_with_javascript_disable_with
)
end
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_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>},
button_to("Hello", "http://www.example.com", disable_with: "Greeting...")
)
end
end
def test_button_to_with_remote_and_form_options
assert_dom_equal(
%{<form method="post" action="http://www.example.com" class="custom-class" data-remote="true" data-type="json"><div><input type="submit" value="Hello" /></div></form>},
......@@ -132,15 +114,6 @@ def test_button_to_with_remote_and_javascript_confirm
)
end
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_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>},
button_to("Hello", "http://www.example.com", remote: true, confirm: "Are you sure?")
)
end
end
def test_button_to_with_remote_and_javascript_disable_with
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>},
......@@ -148,15 +121,6 @@ def test_button_to_with_remote_and_javascript_disable_with
)
end
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_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>},
button_to("Hello", "http://www.example.com", remote: true, disable_with: "Greeting...")
)
end
end
def test_button_to_with_remote_false
assert_dom_equal(
%{<form method="post" action="http://www.example.com" class="button_to"><div><input type="submit" value="Hello" /></div></form>},
......@@ -265,27 +229,6 @@ def test_link_tag_with_javascript_confirm
)
end
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_dom_equal(
%{<a href="http://www.example.com" data-confirm="Are you sure?">Hello</a>},
link_to("Hello", "http://www.example.com", confirm: "Are you sure?")
)
end
assert_deprecated ":confirm option is deprecated and will be removed from Rails 4.1. Use 'data: { confirm: \'Text\' }' instead" do
assert_dom_equal(
%{<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?")
)
end
assert_deprecated ":confirm option is deprecated and will be removed from Rails 4.1. Use 'data: { confirm: \'Text\' }' instead" do
assert_dom_equal(
%{<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?")
)
end
end
def test_link_to_with_remote
assert_dom_equal(
%{<a href="http://www.example.com" data-remote="true">Hello</a>},
......@@ -349,15 +292,6 @@ def test_link_tag_using_post_javascript_and_confirm
)
end
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_dom_equal(
%{<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?")
)
end
end
def test_link_tag_using_delete_javascript_and_href_and_confirm
assert_dom_equal(
%{<a href="\#" rel="nofollow" data-confirm="Are you serious?" data-method="delete">Destroy</a>},
......@@ -365,15 +299,6 @@ def test_link_tag_using_delete_javascript_and_href_and_confirm
)
end
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_dom_equal(
%{<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?")
)
end
end
def test_link_tag_with_block
assert_dom_equal %{<a href="/"><span>Example site</span></a>},
link_to('/') { content_tag(:span, 'Example site') }
......
......@@ -56,15 +56,7 @@ def maximum(column_name, options = {})
#
# Person.sum(:age) # => 4562
def sum(*args)
if block_given?
ActiveSupport::Deprecation.warn(
"Calling #sum with a block is deprecated and will be removed in Rails 4.1. " \
"If you want to perform sum calculation over the array of elements, use `to_a.sum(&block)`."
)
self.to_a.sum(*args) {|*block_args| yield(*block_args)}
else
calculate(:sum, *args)
end
calculate(:sum, *args)
end
# This calculates aggregate values in the given column. Methods for count, sum, average,
......
......@@ -1747,12 +1747,6 @@ def test_collection_association_with_private_kernel_method
assert_deprecated { klass.has_many :foo, :counter_sql => 'lol' }
end
test "sum calculation with block for array compatibility is deprecated" do
assert_deprecated do
posts(:welcome).comments.sum { |c| c.id }
end
end
test "has many associations on new records use null relations" do
post = Post.new
......
......@@ -1228,38 +1228,6 @@ def test_assert_queries
assert_no_queries { assert true }
end
def test_silence_sets_log_level_to_error_in_block
original_logger = ActiveRecord::Base.logger
assert_deprecated do
log = StringIO.new
ActiveRecord::Base.logger = ActiveSupport::Logger.new(log)
ActiveRecord::Base.logger.level = Logger::DEBUG
ActiveRecord::Base.silence do
ActiveRecord::Base.logger.warn "warn"
ActiveRecord::Base.logger.error "error"
end
assert_equal "error\n", log.string
end
ensure
ActiveRecord::Base.logger = original_logger
end
def test_silence_sets_log_level_back_to_level_before_yield
original_logger = ActiveRecord::Base.logger
assert_deprecated do
log = StringIO.new
ActiveRecord::Base.logger = ActiveSupport::Logger.new(log)
ActiveRecord::Base.logger.level = Logger::WARN
ActiveRecord::Base.silence do
end
assert_equal Logger::WARN, ActiveRecord::Base.logger.level
end
ensure
ActiveRecord::Base.logger = original_logger
end
def test_benchmark_with_log_level
original_logger = ActiveRecord::Base.logger
log = StringIO.new
......
......@@ -410,12 +410,6 @@ def test_sum_with_from_option
Account.where("credit_limit > 50").from('accounts').sum(:credit_limit)
end
def test_sum_array_compatibility_deprecation
assert_deprecated do
assert_equal Account.sum(:credit_limit), Account.sum(&:credit_limit)
end
end
def test_average_with_from_option
assert_equal Account.average(:credit_limit), Account.from('accounts').average(:credit_limit)
assert_equal Account.where("credit_limit > 50").average(:credit_limit),
......
......@@ -45,15 +45,5 @@ def benchmark(message = "Benchmarking", options = {})
yield
end
end
# Silence the logger during the execution of the block.
def silence
message = "ActiveSupport::Benchmarkable#silence is deprecated. It will be removed from Rails 4.1."
ActiveSupport::Deprecation.warn message
old_logger_level, logger.level = logger.level, ::Logger::ERROR if logger
yield
ensure
logger.level = old_logger_level if logger
end
end
end
......@@ -2,7 +2,6 @@
require 'active_support/core_ext/object/to_json'
require 'active_support/core_ext/module/delegation'
require 'active_support/json/variable'
require 'bigdecimal'
require 'active_support/core_ext/big_decimal/conversions' # for #to_s
......
require 'active_support/deprecation'
module ActiveSupport
module JSON
# Deprecated: A string that returns itself as its JSON-encoded form.
class Variable < String
def initialize(*args)
message = 'ActiveSupport::JSON::Variable is deprecated and will be removed in Rails 4.1. ' \
'For your own custom JSON literals, define #as_json and #encode_json yourself.'
ActiveSupport::Deprecation.warn message
super
end
def as_json(options = nil) self end #:nodoc:
def encode_json(encoder) self end #:nodoc:
end
end
end
......@@ -4,7 +4,6 @@
require 'active_support/testing/setup_and_teardown'
require 'active_support/testing/assertions'
require 'active_support/testing/deprecation'
require 'active_support/testing/pending'
require 'active_support/testing/declarative'
require 'active_support/testing/isolation'
require 'active_support/testing/constant_lookup'
......@@ -54,7 +53,6 @@ def self.test_order # :nodoc:
include ActiveSupport::Testing::SetupAndTeardown
include ActiveSupport::Testing::Assertions
include ActiveSupport::Testing::Deprecation
include ActiveSupport::Testing::Pending
extend ActiveSupport::Testing::Declarative
# test/unit backwards compatibility methods
......
require 'active_support/deprecation'
module ActiveSupport
module Testing
module Pending # :nodoc:
unless defined?(Spec)
def pending(description = "", &block)
ActiveSupport::Deprecation.warn("#pending is deprecated and will be removed in Rails 4.1, please use #skip instead.")
skip(description.blank? ? nil : description)
end
end
end
end
end
......@@ -96,13 +96,6 @@ def sorted_json(json)
end
end
def test_json_variable
assert_deprecated do
assert_equal ActiveSupport::JSON::Variable.new('foo'), 'foo'
assert_equal ActiveSupport::JSON::Variable.new('alert("foo")'), 'alert("foo")'
end
end
def test_hash_encoding
assert_equal %({\"a\":\"b\"}), ActiveSupport::JSON.encode(:a => :b)
assert_equal %({\"a\":1}), ActiveSupport::JSON.encode('a' => 1)
......
require 'abstract_unit'
module ActiveSupport
class TestCaseTest < ActiveSupport::TestCase
def test_pending_deprecation
assert_deprecated do
pending "should use #skip instead"
end
end
end
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册