instance method
assert_no_difference
Ruby on Rails 3.0.20
Since v2.3.18Signature
assert_no_difference(expression, message = nil, &block)
Assertion that the numeric result of evaluating an expression is not changed before and after invoking the passed in block.
assert_no_difference 'Article.count' do post :create, :article => invalid_attributes end
A error message can be specified.
assert_no_difference 'Article.count', "An Article should not be destroyed" do post :create, :article => invalid_attributes end
Parameters
-
expressionreq -
messageopt = nil -
blockblock
Source
# File activesupport/lib/active_support/testing/assertions.rb, line 63
def assert_no_difference(expression, message = nil, &block)
assert_difference expression, 0, message, &block
end
Defined in activesupport/lib/active_support/testing/assertions.rb line 63
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveSupport::Testing::Assertions