aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/assertions/model_assertions.rb
blob: b807a8902f4200b6106650c9ca96a5079fa5588b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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