Double loading issue with Ruby default gems

Posted Almost 2 years ago by Emanuel.

Ruby includes many standard gems that are bundled into the Ruby installation. Here is an example for the gem strscan...

Do not forget mailer previews

Posted Almost 2 years ago by Niklas Hä..

When changing code in mailers, updating the corresponding mailer preview is easily forgotten. Mailer previews can be tested like other...

Show a JS fiddle in fullscreen

Posted Almost 2 years ago by Emanuel.

If you have a JS fiddle, you can open it in fullscreen by appending /show to the URL. Example: https://...

Debug file system access in a Rails application

Posted About 2 years ago by Tobias Kraze.

It might sometimes be useful to check whether your Rails application accesses the file system unnecessarily, for example if your...

Capybara: Most okayest helper to download and inspect files

Posted About 2 years ago by Henning Koch.

Testing file download links in an end-to-end test can be painful, especially with Selenium. The attached download_helpers.rb provides...

RSpec: How to turn off partial double verification temporarily

Posted About 2 years ago by Emanuel.

While verifying doubles in RSpec is a good default, it is limited in the amount of methods it actually is...

Project maintenance: four levels of code quality

Posted About 2 years ago by Dominik Schöler.

Code quality can be measured in four levels: (Working code) Reliable code (minimum) Readable code (ok for short-lived code...

Use DatabaseCleaner with multiple test databases

Posted About 2 years ago by Dominic Beger.

There is a way to use multiple databases in Rails. You may have asked yourself how you're able to...

How to bind an event listener only once with Unpoly

Posted About 2 years ago.

You can use Unpoly's up.on with a named listener function and immediately unbind this event listener with { once: true...

Chrome DevTools: List Registered Event Listeners

Posted About 2 years ago by Julian.

In Chrome DevTools you can use getEventListeners(object) to get a list of registered event listeners on the specified object...

How to get information about a gem (via CLI or at runtime from Ruby)

Posted About 2 years ago by Arne Hartherz.

When you need information about a gem (like version(s) or install path(s)), you can use the gem binary...

JavaScript: Working with Query Parameters

Posted About 2 years ago by Julian.

tl;dr: Use the URLSearchParams API to make your live easier if you want to get or manipulate query parameters...

Jasmine: Fixing common errors during initialization

Posted About 2 years ago by Henning Koch.

Due to the way we setup Jasmine tests in our projects, you may run into various errors when Jasmine boots...

Generating an Entity Relationship Diagram for your Rails application

Posted About 2 years ago by Arne Hartherz.

This card explains how to generate an entity relationship diagram for your Rails application. We also show how to limit...

Version 5 of the Ruby Redis gem removes Redis.current

Posted About 2 years ago by Arne Hartherz.

Redis.current will be removed without replacement in redis-rb 5.0. Version 4.6.0 adds deprecation warnings for Redis.current and Redis.current=: `Redis.current...

How to access Chrome Devtools when running JavaScript tests via CLI

Posted Over 2 years ago by Michael Leimstädtner.

While we are used to run our JavaScript tests on a test page within our Browser, it's also possible...

Jest: How to clear the cache

Posted Over 2 years ago by Michael Leimstädtner.

I recently was in a weird situation where my (Jest/CLI) tests were referencing a function that was no longer part...

RSpec: You can super into parent "let" definitions

Posted Over 2 years ago by Arne Hartherz.

RSpec's let allows you to super into "outside" definitions, in parent contexts. Example: describe '#save' do subject { described_class.new(attributes...

Integrating ESLint

Posted Over 2 years ago.

To ensure a consistent code style for JavaScript code, we use ESLint. The workflow is similar to integrating rubocop...

How to add esbuild to the rails asset pipeline

Posted Over 2 years ago.

This are the steps I needed to do to add esbuild to an application that used the vanilla rails asset...

PostgreSQL: "WHERE NOT <column> = '<value>'" statements do not include NULL values

Posted Over 2 years ago by Jakob Scholz.

Sometimes we write plain SQL queries in migrations so we don't have to mock ActiveRecord classes. These two migrations...

Carrierwave: How to attach files in tests

Posted Over 2 years ago by Emanuel.

Attaching files to a field that is handled by Carrierwave uploaders (or maybe any other attachment solution for Rails) in...

Deployment: Merge consecutive commits without cherry-picking

Posted Over 2 years ago by Julian.

You want to deploy new features but the latest commits are not ready for production? Then use git merge master...

Capybara: Finding invisible elements and how to test that an element is not visible

Posted Over 2 years ago by Arne Hartherz.
github.com

When Capybara locates elements in the DOM, by default it allows only accessing visible elements -- when you are using a...