The attached compiler() function below applies JavaScript behavior to matching HTML elements as they enter the DOM. This works like an Unpoly compiler for apps that don't use Unpoly...
Capybara has a variety of finder methods like find_button to help you look up DOM elements. There are also...
We often have a separate production branch that lags a bit behind the more cutting edge main branch. Sometimes you want to move some, but not all commits from main...
We're always striving towards keeping our website's JavaScript as small as possible. If you're using webpack(er...
I frequently find myself needing a combination of group_by, count and sort for quick statistics. Here's a method...
Using git fixup helps you to speed up appending changes further back in the git history of your feature branch...
Enable local logging for Sentry when: Debugging Sentry event capture locally Testing error handling without polluting production metrics Developing background...
This guide shows how to create an AngularJS application that consumes more and more memory until, eventually, the browser process...
...only because your step definition requires that. Here's a typical step definitions that benefits from using find_by_anything: When /^I sign in as "([^\"]+)")$/ do |identifier| user = User.find_by...
...Capybara see the print stylesheet Capybara always requests as the screen medium. The step belows reloads the current page with a query param we will use in our layout to...
Capybara and most assistive technology will fail to find tags that are missing an href attribute. This will probably happen...
...DateTime.strptime is not what you want You may eventually encounter DateTime.strptime. It's a "better" Time.parse where you can actually define the date format to parse, e.g. >> DateTime.strptime...
...If you use Rails' time_zone_select, you will be juggling zone names like "Berlin" which are actually unsupported. Unsupported zone identifiers are silently discarded and you'll end up...
If you have a fully functional CI pipeline but no CD, you might find yourself frequently waiting for CI (with...
...you can use a special form options helper called #collection_check_boxes. It behaves similar to #collection_select, but instead of a single select field it renders a checkbox and...
...cat tmp/parallel_cucumber_failures.log | xargs geordi cucumber # Running features > Only: features/authentication.feature:33 features/backend/pages.feature:5 features/backend/pages.feature:60 ... Beside the linked article you might also be interested in reading An Opinionated Guide to xargs...
By default parallel_tests will spawn as many test processes as you have CPUs. If you have issues with flaky...
...component is using this class to render and modify some html, it may fastly become boilerplate to define every call of the method. Here callFake comes in handy, because it...
...of any dependent on the received arguments without having to know the exact arguments beforehand: spyOn(Random, 'shuffle').and.callFake((array) => array.reverse()) Now you can just assume any result of your...
In modern default RSpec configurations, your tests are usually run in random order. This helps to detect "flickering" tests that...
Array.wrap wraps argument in an array, unless it is array-like already. The behaviour is a bit saner than Array[...]. Array.wrap(nil) # => []
" foo bar \n \t boo".squish # => "foo bar boo" Time.current, Date.current, DateTime.current behaves like .now or .zone.now depending on whether a time zone is set
...in development + test, but keep action_on_unpermitted_parameters = false in production, your application behaves different between these environments. On the other hand it forces to fix these errors in...
...Parameters).to receive(:action_on_unpermitted_parameters).and_return(false) for tests, that should behave exactly like in production...
In development, we store files using ActiveStorage's disk service. This means that stored files are served by your Rails...
Tested on Ubunut 22.04 1. Opener script Create a file ~/.local/bin/coverage_zip_opener with: #!/bin/bash tmp_folder="/tmp/coverage-report-opener" if [ -z "$1" ]
This may be awkward to set up, but will work once you're done. Fun facts:
Recently we detected a memory leak in one of our applications. Hunting it down, we found that the memory leak...