We usually rely on VCR and WebMock to prevent any real network connection when running our unit tests.

You have some SVG files you want to use as icons on your website. How would you embed them?

Jasmine specs for the frontend often need some DOM elements to work with. Because creating them is such a common...

Jasmine specs that work with DOM elements often leave elements in the DOM after they're done. This will leak...

drafts.csswg.org

While in CSS zero is usually referenced without specifying a unit (e.g. padding: 0), you must not use a unitless...

Large Rails projects tend to define multiple custom ways to format Dates or DateTimes. This often leads to duplicated format...

sass >= 1.35.0 has the option quietDeps and silenceDeprecations to silence deprecation warnings from dependencies. quietDeps: No deprecation warnings for dependencies...

github.com

ActiveType::Object inherits from ActiveRecod::Base and is designed to behave like an ActiveRecord Object, just without the database...

Unpoly's [up-observe], [up-autosubmit] and [up-validate] as well as their programmatic variants up.observe() and up.autosubmit...

You can use ETags to allow clients to use cached responses, if your application would send the same contents as...

Here are a few common patterns that will probably lead to flaky specs. If you notice them in your specs...

tl;dr In RubyMine you can use find and replace with capture groups (.*?) and backreferences $1 (if you have several...

Ruby's standard library includes a class for creating temporary directories. Similar to Tempfile it creates a unique directory name...

To allow HTTP 304 responses, Rails offers the fresh_when method for controllers. The most common way is to pass...

For Rails models where only one of multiple attributes may be filled out at the same time, there is no...

greg.molnar.io

Greg Molnar has written a neat article about creating a single-file Rails app. This is not meant for production...

joshmcarthur.com

I recently wanted to add a model for address information but also wanted to add a unique index to those...

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

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

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

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

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

github.com

ruby-warning adds custom processing for warnings, including the ability to ignore specific warning messages, ignore warnings in specific files/directories...

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