Created
December 3, 2009 15:04
-
-
Save brettbuddin/248219 to your computer and use it in GitHub Desktop.
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
module AcceptsNestedAttributesFor | |
def should_accept_nested_attributes_for(*models) | |
klass = self.name.gsub(/Test$/, '').constantize | |
models.each do |model| | |
should "accept nested attributes for #{model}" do | |
assert(klass.instance_methods.include?("#{model}_attributes="), | |
"#{klass} does not accept nested attributes for #{model}") | |
end | |
end | |
end | |
end | |
class ActiveSupport::TestCase | |
extend AcceptsNestedAttributesFor | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment