ActiveSupport::Testing::Assertions

module ActiveSupport::Testing::Assertions

Public Instance Methods

assert_changes(expression, message = nil, from: UNTRACKED, to: UNTRACKED) { || ... } Show source

Assertion that the result of evaluating an expression is changed before and after invoking the passed in block.

assert_changes 'Status.all_good?' do
  post :create, params: { status: { ok: false } }
end

You can pass the block as a string to be evaluated in the context of the block. A lambda can be passed for