Skip to content

Instantly share code, notes, and snippets.

@brettbuddin
Created December 3, 2009 15:04
Show Gist options
  • Save brettbuddin/248219 to your computer and use it in GitHub Desktop.
Save brettbuddin/248219 to your computer and use it in GitHub Desktop.
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