mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Get rid of 'Object#send!'. It was originally added because it's in Ruby 1.9, but it has since been removed from 1.9.
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net> Conflicts: actionpack/test/controller/layout_test.rb
This commit is contained in:
parent
e9a8e0053b
commit
a1eb4e11c2
35 changed files with 86 additions and 92 deletions
|
@ -72,7 +72,7 @@ module ActionMailer
|
|||
methods.flatten.each do |method|
|
||||
master_helper_module.module_eval <<-end_eval
|
||||
def #{method}(*args, &block)
|
||||
controller.send!(%(#{method}), *args, &block)
|
||||
controller.__send__(%(#{method}), *args, &block)
|
||||
end
|
||||
end_eval
|
||||
end
|
||||
|
@ -92,7 +92,7 @@ module ActionMailer
|
|||
inherited_without_helper(child)
|
||||
begin
|
||||
child.master_helper_module = Module.new
|
||||
child.master_helper_module.send! :include, master_helper_module
|
||||
child.master_helper_module.__send__(:include, master_helper_module)
|
||||
child.helper child.name.to_s.underscore
|
||||
rescue MissingSourceFile => e
|
||||
raise unless e.is_missing?("helpers/#{child.name.to_s.underscore}_helper")
|
||||
|
|
|
@ -90,7 +90,7 @@ module ActionController #:nodoc:
|
|||
set_content_type!(controller, cache_path.extension)
|
||||
options = { :text => cache }
|
||||
options.merge!(:layout => true) if cache_layout?
|
||||
controller.send!(:render, options)
|
||||
controller.__send__(:render, options)
|
||||
false
|
||||
else
|
||||
controller.action_cache_path = cache_path
|
||||
|
|
|
@ -83,13 +83,13 @@ module ActionController #:nodoc:
|
|||
controller_callback_method_name = "#{timing}_#{controller.controller_name.underscore}"
|
||||
action_callback_method_name = "#{controller_callback_method_name}_#{controller.action_name}"
|
||||
|
||||
send!(controller_callback_method_name) if respond_to?(controller_callback_method_name, true)
|
||||
send!(action_callback_method_name) if respond_to?(action_callback_method_name, true)
|
||||
__send__(controller_callback_method_name) if respond_to?(controller_callback_method_name, true)
|
||||
__send__(action_callback_method_name) if respond_to?(action_callback_method_name, true)
|
||||
end
|
||||
|
||||
def method_missing(method, *arguments)
|
||||
return if @controller.nil?
|
||||
@controller.send!(method, *arguments)
|
||||
@controller.__send__(method, *arguments)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -48,7 +48,7 @@ module ActionController #:nodoc:
|
|||
def initialize(cgi, session_options = {})
|
||||
@cgi = cgi
|
||||
@session_options = session_options
|
||||
@env = @cgi.send!(:env_table)
|
||||
@env = @cgi.__send__(:env_table)
|
||||
super()
|
||||
end
|
||||
|
||||
|
@ -107,7 +107,7 @@ module ActionController #:nodoc:
|
|||
end
|
||||
|
||||
def method_missing(method_id, *arguments)
|
||||
@cgi.send!(method_id, *arguments) rescue super
|
||||
@cgi.__send__(method_id, *arguments) rescue super
|
||||
end
|
||||
|
||||
private
|
||||
|
@ -164,7 +164,7 @@ end_msg
|
|||
begin
|
||||
output.write(@cgi.header(@headers))
|
||||
|
||||
if @cgi.send!(:env_table)['REQUEST_METHOD'] == 'HEAD'
|
||||
if @cgi.__send__(:env_table)['REQUEST_METHOD'] == 'HEAD'
|
||||
return
|
||||
elsif @body.respond_to?(:call)
|
||||
# Flush the output now in case the @body Proc uses
|
||||
|
|
|
@ -65,7 +65,7 @@ module ActionController #:nodoc:
|
|||
|
||||
module HelperMethods
|
||||
def render_component(options)
|
||||
@controller.send!(:render_component_as_string, options)
|
||||
@controller.__send__(:render_component_as_string, options)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -199,8 +199,8 @@ module ActionController #:nodoc:
|
|||
Proc.new do |controller, action|
|
||||
method.before(controller)
|
||||
|
||||
if controller.send!(:performed?)
|
||||
controller.send!(:halt_filter_chain, method, :rendered_or_redirected)
|
||||
if controller.__send__(:performed?)
|
||||
controller.__send__(:halt_filter_chain, method, :rendered_or_redirected)
|
||||
else
|
||||
begin
|
||||
action.call
|
||||
|
@ -223,8 +223,8 @@ module ActionController #:nodoc:
|
|||
|
||||
def call(controller, &block)
|
||||
super
|
||||
if controller.send!(:performed?)
|
||||
controller.send!(:halt_filter_chain, method, :rendered_or_redirected)
|
||||
if controller.__send__(:performed?)
|
||||
controller.__send__(:halt_filter_chain, method, :rendered_or_redirected)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -204,8 +204,8 @@ module ActionController #:nodoc:
|
|||
|
||||
begin
|
||||
child.master_helper_module = Module.new
|
||||
child.master_helper_module.send! :include, master_helper_module
|
||||
child.send! :default_helper_module!
|
||||
child.master_helper_module.__send__ :include, master_helper_module
|
||||
child.__send__ :default_helper_module!
|
||||
rescue MissingSourceFile => e
|
||||
raise unless e.is_missing?("helpers/#{child.controller_path}_helper")
|
||||
end
|
||||
|
|
|
@ -117,7 +117,7 @@ module ActionController
|
|||
|
||||
def authentication_request(controller, realm)
|
||||
controller.headers["WWW-Authenticate"] = %(Basic realm="#{realm.gsub(/"/, "")}")
|
||||
controller.send! :render, :text => "HTTP Basic: Access denied.\n", :status => :unauthorized
|
||||
controller.__send__ :render, :text => "HTTP Basic: Access denied.\n", :status => :unauthorized
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -444,7 +444,7 @@ EOF
|
|||
reset! unless @integration_session
|
||||
# reset the html_document variable, but only for new get/post calls
|
||||
@html_document = nil unless %w(cookies assigns).include?(method)
|
||||
returning @integration_session.send!(method, *args) do
|
||||
returning @integration_session.__send__(method, *args) do
|
||||
copy_session_variables!
|
||||
end
|
||||
end
|
||||
|
@ -469,12 +469,12 @@ EOF
|
|||
self.class.fixture_table_names.each do |table_name|
|
||||
name = table_name.tr(".", "_")
|
||||
next unless respond_to?(name)
|
||||
extras.send!(:define_method, name) { |*args| delegate.send(name, *args) }
|
||||
extras.__send__(:define_method, name) { |*args| delegate.send(name, *args) }
|
||||
end
|
||||
end
|
||||
|
||||
# delegate add_assertion to the test case
|
||||
extras.send!(:define_method, :add_assertion) { test_result.add_assertion }
|
||||
extras.__send__(:define_method, :add_assertion) { test_result.add_assertion }
|
||||
session.extend(extras)
|
||||
session.delegate = self
|
||||
session.test_result = @_result
|
||||
|
@ -488,7 +488,7 @@ EOF
|
|||
def copy_session_variables! #:nodoc:
|
||||
return unless @integration_session
|
||||
%w(controller response request).each do |var|
|
||||
instance_variable_set("@#{var}", @integration_session.send!(var))
|
||||
instance_variable_set("@#{var}", @integration_session.__send__(var))
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -219,7 +219,7 @@ module ActionController #:nodoc:
|
|||
layout = passed_layout || self.class.default_layout(default_template_format)
|
||||
active_layout = case layout
|
||||
when String then layout
|
||||
when Symbol then send!(layout)
|
||||
when Symbol then __send__(layout)
|
||||
when Proc then layout.call(self)
|
||||
end
|
||||
|
||||
|
@ -238,7 +238,7 @@ module ActionController #:nodoc:
|
|||
private
|
||||
def candidate_for_layout?(options)
|
||||
options.values_at(:text, :xml, :json, :file, :inline, :partial, :nothing, :update).compact.empty? &&
|
||||
!@template.send(:_exempt_from_layout?, options[:template] || default_template_name(options[:action]))
|
||||
!@template.__send__(:_exempt_from_layout?, options[:template] || default_template_name(options[:action]))
|
||||
end
|
||||
|
||||
def pick_layout(options)
|
||||
|
@ -247,7 +247,7 @@ module ActionController #:nodoc:
|
|||
when FalseClass
|
||||
nil
|
||||
when NilClass, TrueClass
|
||||
active_layout if action_has_layout? && !@template.send(:_exempt_from_layout?, default_template_name)
|
||||
active_layout if action_has_layout? && !@template.__send__(:_exempt_from_layout?, default_template_name)
|
||||
else
|
||||
active_layout(layout)
|
||||
end
|
||||
|
@ -272,7 +272,7 @@ module ActionController #:nodoc:
|
|||
end
|
||||
|
||||
def layout_directory?(layout_name)
|
||||
@template.send(:_pick_template, "#{File.join('layouts', layout_name)}.#{@template.template_format}") ? true : false
|
||||
@template.__send__(:_pick_template, "#{File.join('layouts', layout_name)}.#{@template.template_format}") ? true : false
|
||||
rescue ActionView::MissingTemplate
|
||||
false
|
||||
end
|
||||
|
|
|
@ -108,7 +108,7 @@ module ActionController
|
|||
args.last.kind_of?(Hash) ? args.last.merge!(url_options) : args << url_options
|
||||
end
|
||||
|
||||
send!(named_route, *args)
|
||||
__send__(named_route, *args)
|
||||
end
|
||||
|
||||
# Returns the path component of a URL for the given record. It uses
|
||||
|
@ -149,7 +149,7 @@ module ActionController
|
|||
if parent.is_a?(Symbol) || parent.is_a?(String)
|
||||
string << "#{parent}_"
|
||||
else
|
||||
string << "#{RecordIdentifier.send!("singular_class_name", parent)}_"
|
||||
string << "#{RecordIdentifier.__send__("singular_class_name", parent)}_"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -157,7 +157,7 @@ module ActionController
|
|||
if record.is_a?(Symbol) || record.is_a?(String)
|
||||
route << "#{record}_"
|
||||
else
|
||||
route << "#{RecordIdentifier.send!("#{inflection}_class_name", record)}_"
|
||||
route << "#{RecordIdentifier.__send__("#{inflection}_class_name", record)}_"
|
||||
end
|
||||
|
||||
action_prefix(options) + namespace + route + routing_type(options).to_s
|
||||
|
|
|
@ -115,7 +115,7 @@ module ActionController
|
|||
def install(destinations = [ActionController::Base, ActionView::Base], regenerate = false)
|
||||
reset! if regenerate
|
||||
Array(destinations).each do |dest|
|
||||
dest.send! :include, @module
|
||||
dest.__send__(:include, @module)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -353,7 +353,7 @@ module ActionController
|
|||
if generate_all
|
||||
# Used by caching to expire all paths for a resource
|
||||
return routes.collect do |route|
|
||||
route.send!(method, options, merged, expire_on)
|
||||
route.__send__(method, options, merged, expire_on)
|
||||
end.compact
|
||||
end
|
||||
|
||||
|
@ -361,7 +361,7 @@ module ActionController
|
|||
routes = routes_by_controller[controller][action][options.keys.sort_by { |x| x.object_id }]
|
||||
|
||||
routes.each do |route|
|
||||
results = route.send!(method, options, merged, expire_on)
|
||||
results = route.__send__(method, options, merged, expire_on)
|
||||
return results if results && (!results.is_a?(Array) || results.first)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -357,7 +357,7 @@ module ActionController #:nodoc:
|
|||
alias local_path path
|
||||
|
||||
def method_missing(method_name, *args, &block) #:nodoc:
|
||||
@tempfile.send!(method_name, *args, &block)
|
||||
@tempfile.__send__(method_name, *args, &block)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -403,7 +403,7 @@ module ActionController #:nodoc:
|
|||
def xml_http_request(request_method, action, parameters = nil, session = nil, flash = nil)
|
||||
@request.env['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest'
|
||||
@request.env['HTTP_ACCEPT'] = 'text/javascript, text/html, application/xml, text/xml, */*'
|
||||
returning send!(request_method, action, parameters, session, flash) do
|
||||
returning __send__(request_method, action, parameters, session, flash) do
|
||||
@request.env.delete 'HTTP_X_REQUESTED_WITH'
|
||||
@request.env.delete 'HTTP_ACCEPT'
|
||||
end
|
||||
|
@ -436,7 +436,7 @@ module ActionController #:nodoc:
|
|||
|
||||
def build_request_uri(action, parameters)
|
||||
unless @request.env['REQUEST_URI']
|
||||
options = @controller.send!(:rewrite_options, parameters)
|
||||
options = @controller.__send__(:rewrite_options, parameters)
|
||||
options.update(:only_path => true, :action => action)
|
||||
|
||||
url = ActionController::UrlRewriter.new(@request, parameters)
|
||||
|
|
|
@ -80,7 +80,7 @@ module ActionController #:nodoc:
|
|||
# array (may also be a single value).
|
||||
def verify(options={})
|
||||
before_filter :only => options[:only], :except => options[:except] do |c|
|
||||
c.send! :verify_action, options
|
||||
c.__send__ :verify_action, options
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -116,7 +116,7 @@ module ActionController #:nodoc:
|
|||
end
|
||||
|
||||
def apply_redirect_to(redirect_to_option) # :nodoc:
|
||||
(redirect_to_option.is_a?(Symbol) && redirect_to_option != :back) ? self.send!(redirect_to_option) : redirect_to_option
|
||||
(redirect_to_option.is_a?(Symbol) && redirect_to_option != :back) ? self.__send__(redirect_to_option) : redirect_to_option
|
||||
end
|
||||
|
||||
def apply_remaining_actions(options) # :nodoc:
|
||||
|
|
|
@ -54,7 +54,7 @@ module ActionView
|
|||
private
|
||||
def method_missing(selector, *args)
|
||||
controller = TestController.new
|
||||
return controller.send!(selector, *args) if ActionController::Routing::Routes.named_routes.helpers.include?(selector)
|
||||
return controller.__send__(selector, *args) if ActionController::Routing::Routes.named_routes.helpers.include?(selector)
|
||||
super
|
||||
end
|
||||
end
|
||||
|
|
|
@ -84,11 +84,11 @@ class ControllerInstanceTests < Test::Unit::TestCase
|
|||
def test_action_methods
|
||||
@empty_controllers.each do |c|
|
||||
hide_mocha_methods_from_controller(c)
|
||||
assert_equal Set.new, c.send!(:action_methods), "#{c.controller_path} should be empty!"
|
||||
assert_equal Set.new, c.__send__(:action_methods), "#{c.controller_path} should be empty!"
|
||||
end
|
||||
@non_empty_controllers.each do |c|
|
||||
hide_mocha_methods_from_controller(c)
|
||||
assert_equal Set.new(%w(public_action)), c.send!(:action_methods), "#{c.controller_path} should not be empty!"
|
||||
assert_equal Set.new(%w(public_action)), c.__send__(:action_methods), "#{c.controller_path} should not be empty!"
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -100,7 +100,7 @@ class ControllerInstanceTests < Test::Unit::TestCase
|
|||
:expects, :mocha, :mocha_inspect, :reset_mocha, :stubba_object,
|
||||
:stubba_method, :stubs, :verify, :__metaclass__, :__is_a__, :to_matcher,
|
||||
]
|
||||
controller.class.send!(:hide_action, *mocha_methods)
|
||||
controller.class.__send__(:hide_action, *mocha_methods)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -140,7 +140,7 @@ class PerformActionTest < Test::Unit::TestCase
|
|||
|
||||
def test_method_missing_is_not_an_action_name
|
||||
use_controller MethodMissingController
|
||||
assert ! @controller.send!(:action_methods).include?('method_missing')
|
||||
assert ! @controller.__send__(:action_methods).include?('method_missing')
|
||||
|
||||
get :method_missing
|
||||
assert_response :success
|
||||
|
|
|
@ -27,7 +27,7 @@ class FilterParamTest < Test::Unit::TestCase
|
|||
|
||||
test_hashes.each do |before_filter, after_filter, filter_words|
|
||||
FilterParamController.filter_parameter_logging(*filter_words)
|
||||
assert_equal after_filter, @controller.send!(:filter_parameters, before_filter)
|
||||
assert_equal after_filter, @controller.__send__(:filter_parameters, before_filter)
|
||||
|
||||
filter_words.push('blah')
|
||||
FilterParamController.filter_parameter_logging(*filter_words) do |key, value|
|
||||
|
@ -37,7 +37,7 @@ class FilterParamTest < Test::Unit::TestCase
|
|||
before_filter['barg'] = {'bargain'=>'gain', 'blah'=>'bar', 'bar'=>{'bargain'=>{'blah'=>'foo'}}}
|
||||
after_filter['barg'] = {'bargain'=>'niag', 'blah'=>'[FILTERED]', 'bar'=>{'bargain'=>{'blah'=>'[FILTERED]'}}}
|
||||
|
||||
assert_equal after_filter, @controller.send!(:filter_parameters, before_filter)
|
||||
assert_equal after_filter, @controller.__send__(:filter_parameters, before_filter)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -364,7 +364,7 @@ class FilterTest < Test::Unit::TestCase
|
|||
begin
|
||||
yield
|
||||
rescue ErrorToRescue => ex
|
||||
controller.send! :render, :text => "I rescued this: #{ex.inspect}"
|
||||
controller.__send__ :render, :text => "I rescued this: #{ex.inspect}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -243,7 +243,7 @@ class IntegrationTestUsesCorrectClass < ActionController::IntegrationTest
|
|||
reset!
|
||||
stub_integration_session(@integration_session)
|
||||
%w( get post head put delete ).each do |verb|
|
||||
assert_nothing_raised("'#{verb}' should use integration test methods") { send!(verb, '/') }
|
||||
assert_nothing_raised("'#{verb}' should use integration test methods") { __send__(verb, '/') }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,7 +4,7 @@ module ActiveModel
|
|||
module Validations
|
||||
def self.included(base) # :nodoc:
|
||||
base.extend(ClassMethods)
|
||||
base.send!(:include, ActiveSupport::Callbacks)
|
||||
base.__send__(:include, ActiveSupport::Callbacks)
|
||||
base.define_callbacks :validate, :validate_on_create, :validate_on_update
|
||||
end
|
||||
|
||||
|
|
|
@ -1012,7 +1012,7 @@ module ActiveResource
|
|||
end
|
||||
|
||||
def split_options(options = {})
|
||||
self.class.send!(:split_options, options)
|
||||
self.class.__send__(:split_options, options)
|
||||
end
|
||||
|
||||
def method_missing(method_symbol, *arguments) #:nodoc:
|
||||
|
|
|
@ -109,11 +109,11 @@ module ActiveResource
|
|||
|
||||
private
|
||||
def custom_method_element_url(method_name, options = {})
|
||||
"#{self.class.prefix(prefix_options)}#{self.class.collection_name}/#{id}/#{method_name}.#{self.class.format.extension}#{self.class.send!(:query_string, options)}"
|
||||
"#{self.class.prefix(prefix_options)}#{self.class.collection_name}/#{id}/#{method_name}.#{self.class.format.extension}#{self.class.__send__(:query_string, options)}"
|
||||
end
|
||||
|
||||
def custom_method_new_element_url(method_name, options = {})
|
||||
"#{self.class.prefix(prefix_options)}#{self.class.collection_name}/new/#{method_name}.#{self.class.format.extension}#{self.class.send!(:query_string, options)}"
|
||||
"#{self.class.prefix(prefix_options)}#{self.class.collection_name}/new/#{method_name}.#{self.class.format.extension}#{self.class.__send__(:query_string, options)}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -19,7 +19,7 @@ class AuthorizationTest < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_authorization_header
|
||||
authorization_header = @authenticated_conn.send!(:authorization_header)
|
||||
authorization_header = @authenticated_conn.__send__(:authorization_header)
|
||||
assert_equal @authorization_request_header['Authorization'], authorization_header['Authorization']
|
||||
authorization = authorization_header["Authorization"].to_s.split
|
||||
|
||||
|
@ -29,7 +29,7 @@ class AuthorizationTest < Test::Unit::TestCase
|
|||
|
||||
def test_authorization_header_with_username_but_no_password
|
||||
@conn = ActiveResource::Connection.new("http://david:@localhost")
|
||||
authorization_header = @conn.send!(:authorization_header)
|
||||
authorization_header = @conn.__send__(:authorization_header)
|
||||
authorization = authorization_header["Authorization"].to_s.split
|
||||
|
||||
assert_equal "Basic", authorization[0]
|
||||
|
@ -38,7 +38,7 @@ class AuthorizationTest < Test::Unit::TestCase
|
|||
|
||||
def test_authorization_header_with_password_but_no_username
|
||||
@conn = ActiveResource::Connection.new("http://:test123@localhost")
|
||||
authorization_header = @conn.send!(:authorization_header)
|
||||
authorization_header = @conn.__send__(:authorization_header)
|
||||
authorization = authorization_header["Authorization"].to_s.split
|
||||
|
||||
assert_equal "Basic", authorization[0]
|
||||
|
@ -47,7 +47,7 @@ class AuthorizationTest < Test::Unit::TestCase
|
|||
|
||||
def test_authorization_header_with_decoded_credentials_from_url
|
||||
@conn = ActiveResource::Connection.new("http://my%40email.com:%31%32%33@localhost")
|
||||
authorization_header = @conn.send!(:authorization_header)
|
||||
authorization_header = @conn.__send__(:authorization_header)
|
||||
authorization = authorization_header["Authorization"].to_s.split
|
||||
|
||||
assert_equal "Basic", authorization[0]
|
||||
|
@ -58,7 +58,7 @@ class AuthorizationTest < Test::Unit::TestCase
|
|||
@authenticated_conn = ActiveResource::Connection.new("http://@localhost")
|
||||
@authenticated_conn.user = 'david'
|
||||
@authenticated_conn.password = 'test123'
|
||||
authorization_header = @authenticated_conn.send!(:authorization_header)
|
||||
authorization_header = @authenticated_conn.__send__(:authorization_header)
|
||||
assert_equal @authorization_request_header['Authorization'], authorization_header['Authorization']
|
||||
authorization = authorization_header["Authorization"].to_s.split
|
||||
|
||||
|
@ -69,7 +69,7 @@ class AuthorizationTest < Test::Unit::TestCase
|
|||
def test_authorization_header_explicitly_setting_username_but_no_password
|
||||
@conn = ActiveResource::Connection.new("http://@localhost")
|
||||
@conn.user = "david"
|
||||
authorization_header = @conn.send!(:authorization_header)
|
||||
authorization_header = @conn.__send__(:authorization_header)
|
||||
authorization = authorization_header["Authorization"].to_s.split
|
||||
|
||||
assert_equal "Basic", authorization[0]
|
||||
|
@ -79,7 +79,7 @@ class AuthorizationTest < Test::Unit::TestCase
|
|||
def test_authorization_header_explicitly_setting_password_but_no_username
|
||||
@conn = ActiveResource::Connection.new("http://@localhost")
|
||||
@conn.password = "test123"
|
||||
authorization_header = @conn.send!(:authorization_header)
|
||||
authorization_header = @conn.__send__(:authorization_header)
|
||||
authorization = authorization_header["Authorization"].to_s.split
|
||||
|
||||
assert_equal "Basic", authorization[0]
|
||||
|
@ -116,7 +116,7 @@ class AuthorizationTest < Test::Unit::TestCase
|
|||
protected
|
||||
def assert_response_raises(klass, code)
|
||||
assert_raise(klass, "Expected response code #{code} to raise #{klass}") do
|
||||
@conn.send!(:handle_response, Response.new(code))
|
||||
@conn.__send__(:handle_response, Response.new(code))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -84,7 +84,7 @@ class BaseLoadTest < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_load_collection_with_unknown_resource
|
||||
Person.send!(:remove_const, :Address) if Person.const_defined?(:Address)
|
||||
Person.__send__(:remove_const, :Address) if Person.const_defined?(:Address)
|
||||
assert !Person.const_defined?(:Address), "Address shouldn't exist until autocreated"
|
||||
addresses = silence_warnings { @person.load(:addresses => @addresses).addresses }
|
||||
assert Person.const_defined?(:Address), "Address should have been autocreated"
|
||||
|
@ -100,7 +100,7 @@ class BaseLoadTest < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_load_collection_with_single_unknown_resource
|
||||
Person.send!(:remove_const, :Address) if Person.const_defined?(:Address)
|
||||
Person.__send__(:remove_const, :Address) if Person.const_defined?(:Address)
|
||||
assert !Person.const_defined?(:Address), "Address shouldn't exist until autocreated"
|
||||
addresses = silence_warnings { @person.load(:addresses => [ @first_address ]).addresses }
|
||||
assert Person.const_defined?(:Address), "Address should have been autocreated"
|
||||
|
|
|
@ -468,7 +468,7 @@ class BaseTest < Test::Unit::TestCase
|
|||
|
||||
def test_prefix
|
||||
assert_equal "/", Person.prefix
|
||||
assert_equal Set.new, Person.send!(:prefix_parameters)
|
||||
assert_equal Set.new, Person.__send__(:prefix_parameters)
|
||||
end
|
||||
|
||||
def test_set_prefix
|
||||
|
@ -504,7 +504,7 @@ class BaseTest < Test::Unit::TestCase
|
|||
def test_custom_prefix
|
||||
assert_equal '/people//', StreetAddress.prefix
|
||||
assert_equal '/people/1/', StreetAddress.prefix(:person_id => 1)
|
||||
assert_equal [:person_id].to_set, StreetAddress.send!(:prefix_parameters)
|
||||
assert_equal [:person_id].to_set, StreetAddress.__send__(:prefix_parameters)
|
||||
end
|
||||
|
||||
def test_find_by_id
|
||||
|
@ -607,10 +607,10 @@ class BaseTest < Test::Unit::TestCase
|
|||
def test_id_from_response
|
||||
p = Person.new
|
||||
resp = {'Location' => '/foo/bar/1'}
|
||||
assert_equal '1', p.send!(:id_from_response, resp)
|
||||
assert_equal '1', p.__send__(:id_from_response, resp)
|
||||
|
||||
resp['Location'] << '.xml'
|
||||
assert_equal '1', p.send!(:id_from_response, resp)
|
||||
assert_equal '1', p.__send__(:id_from_response, resp)
|
||||
end
|
||||
|
||||
def test_create_with_custom_prefix
|
||||
|
|
|
@ -185,6 +185,6 @@ class ConnectionTest < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def handle_response(response)
|
||||
@conn.send!(:handle_response, response)
|
||||
@conn.__send__(:handle_response, response)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
class Object
|
||||
unless respond_to?(:send!)
|
||||
# Anticipating Ruby 1.9 neutering send
|
||||
alias send! send
|
||||
end
|
||||
|
||||
# A Ruby-ized realization of the K combinator, courtesy of Mikael Brockman.
|
||||
#
|
||||
# def foo
|
||||
|
|
|
@ -78,7 +78,7 @@ module ActiveSupport #:nodoc:
|
|||
#
|
||||
# Time.utc(2000).in_time_zone('Alaska') # => Fri, 31 Dec 1999 15:00:00 AKST -09:00
|
||||
def in_time_zone(zone = ::Time.zone)
|
||||
ActiveSupport::TimeWithZone.new(utc? ? self : getutc, ::Time.send!(:get_zone, zone))
|
||||
ActiveSupport::TimeWithZone.new(utc? ? self : getutc, ::Time.__send__(:get_zone, zone))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -11,7 +11,7 @@ module ActiveSupport
|
|||
private
|
||||
def method_missing(method, *arguments, &block)
|
||||
arguments << (arguments.last.respond_to?(:to_hash) ? @options.deep_merge(arguments.pop) : @options.dup)
|
||||
@context.send!(method, *arguments, &block)
|
||||
@context.__send__(method, *arguments, &block)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -36,7 +36,11 @@ module Test
|
|||
# post :delete, :id => ...
|
||||
# end
|
||||
def assert_difference(expressions, difference = 1, message = nil, &block)
|
||||
expression_evaluations = Array(expressions).collect{ |expression| lambda { eval(expression, block.send!(:binding)) } }
|
||||
expression_evaluations = Array(expressions).map do |expression|
|
||||
lambda do
|
||||
eval(expression, block.__send__(:binding))
|
||||
end
|
||||
end
|
||||
|
||||
original_values = expression_evaluations.inject([]) { |memo, expression| memo << expression.call }
|
||||
yield
|
||||
|
|
|
@ -275,7 +275,7 @@ module ActiveSupport
|
|||
end
|
||||
|
||||
def marshal_load(variables)
|
||||
initialize(variables[0].utc, ::Time.send!(:get_zone, variables[1]), variables[2].utc)
|
||||
initialize(variables[0].utc, ::Time.__send__(:get_zone, variables[1]), variables[2].utc)
|
||||
end
|
||||
|
||||
# Ensure proxy class responds to all methods that underlying time instance responds to.
|
||||
|
|
|
@ -62,7 +62,7 @@ class HashExtTest < Test::Unit::TestCase
|
|||
@symbols = @symbols.with_indifferent_access
|
||||
@mixed = @mixed.with_indifferent_access
|
||||
|
||||
assert_equal 'a', @strings.send!(:convert_key, :a)
|
||||
assert_equal 'a', @strings.__send__(:convert_key, :a)
|
||||
|
||||
assert_equal 1, @strings.fetch('a')
|
||||
assert_equal 1, @strings.fetch(:a.to_s)
|
||||
|
@ -75,9 +75,9 @@ class HashExtTest < Test::Unit::TestCase
|
|||
|
||||
hashes.each do |name, hash|
|
||||
method_map.sort_by { |m| m.to_s }.each do |meth, expected|
|
||||
assert_equal(expected, hash.send!(meth, 'a'),
|
||||
assert_equal(expected, hash.__send__(meth, 'a'),
|
||||
"Calling #{name}.#{meth} 'a'")
|
||||
assert_equal(expected, hash.send!(meth, :a),
|
||||
assert_equal(expected, hash.__send__(meth, :a),
|
||||
"Calling #{name}.#{meth} :a")
|
||||
end
|
||||
end
|
||||
|
@ -733,7 +733,7 @@ class HashToXmlTest < Test::Unit::TestCase
|
|||
|
||||
def test_empty_string_works_for_typecast_xml_value
|
||||
assert_nothing_raised do
|
||||
Hash.send!(:typecast_xml_value, "")
|
||||
Hash.__send__(:typecast_xml_value, "")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -108,11 +108,6 @@ class ClassExtTest < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
class ObjectTests < Test::Unit::TestCase
|
||||
def test_send_bang_aliases_send_before_19
|
||||
assert_respond_to 'a', :send!
|
||||
assert_equal 1, 'a'.send!(:size)
|
||||
end
|
||||
|
||||
def test_suppress_re_raises
|
||||
assert_raises(LoadError) { suppress(ArgumentError) {raise LoadError} }
|
||||
end
|
||||
|
|
|
@ -146,42 +146,42 @@ class DependenciesTest < Test::Unit::TestCase
|
|||
def test_directories_manifest_as_modules_unless_const_defined
|
||||
with_loading 'autoloading_fixtures' do
|
||||
assert_kind_of Module, ModuleFolder
|
||||
Object.send! :remove_const, :ModuleFolder
|
||||
Object.__send__ :remove_const, :ModuleFolder
|
||||
end
|
||||
end
|
||||
|
||||
def test_module_with_nested_class
|
||||
with_loading 'autoloading_fixtures' do
|
||||
assert_kind_of Class, ModuleFolder::NestedClass
|
||||
Object.send! :remove_const, :ModuleFolder
|
||||
Object.__send__ :remove_const, :ModuleFolder
|
||||
end
|
||||
end
|
||||
|
||||
def test_module_with_nested_inline_class
|
||||
with_loading 'autoloading_fixtures' do
|
||||
assert_kind_of Class, ModuleFolder::InlineClass
|
||||
Object.send! :remove_const, :ModuleFolder
|
||||
Object.__send__ :remove_const, :ModuleFolder
|
||||
end
|
||||
end
|
||||
|
||||
def test_directories_may_manifest_as_nested_classes
|
||||
with_loading 'autoloading_fixtures' do
|
||||
assert_kind_of Class, ClassFolder
|
||||
Object.send! :remove_const, :ClassFolder
|
||||
Object.__send__ :remove_const, :ClassFolder
|
||||
end
|
||||
end
|
||||
|
||||
def test_class_with_nested_class
|
||||
with_loading 'autoloading_fixtures' do
|
||||
assert_kind_of Class, ClassFolder::NestedClass
|
||||
Object.send! :remove_const, :ClassFolder
|
||||
Object.__send__ :remove_const, :ClassFolder
|
||||
end
|
||||
end
|
||||
|
||||
def test_class_with_nested_inline_class
|
||||
with_loading 'autoloading_fixtures' do
|
||||
assert_kind_of Class, ClassFolder::InlineClass
|
||||
Object.send! :remove_const, :ClassFolder
|
||||
Object.__send__ :remove_const, :ClassFolder
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -190,7 +190,7 @@ class DependenciesTest < Test::Unit::TestCase
|
|||
assert_kind_of Class, ClassFolder::ClassFolderSubclass
|
||||
assert_kind_of Class, ClassFolder
|
||||
assert_equal 'indeed', ClassFolder::ClassFolderSubclass::ConstantInClassFolder
|
||||
Object.send! :remove_const, :ClassFolder
|
||||
Object.__send__ :remove_const, :ClassFolder
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -199,7 +199,7 @@ class DependenciesTest < Test::Unit::TestCase
|
|||
sibling = ModuleFolder::NestedClass.class_eval "NestedSibling"
|
||||
assert defined?(ModuleFolder::NestedSibling)
|
||||
assert_equal ModuleFolder::NestedSibling, sibling
|
||||
Object.send! :remove_const, :ModuleFolder
|
||||
Object.__send__ :remove_const, :ModuleFolder
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -208,7 +208,7 @@ class DependenciesTest < Test::Unit::TestCase
|
|||
assert ! defined?(ModuleFolder)
|
||||
assert_raises(NameError) { ModuleFolder::Object }
|
||||
assert_raises(NameError) { ModuleFolder::NestedClass::Object }
|
||||
Object.send! :remove_const, :ModuleFolder
|
||||
Object.__send__ :remove_const, :ModuleFolder
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -488,7 +488,7 @@ Run `rake gems:install` to install the missing gems.
|
|||
# If assigned value cannot be matched to a TimeZone, an exception will be raised.
|
||||
def initialize_time_zone
|
||||
if configuration.time_zone
|
||||
zone_default = Time.send!(:get_zone, configuration.time_zone)
|
||||
zone_default = Time.__send__(:get_zone, configuration.time_zone)
|
||||
unless zone_default
|
||||
raise %{Value assigned to config.time_zone not recognized. Run "rake -D time" for a list of tasks for finding appropriate time zone names.}
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue