diff --git a/lib/shoulda/matchers/action_controller/redirect_to_matcher.rb b/lib/shoulda/matchers/action_controller/redirect_to_matcher.rb index e0f222cb..c5a959cb 100644 --- a/lib/shoulda/matchers/action_controller/redirect_to_matcher.rb +++ b/lib/shoulda/matchers/action_controller/redirect_to_matcher.rb @@ -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 diff --git a/lib/shoulda/matchers/action_controller/render_template_matcher.rb b/lib/shoulda/matchers/action_controller/render_template_matcher.rb index 1b9d485a..a6024915 100644 --- a/lib/shoulda/matchers/action_controller/render_template_matcher.rb +++ b/lib/shoulda/matchers/action_controller/render_template_matcher.rb @@ -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 diff --git a/lib/shoulda/matchers/action_controller/route_matcher.rb b/lib/shoulda/matchers/action_controller/route_matcher.rb index 02b3b4ae..40495fba 100644 --- a/lib/shoulda/matchers/action_controller/route_matcher.rb +++ b/lib/shoulda/matchers/action_controller/route_matcher.rb @@ -70,7 +70,7 @@ module Shoulda # :nodoc: def route_recognized? begin - @context.send(:assert_routing, + @context.__send__(:assert_routing, { method: @method, path: @path }, @params) diff --git a/lib/shoulda/matchers/active_model/allow_value_matcher.rb b/lib/shoulda/matchers/active_model/allow_value_matcher.rb index fee0810c..d0d9c49a 100644 --- a/lib/shoulda/matchers/active_model/allow_value_matcher.rb +++ b/lib/shoulda/matchers/active_model/allow_value_matcher.rb @@ -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 diff --git a/lib/shoulda/matchers/active_model/ensure_inclusion_of_matcher.rb b/lib/shoulda/matchers/active_model/ensure_inclusion_of_matcher.rb index 35d53146..98a275fd 100644 --- a/lib/shoulda/matchers/active_model/ensure_inclusion_of_matcher.rb +++ b/lib/shoulda/matchers/active_model/ensure_inclusion_of_matcher.rb @@ -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 diff --git a/lib/shoulda/matchers/active_model/helpers.rb b/lib/shoulda/matchers/active_model/helpers.rb index 6b46ccd8..b3e3bb7a 100644 --- a/lib/shoulda/matchers/active_model/helpers.rb +++ b/lib/shoulda/matchers/active_model/helpers.rb @@ -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 diff --git a/lib/shoulda/matchers/active_model/validate_confirmation_of_matcher.rb b/lib/shoulda/matchers/active_model/validate_confirmation_of_matcher.rb index e6278964..45b68bdd 100644 --- a/lib/shoulda/matchers/active_model/validate_confirmation_of_matcher.rb +++ b/lib/shoulda/matchers/active_model/validate_confirmation_of_matcher.rb @@ -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 diff --git a/lib/shoulda/matchers/active_model/validate_uniqueness_of_matcher.rb b/lib/shoulda/matchers/active_model/validate_uniqueness_of_matcher.rb index 4f074ce3..ee4d121e 100644 --- a/lib/shoulda/matchers/active_model/validate_uniqueness_of_matcher.rb +++ b/lib/shoulda/matchers/active_model/validate_uniqueness_of_matcher.rb @@ -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 diff --git a/spec/shoulda/matchers/active_record/have_db_column_matcher_spec.rb b/spec/shoulda/matchers/active_record/have_db_column_matcher_spec.rb index 164ec7f2..65771eea 100644 --- a/spec/shoulda/matchers/active_record/have_db_column_matcher_spec.rb +++ b/spec/shoulda/matchers/active_record/have_db_column_matcher_spec.rb @@ -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