Fewer Flappier Failures

Posted by Denny at 01:50 on Fri, 08 Nov 2019

I've started to use capybara matchers for more robust (and more readable) tests. Using "expect( response.body ).to include 'string'" mostly works out okay, but it's not very selective. When you start trying to make sure things aren't there (e.g. when testing that page deletion works as expected) then "expect( response.body ).not_to include 'string'" can get quite fragile. Using the capybara has_css() matcher tends to be a lot more accurate, resulting in fewer false failures.

Tags: tests rspec capybara has_css

« Theme support, and a theme to go with it Code of Conduct »

Comments

No comments found