Module: ActiveSupport::Testing::TestsWithoutAssertions

Included in:
ActiveSupport::TestCase
Defined in:
lib/active_support/testing/tests_without_assertions.rb

Overview

Warns when a test case does not perform any assertions.

This is helpful in detecting broken tests that do not perform intended assertions.

Instance Method Summary collapse

Instance Method Details

#after_teardownObject

:nodoc:



9
10
11
12
13
14
15
16
# File 'lib/active_support/testing/tests_without_assertions.rb', line 9

def after_teardown
  super

  if assertions.zero? && !skipped? && !error?
    file, line = method(name).source_location
    warn "Test is missing assertions: `#{name}` #{file}:#{line}"
  end
end