Permalink
Browse files

Use __send__ instead of send

  • Loading branch information...
1 parent 806716c commit 90c4a7d215e7fb5108562248fa6270756e8e62b2 @untidy-hair untidy-hair committed Feb 1, 2014
@@ -46,7 +46,7 @@ def description
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
@@ -50,7 +50,7 @@ def in_context(context)
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
@@ -70,7 +70,7 @@ def guess_controller!(controller)
def route_recognized?
begin
- @context.send(:assert_routing,
+ @context.__send__(:assert_routing,
{ method: @method, path: @path },
@params)
@@ -68,7 +68,7 @@ def matches?(instance)
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
@@ -158,7 +158,7 @@ def outside_value
end
def find_outside_value
- case @subject.send(@attribute.to_s)
+ case @subject.__send__(@attribute.to_s)
when Fixnum
ARBITRARY_OUTSIDE_FIXNUM
when BigDecimal
@@ -6,7 +6,7 @@ def pretty_error_messages(obj) # :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
@@ -64,7 +64,7 @@ def allows_missing_confirmation
def set_confirmation(val)
setter = :"#{@confirmation_attribute}="
if @subject.respond_to?(setter)
- @subject.send(setter, val)
+ @subject.__send__(setter, val)
end
end
@@ -114,7 +114,7 @@ def create_record_in_database(options = {})
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 @@ def set_scoped_attributes
@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 @@ def validate_after_scope_change?
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 @@ def class_name
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
@@ -104,7 +104,7 @@ def model(options = {})
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

0 comments on commit 90c4a7d

Please sign in to comment.