aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
authorTobias Lütke <tobias.luetke@gmail.com>2005-10-16 02:20:53 +0000
committerTobias Lütke <tobias.luetke@gmail.com>2005-10-16 02:20:53 +0000
commit0279949b055330209eb272ed642e1fe59536087d (patch)
tree0424c4875415012fd96af6ea13d0773977841465 /actionpack/lib
parent5e5c332c3ea906750c339c4776a60ec5aa18b0af (diff)
downloadrails-0279949b055330209eb272ed642e1fe59536087d.tar.gz
rails-0279949b055330209eb272ed642e1fe59536087d.tar.bz2
rails-0279949b055330209eb272ed642e1fe59536087d.zip
added assert_valid to AP
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2635 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/action_controller/assertions.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/actionpack/lib/action_controller/assertions.rb b/actionpack/lib/action_controller/assertions.rb
index e5f03fd71a..b29a2864a7 100644
--- a/actionpack/lib/action_controller/assertions.rb
+++ b/actionpack/lib/action_controller/assertions.rb
@@ -283,6 +283,13 @@ module Test #:nodoc:
assert_block(full_message) { expected_dom != actual_dom }
end
end
+
+ # 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
+ end
+ end
def clean_backtrace(&block)
begin