Use __send__ instead of send

This commit is contained in:
Yukio Mizuta 2014-02-01 13:09:44 -08:00
parent 806716c79c
commit 90c4a7d215
9 changed files with 13 additions and 13 deletions

View File

@ -46,7 +46,7 @@ module Shoulda # :nodoc:
def redirects_to_url?
begin
@context.send(:assert_redirected_to, url)
@context.__send__(:assert_redirected_to, url)
@failure_message_when_negated = "Didn't expect to redirect to #{url}"
true
rescue Shoulda::Matchers::AssertionError => error

View File

@ -50,7 +50,7 @@ module Shoulda # :nodoc:
def renders_template?
begin
@context.send(:assert_template, @options, @message)
@context.__send__(:assert_template, @options, @message)
@failure_message_when_negated = "Didn't expect to render #{@template}"
true
rescue Shoulda::Matchers::AssertionError => error

View File

@ -70,7 +70,7 @@ module Shoulda # :nodoc:
def route_recognized?
begin
@context.send(:assert_routing,
@context.__send__(:assert_routing,
{ method: @method, path: @path },
@params)

View File

@ -68,7 +68,7 @@ module Shoulda # :nodoc:
values_to_match.none? do |value|
self.value = value
instance.send("#{attribute_to_set}=", value)
instance.__send__("#{attribute_to_set}=", value)
errors_match?
end
end

View File

@ -158,7 +158,7 @@ module Shoulda # :nodoc:
end
def find_outside_value
case @subject.send(@attribute.to_s)
case @subject.__send__(@attribute.to_s)
when Fixnum
ARBITRARY_OUTSIDE_FIXNUM
when BigDecimal

View File

@ -6,7 +6,7 @@ module Shoulda # :nodoc:
obj.errors.map do |attribute, model|
msg = "#{attribute} #{model}"
if attribute.to_sym != :base && obj.respond_to?(attribute)
msg << " (#{obj.send(attribute).inspect})"
msg << " (#{obj.__send__(attribute).inspect})"
end
msg
end

View File

@ -64,7 +64,7 @@ module Shoulda # :nodoc:
def set_confirmation(val)
setter = :"#{@confirmation_attribute}="
if @subject.respond_to?(setter)
@subject.send(setter, val)
@subject.__send__(setter, val)
end
end

View File

@ -114,7 +114,7 @@ module Shoulda # :nodoc:
end
@subject.class.new.tap do |instance|
instance.send("#{@attribute}=", value)
instance.__send__("#{@attribute}=", value)
if has_secure_password?
instance.password = 'password'
instance.password_confirmation = 'password'
@ -132,7 +132,7 @@ module Shoulda # :nodoc:
@options[:scopes].all? do |scope|
setter = :"#{scope}="
if @subject.respond_to?(setter)
@subject.send(setter, existing_record.send(scope))
@subject.__send__(setter, existing_record.__send__(scope))
true
else
@failure_message = "#{class_name} doesn't seem to have a #{scope} attribute."
@ -176,10 +176,10 @@ module Shoulda # :nodoc:
previous_value.to_s.next
end
@subject.send("#{scope}=", next_value)
@subject.__send__("#{scope}=", next_value)
if allows_value_of(existing_value, @expected_message)
@subject.send("#{scope}=", previous_value)
@subject.__send__("#{scope}=", previous_value)
@failure_message_when_negated <<
" (with different value of #{scope})"
@ -209,7 +209,7 @@ module Shoulda # :nodoc:
end
def existing_value
value = existing_record.send(@attribute)
value = existing_record.__send__(@attribute)
if @options[:case_insensitive] && value.respond_to?(:swapcase!)
value.swapcase!
end

View File

@ -104,7 +104,7 @@ describe Shoulda::Matchers::ActiveRecord::HaveDbColumnMatcher do
def with_table(column_name, column_type, options)
create_table 'employees' do |table|
table.send(column_type, column_name, options)
table.__send__(column_type, column_name, options)
end
define_model_class('Employee').new
end