Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# Ensure that the model accepts nested attributes for association
#
# Example:
# should_accept_nested_attributes_for :orders
#
def should_accept_nested_attributes_for(*associations)
klass = model_class
associations.each do |association|
should "accept nested attributes for #{association}" do
assert klass.new.respond_to?("#{association}_attributes="), "#{klass} does not accept nested attributes for association: #{association}"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment