aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/testing/assertions.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/lib/active_support/testing/assertions.rb')
-rw-r--r--activesupport/lib/active_support/testing/assertions.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/activesupport/lib/active_support/testing/assertions.rb b/activesupport/lib/active_support/testing/assertions.rb
index 411dd29df5..29305e0082 100644
--- a/activesupport/lib/active_support/testing/assertions.rb
+++ b/activesupport/lib/active_support/testing/assertions.rb
@@ -3,7 +3,7 @@ require 'active_support/core_ext/object/blank'
module ActiveSupport
module Testing
module Assertions
- # Assert that an expression is not truthy. Passes if <tt>object</tt> is
+ # Asserts that an expression is not truthy. Passes if <tt>object</tt> is
# +nil+ or +false+. "Truthy" means "considered true in a conditional"
# like <tt>if foo</tt>.
#
@@ -28,7 +28,7 @@ module ActiveSupport
#
# An arbitrary expression is passed in and evaluated.
#
- # assert_difference 'assigns(:article).comments(:reload).size' do
+ # assert_difference 'Article.last.comments(:reload).size' do
# post :create, params: { comment: {...} }
# end
#
@@ -68,13 +68,15 @@ module ActiveSupport
}
before = exps.map(&:call)
- yield
+ retval = yield
expressions.zip(exps).each_with_index do |(code, e), i|
error = "#{code.inspect} didn't change by #{difference}"
error = "#{message}.\n#{error}" if message
assert_equal(before[i] + difference, e.call, error)
end
+
+ retval
end
# Assertion that the numeric result of evaluating an expression is not