Why validation matchers are the only Shoulda matchers I use
09-Jul-2020 1769
If you’re unfamiliar with Shoulda matchers, the premise, from the GitHub description, is: “Shoulda Matchers provides RSpec- and Minitest-compatible one-liners to test common Rails functionality that, if written by hand, would be much longer, more complex, and error-prone.”A few examples of specific Shoulda matchers are validates_presence_of (expects that a model attribute has a presence validator), have_many (expects that a has_many association exists), and redirect_to (expects that a redirection takes place).I like the idea of a library that can clean up a lot of my repetitive test code. Unfortunately, the majority of Shoulda matchers only apply to the kinds of tests I would never write.
Why validation matchers are the only Shoulda matchers I use #ruby #rubydeveloper #rubyonrails #validation #matchers #Shoulda #matchers https://rubyonrails.ba/link/why-validation-matchers-are-the-only-shoulda-matchers-i-use