From f12fdc50a69c3861add6b3ec53507f1c6a25e1cd Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sun, 3 Sep 2006 20:18:06 +0000 Subject: Better compartmentalizing of assertions git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4931 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- .../lib/action_controller/assertions/assert_valid.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 actionpack/lib/action_controller/assertions/assert_valid.rb (limited to 'actionpack/lib/action_controller/assertions/assert_valid.rb') diff --git a/actionpack/lib/action_controller/assertions/assert_valid.rb b/actionpack/lib/action_controller/assertions/assert_valid.rb new file mode 100644 index 0000000000..b807a8902f --- /dev/null +++ b/actionpack/lib/action_controller/assertions/assert_valid.rb @@ -0,0 +1,15 @@ +require 'test/unit' +require 'test/unit/assertions' + +module ActionController + module Assertions + module ModelAssertions + # ensures that the passed record is valid by active record standards. returns the error messages if not + def assert_valid(record) + clean_backtrace do + assert record.valid?, record.errors.full_messages.join("\n") + end + end + end + end +end \ No newline at end of file -- cgit v1.2.3