diff options
author | Prem Sichanugrist <s@sikachu.com> | 2011-04-11 00:52:42 +0800 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2011-04-11 03:17:09 +0800 |
commit | a9f3c9da01d721963d05949604ead909aaabbf36 (patch) | |
tree | 5e278655997e1dcf86d9e0ee2f6be30d323fc8b4 /activerecord/test/cases/attribute_methods | |
parent | 635d991683c439da56fa72853880e88e6ac291ed (diff) | |
download | rails-a9f3c9da01d721963d05949604ead909aaabbf36.tar.gz rails-a9f3c9da01d721963d05949604ead909aaabbf36.tar.bz2 rails-a9f3c9da01d721963d05949604ead909aaabbf36.zip |
Using Object#in? and Object#either? in various places
There're a lot of places in Rails source code which make a lot of sense to switching to Object#in? or Object#either? instead of using [].include?.
Diffstat (limited to 'activerecord/test/cases/attribute_methods')
-rw-r--r-- | activerecord/test/cases/attribute_methods/read_test.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/activerecord/test/cases/attribute_methods/read_test.rb b/activerecord/test/cases/attribute_methods/read_test.rb index d0a9028264..3641031d12 100644 --- a/activerecord/test/cases/attribute_methods/read_test.rb +++ b/activerecord/test/cases/attribute_methods/read_test.rb @@ -1,4 +1,5 @@ require "cases/helper" +require 'active_support/core_ext/object/inclusion' module ActiveRecord module AttributeMethods @@ -41,13 +42,13 @@ module ActiveRecord instance = @klass.new @klass.column_names.each do |name| - assert ! instance.methods.map(&:to_s).include?(name) + assert !name.in?(instance.methods.map(&:to_s)) end @klass.define_attribute_methods @klass.column_names.each do |name| - assert(instance.methods.map(&:to_s).include?(name), "#{name} is not defined") + assert name.in?(instance.methods.map(&:to_s)), "#{name} is not defined" end end |