Assert Multiple Differences in Minitest with assert_differences

02-Jun-2017 2813
There have been many times in my coding career that I've needed to test that multiple values change during an event.Maybe you want to check that a User, their Settings, and Posts all get deleted when a user removes their account. Technically you should be testing each of these individually, but in practice it's generally acceptable to make make multiple assertions per test as long as:The assertions are closely related in functionThe assertions are all simpleYou're consistent across your code base.
Use coupon code:

RUBYONRAILS

to get 30% discount on our bundle!
Prepare for your next tech interview with our comprehensive collection of programming interview guides. Covering JavaScript, Ruby on Rails, React, and Python, these highly-rated books offer thousands of essential questions and answers to boost your interview success. Buy our 'Ultimate Job Interview Preparation eBook Bundle' featuring 2200+ questions across multiple languages. Ultimate Job Interview Preparation eBook Bundle