RSpec: Inferring spec type from file location

Posted Over 2 years ago by Emanuel.

RSpec Rails can automatically mix in different behaviors to your tests based on their type tag, for example enabling you...

RSpec: Define negated matcher

Posted Over 2 years ago by Julian.

You can use RSpec::Matchers.define_negated_matcher to define a negated version of an existing matcher. This is particularly useful...

Caching in Rails < 6.1 may down parts of your application when using public cache control

Posted Over 2 years ago by Dominic Beger.

Proxy caching is a good feature to serve your publicly visible application content faster and reduce load on your servers...

ImageMagick: Converting SVG to raster image formats like PNG or JPEG

Posted Over 2 years ago by Bruno Sedler.

ImageMagick can convert SVGs to raster image formats. Example for PNG: convert input.svg output.png If the SVG has a...

The TCF 2.0 (Tranparency and Consent Framework) standard, and what you should know about it

Posted Over 2 years ago by Tobias Kraze.

The Interactive Advertising Bureau (IAB) is a European marketing association which has introduced a standard how advertising can be served...

Ad blockers: How to debug blocked elements

Posted Over 2 years ago by Daniel Straßner.

Some users might use Adblock Plus or similar browser plugins to reduce the number of ads displayed. If you run...

ES6 imports are hoisted to the top

Posted Over 2 years ago by Henning Koch.

From Exploring ES6: Module imports are hoisted (internally moved to the beginning of the current scope). Therefore, it doesn’t...

Finding ancestors with Capybara

Posted Over 2 years ago by Michael Leimstädtner.
stackoverflow.com

Modern versions of Capybara include a finder method #ancestor which allows you to find a parental element using CSS or...

Ensure passing Jasmine specs from your Ruby E2E tests

Posted Over 2 years ago by Henning Koch.

Jasmine is a great way to unit test your JavaScript components without writing an expensive end-to-end test for...

Using feature flags to stabilize flaky E2E tests

Posted Over 2 years ago by Henning Koch.

A flaky test is a test that is often green, but sometimes red. It may only fail on some PCs...

Setup Sidekiq and Redis

Posted Over 2 years ago by Klaus Weidinger.

If you want Sidekiq to be able to talk to Redis on staging and production servers, you need to add...

RSpec: how to prevent the Rails debug page if you want to actually test for 404s

Posted Over 2 years ago by Klaus Weidinger.

Within development and test environments, Rails is usually configured to show a detailed debug page instead of 404s. However, there...

RSpec: automatic creation of VCR cassettes

Posted Over 2 years ago by Klaus Weidinger.

This RailsCast demonstrated a very convenient method to activate VCR for a spec by simply tagging it with :vcr.

RSpec: ". not_to include" behaves like ".to exclude"

Posted Over 2 years ago by Klaus Weidinger.

RSpec is smart when using the include-matcher in combination with .not_to. One could assume that .not_to include...

Git shortcut to rebase onto another branch

Posted Over 2 years ago by Michael Leimstädtner.

Inspired by recent "git shortcut" cards I figured it would be nice to have one of these for rebasing a...

Event delegation (without jQuery)

Posted Over 2 years ago by Henning Koch.

Event delegation is a pattern where a container element has a single event listener that handles events for all descendants...

Capybara can find links and fields by their [aria-label]

Posted Over 2 years ago by Henning Koch.

Sometimes a link or input field has no visible label. E.g. a text field with a magnifying glass icon 🔎 and...

Semantic HTML

Posted Over 2 years ago by Dominik Schöler.

Besides their default styling properties, HTML elements have a semantic meaning. For example, an h1 tag is usually styled with...

Ruby: You can nest regular expressions

Posted Over 2 years ago by Henning Koch.

Ruby lets you re-use existing RegExp objects by interpolating it into new patterns: locales_pattern = /de|en|fr|es/i...

RSpec matcher to compare two HTML fragments

Posted Over 2 years ago by Henning Koch.

The RSpec matcher tests if two HTML fragments are equivalent. Equivalency means: Whitespace is ignored Types of attribute quotes are...

Rails: Removing the cucumber-rails warning when setting cache_classes to false without Spring enabled

Posted Over 2 years ago by Emanuel.

We are using Spring in our tests for sequential test execution but not for parallel test execution. And Rails requires...

Working on the Linux command line: How to use bookmarks for directories

Posted Over 2 years ago.

Bookmarks for directories will be most helpful if you are forced to work in deeply nested projects. Then it's...

Working on the Linux command line: How to efficiently navigate up

Posted Over 2 years ago.

With cd .. you can navigate one directory up from the one you are at now. If you use that a...

Working on the Linux command line: How to bash `cd` with autocorrect

Posted Over 2 years ago.

There is an option you can set so that when using the cd command, small typos are automatically corrected. Add...