Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamesbebbington/213507 to your computer and use it in GitHub Desktop.
Save jamesbebbington/213507 to your computer and use it in GitHub Desktop.
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