aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
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