Skip to content

Instantly share code, notes, and snippets.

@hardbap
Created March 23, 2009 14:23
Show Gist options
  • Save hardbap/83564 to your computer and use it in GitHub Desktop.
Save hardbap/83564 to your computer and use it in GitHub Desktop.
# 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