You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This commit adds an `after_teardown` logic to the `activemodel` test
suite which ensures that performed test incremented the `assertions`
counter at least once. Otherwise it raises an `AssertionlessTest` error.
This leads to a requirement for tests to be verbose about assertions
even if technically it may not be needed. For example a test like:
```ruby
def test_submitting_a_review_doesnt_raise
review.submit!
end
```
will have to at least become
```ruby
def test_submitting_a_review_doesnt_raise
assert_nothing_raised { review.submit! }
end
```
or preferably it should perform a semantically meaningful assertion
that will imply not exception being raised, for example:
```ruby
def test_submitting_a_review_doesnt_raise
review.submit!
assert_not_nil review.submitted_at
end
```
Overall while the requirement is being defensive it improves
readability of the tests along with ensuring that we will never
end up having tests that test nothing.
0 commit comments