Reputation: 10773
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 there just a file I should require?
Upvotes: 3
Views: 600
Reputation: 10773
It's simple - just require test/unit/assertions:
require 'test/unit/assertions'
include Test::Unit::Assertions
Upvotes: 4