Forked from hardbap/should_accept_nested_attributes_for.rb
Created
October 19, 2009 16:43
-
-
Save jamesbebbington/213507 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
class Test::Unit::TestCase | |
# Assert that the model accepts nested attributes for the given +associations+ | |
# | |
# Example: | |
# should_accept_nested_attributes_for :orders | |
# | |
def self.should_accept_nested_attributes_for(*associations) | |
associations.each do |association| | |
should "accept nested attributes for #{association}" do | |
assert subject.respond_to?("#{association}_attributes="), "#{subject.class} does not accept nested attributes for association: #{association}" | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment