rspec
I'm not a fan of most of RSpec's DSL, so appreciated this article from Test Double suggesting the use of Ruby 3's endless method syntax instead of using let.
def foo = bar.new
instead of
let foo { bar.new }
Not considered that before, and combined with using instance variables instead of let!, it reinforces and makes more obvious the difference.
Tags:
Just learned RSpec has an :aggregate_failures option, to show all failures in specs with multiple assertions.
Tags:
Added a helper script to a project that uses RSpec to replicate the default behaviour of Rails segregation of system tests and get faster feedback more easily.
Tags:
RSpec has a --bisect option which attempts to automatically find the smallest combination of specs causing a failure (use in conjunction with --seed).
Tags:
I really need to remember to use --only-failures more often when debugging RSpec specs.
Tags:
Writing a bunch of specs to both thoroughly test and document some API endpoints is giving me a good chance to test my testing abilities. Still struggling to decide on where the limits should be on what a spec is testing, but honestly I don't think there's a single right answer to that in many cases.