Careful when using Time objects for generating ETags

Time values in ETag generation can lose millisecond precision, causing stale cache hits and flaky tests. Convert them to strings or numbers before combining cache keys.

How to set up database_cleaner for Rails with Cucumber and RSpec

Reliable test isolation for Rails with Cucumber and RSpec requires cleaning the test database up front and switching strategies for JavaScript-driven examples.

Capybara: Working with invisible elements

Capybara hides non-rendered nodes by default, so hidden UI elements need explicit visibility options to be found or asserted in tests.

Generating test images on the fly via JavaScript or Ruby

Create placeholder images dynamically as SVG data URIs in JavaScript or Ruby, avoiding external image services and keeping the graphic easily adjustable.

Heads up: Playwright 1.62.0+ might break hover states in your test suite

Playwright 1.62.0+ can trigger unexpected hover events in tests when the mouse stays at (0,0); moving the pointer offscreen avoids false positives.

A different testing approach with Minitest and Fixtures

Minitest and fixtures can speed up slow Rails test suites, especially where RSpec and FactoryBot add overhead. Minimal fixtures and explicit assertions keep tests maintainable.

Carrierwave: How to attach files in tests

CarrierWave uploads in tests often fail with multipart and file-assignment errors; common Rails and RSpec patterns attach fixtures with Rack::Test::UploadedFile, file_fixture, or attach_file.

HTTP Client in RubyMine

RubyMine’s built-in HTTP client tests web APIs from .http scratch files, supports sequential requests, and can reuse response data with JavaScript variables.

Gitlab: How to cancel redundant pipelines

Redundant GitLab CI pipelines can waste runner capacity when new pushes arrive. interruptible: true and auto-cancel help stop outdated test runs and keep the latest commit building.

How to set Chrome's time zone in Selenium tests

Chrome time-dependent behavior in Selenium tests can require a different browser timezone than the host system. Emulation.setTimezoneOverride changes it for the whole session and must be reset afterward.

TestProf II: Factory therapy for your Ruby tests—Martian Chronicles, Evil Martians’ team blog

Factories can make Ruby test suites slow by creating large association cascades and redundant records. TestProf helps identify factory hotspots with reports and flamegraphs.

Rails: Testing file downloads with request specs

File downloads are slow and fragile to test through Capybara. Request specs make exports fast, stable, and easy to verify, with a small end-to-end check for the link.

Heads up: RSpec-Mocks' #stub_const will define intermediate modules that have not been loaded yet

stub_const can create an unloaded intermediate module and break tests with unexpected method errors. Using the class constant in the path lets Rails autoload the class first.

Debugging SPF records

SPF records can be hard to validate, especially when syntax errors or DNS lookup limits break mail delivery. Online checkers help test coverage and new policies before deployment.

ActiveSupport includes Timecop-like helpers

Rails test helpers let you freeze or shift time without Timecop; travel_to, travel, and freeze_time simplify time-dependent specs when clock progression does not matter.

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

Capybara can locate form fields and links by aria-label, improving accessibility-aware test selectors when visible labels are missing.

Testing for Performance: How to Ensure Your Web Vitals Stay Green

Frontend changes often erode loading speed and visual stability. Web Vitals tests can lock in LCP and CLS scores by checking them in the browser under throttled network conditions.

How to test a controller concern with rspec-rails anonymous controllers

RSpec controller concerns can be exercised with anonymous controllers, letting shared authorization behavior be tested through real requests without messy dummy routes or rebuilt stacks.

Knapsack: Rerun a flaky test locally

Reproduce a flaky CI spec locally by rerunning the same Knapsack shard with the same seed and test order.

RSpec: Run a single spec (Example or ExampleGroup)

Limit a test run to one example or group with :focus, fit, fdescribe, or fcontext; unfocused suites fall back to running everything.

How to upgrade Rails: Workflow advice

Upgrading Rails across major versions needs staged updates, compatible Ruby and gem versions, and repeated checks in console, server, tests, and config defaults.

Heads up: You should always use "current_window.resize_to" to resize the browser window in tests

Flaky browser tests can run at the wrong size on slow CI runners when window resizing returns too early; Capybara page.current_window.resize_to waits for a stable dimension.

Before you make a merge request: Checklist for common mistakes

Merge requests are often rejected for avoidable issues: missing tests, debug code, UI defects, slow queries, missing indexes, or incomplete database changes.

How to silence Puma for your feature tests

Feature specs can print noisy Puma startup logs when Capybara launches the test server. Setting Capybara.server = :puma, { Silent: true } suppresses the output.