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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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 3 allows chaining multiple expectations
Multiple RSpec checks on one subject can be chained with and or or, avoiding repeated setup and keeping a single call under test.
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.
Rails and Postgres: How to test if your index is used as expected
Rails and Postgres index usage can be verified by running the generated SQL with EXPLAIN ANALYZE and temporarily disabling sequential scans.
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.
How to use a local gem in your Gemfile
Use a local gem copy in Gemfile to test code changes immediately and debug or modify the gem without publishing. Avoid committing local paths because they break for other developers.
Disable SimpleCov if you only run a fraction of your tests
Coverage reports add noise when only a small subset of tests runs; skipping SimpleCov for partial runs keeps output cleaner.