d25214bb66b953ed7b06d0b3d8f04512e0a6a9f4
[depot.git] / model_assertions.rb
1 module ActionController
2 module Assertions
3 module ModelAssertions
4 # Ensures that the passed record is valid by Active Record standards and
5 # returns any error messages if it is not.
6 #
7 # ==== Examples
8 #
9 # # assert that a newly created record is valid
10 # model = Model.new
11 # assert_valid(model)
12 #
13 def assert_valid(record)
14 clean_backtrace do
15 assert record.valid?, record.errors.full_messages.join("\n")
16 end
17 end
18 end
19 end
20 end