I'd like to start putting assertions in my controllers and models, to assert runtime behavior.
How can I access all of the assertion helpers that are available in unit tests?
I.E. I'd like to do something like
class WidgetController < ApplicationController
def index
@widgets = Widget.all
assert @widgets.length > 0 # using assert in a controller!
end
end
Is开发者_JS百科 there just a file I should require?
It's simple - just require test/unit/assertions:
require 'test/unit/assertions'
include Test::Unit::Assertions
精彩评论