Posts

Anonymous controller testing in Minitest

I believe binding.pry and Rspec respectively are the best things that could happen to Ruby world. I've been using both for the same time I've been using Ruby and I couldn't imagine using another testing library. Until recently, because I entered a project using Minitest.

Defining top-level scope methods in Ruby is risky

Defining methods in the top-level scope might immediately sound like a bad practice, but surprisingly, I’ve seen it appear in various Rails projects. Sometimes, this happens unintentionally, while other times, developers do it to make methods more accessible from different parts of the application. Here, I’ll explain why this approach is problematic and how it can happen without you even noticing.