Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
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>
- Loading branch information
Showing
2 changed files
with
24 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |