aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorSean Griffin <sean@thoughtbot.com>2014-06-13 13:50:24 -0600
committerSean Griffin <sean@thoughtbot.com>2014-06-13 13:50:24 -0600
commit0c9287dc4ef3b025eddd8051a2f3d5427bfabf86 (patch)
tree487a8b80edec408b6183679f773d5650e7a19cf8 /activerecord
parent584498a61f56211871698a1db67dd9626c3cadfe (diff)
downloadrails-0c9287dc4ef3b025eddd8051a2f3d5427bfabf86.tar.gz
rails-0c9287dc4ef3b025eddd8051a2f3d5427bfabf86.tar.bz2
rails-0c9287dc4ef3b025eddd8051a2f3d5427bfabf86.zip
Reorder test which does not represent real world usage
We don't generally modify our classes at runtime like this. Let's create the instance after the class is created. Original commit doesn't imply that this was intentional behavior.
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/test/cases/attribute_methods_test.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/test/cases/attribute_methods_test.rb b/activerecord/test/cases/attribute_methods_test.rb
index a366caf875..f832ca3451 100644
--- a/activerecord/test/cases/attribute_methods_test.rb
+++ b/activerecord/test/cases/attribute_methods_test.rb
@@ -451,10 +451,10 @@ class AttributeMethodsTest < ActiveRecord::TestCase
end
def test_declared_suffixed_attribute_method_affects_respond_to_and_method_missing
- topic = @target.new(:title => 'Budget')
%w(_default _title_default _it! _candidate= able?).each do |suffix|
@target.class_eval "def attribute#{suffix}(*args) args end"
@target.attribute_method_suffix suffix
+ topic = @target.new(:title => 'Budget')
meth = "title#{suffix}"
assert topic.respond_to?(meth)
@@ -465,10 +465,10 @@ class AttributeMethodsTest < ActiveRecord::TestCase
end
def test_declared_affixed_attribute_method_affects_respond_to_and_method_missing
- topic = @target.new(:title => 'Budget')
[['mark_', '_for_update'], ['reset_', '!'], ['default_', '_value?']].each do |prefix, suffix|
@target.class_eval "def #{prefix}attribute#{suffix}(*args) args end"
@target.attribute_method_affix({ :prefix => prefix, :suffix => suffix })
+ topic = @target.new(:title => 'Budget')
meth = "#{prefix}title#{suffix}"
assert topic.respond_to?(meth)