Testing controller concerns in Rails
18-Dec-2022 1211
Concerns are a great way to organize and de-duplicate code in Rails.One of my favorite use cases is to abstract everything out of the ApplicationController into concerns. This begs the question: how do you test these concerns?The approach for testing concerns is a bit of a judgement call as they're always mixed in with a class and aren't used on their own. Ideally we'd write tests to verify the behavior of a class which would also test the concern in the bargain.
Testing controller concerns in Rails #ruby #rubydeveloper #rubyonrails #Testing #controller #concerns #Rails #testing https://rubyonrails.ba/link/testing-controller-concerns-in-rails