Leanpub Header

Skip to main content

Testing Rails from Scratch

Community discussions

Aaron SumnerAuthor
8/6/2026Announcements
Pinned

Hey, it's Aaron, author of Testing from Scratch. I'm glad you're here! Please use this forum for any questions you have about the book or suggestions to make it better.

Ben Sheldon
8/17/2026General

I wanted to note this statement is not true about using either test method or test block style:


> You may use either syntax in Rails


If your test class inherits from a Rails provided test class, you must use the block style, because built-in setup behavior relies on the block syntax plumbing and they may not run when using method style.

Ben Sheldon
8/17/2026General

I think you’re using the opposite ordering of assertion arguments to Rails. Apologies if you mention this and I overlooked it.


https://guides.rubyonrails.org/testing.html#minitest-assertions


Eg. according to Rails docs, an example should be assert_equal(2, 1+1)


As I understand, junit style libraries are very inconsistent on this, but I wanted to note Rails convention.