aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/test
diff options
context:
space:
mode:
authorSam Pohlenz <sam@sampohlenz.com>2009-10-07 09:05:54 -0500
committerJoshua Peek <josh@joshpeek.com>2009-10-07 09:07:39 -0500
commitf8e91bda9c171dd0c31dbea95ba4e9ced4ee2547 (patch)
tree35edb91cb5059ac236ef1dbeed5fcc9d4fcf40c3 /activemodel/test
parent3916f0340e8714d36a64162be793192849a9e51f (diff)
downloadrails-f8e91bda9c171dd0c31dbea95ba4e9ced4ee2547.tar.gz
rails-f8e91bda9c171dd0c31dbea95ba4e9ced4ee2547.tar.bz2
rails-f8e91bda9c171dd0c31dbea95ba4e9ced4ee2547.zip
Don't share attribute matchers between classes [#3216 state:resolved]
Allows separate models that include ActiveModel::AttributeMethods to use different sets of attribute matchers. Signed-off-by: Joshua Peek <josh@joshpeek.com>
Diffstat (limited to 'activemodel/test')
-rw-r--r--activemodel/test/cases/attribute_methods_test.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/activemodel/test/cases/attribute_methods_test.rb b/activemodel/test/cases/attribute_methods_test.rb
new file mode 100644
index 0000000000..614c4a3645
--- /dev/null
+++ b/activemodel/test/cases/attribute_methods_test.rb
@@ -0,0 +1,20 @@
+require 'cases/helper'
+
+class ModelWithAttributes
+ include ActiveModel::AttributeMethods
+
+ attribute_method_suffix ''
+end
+
+class ModelWithAttributes2
+ include ActiveModel::AttributeMethods
+
+ attribute_method_suffix '_test'
+end
+
+class AttributeMethodsTest < ActiveModel::TestCase
+ test 'unrelated classes should not share attribute method matchers' do
+ assert_not_equal ModelWithAttributes.send(:attribute_method_matchers),
+ ModelWithAttributes2.send(:attribute_method_matchers)
+ end
+end