Upgrade guide for moving a Rails app from Webpack 3 to Webpack 4

Webpacker 4 and Babel 7 change config files, package names, asset paths, and polyfill imports when upgrading a Rails app from Webpack 3.

Migration from the Asset Pipeline to Webpacker

Moving a Rails app from the Asset Pipeline to Webpacker requires inventorying bundled libraries, repackaging legacy assets, and adjusting deployment for pack-based assets.

VCR: An OAuth-compatible request matcher

OAuth query parameters with nonces or timestamps make VCR request matching fail because each URI changes. A custom matcher can ignore the variable OAuth values.

Cucumber: How to find unused step definitions

Cucumber can list step definitions separately, helping detect dead or duplicate steps before cleanup. --dry-run and --format stepdefs reveal candidates, but nested step calls can look unused.

Better output for Cucumber

cucumber_spinner adds a progress bar for Cucumber features and shows failing scenarios immediately, with optional browser opening for failed pages.

FactoryBot: Passing attributes to associated records using transient attributes

FactoryBot transient attributes can pass custom values into associated records, letting parent factories build children with dynamic names and flags.

How to avoid ActiveRecord::EnvironmentMismatchError on "rails db:drop"

Rails database tasks can fail with ActiveRecord::EnvironmentMismatchError after restoring a dump from another environment. Updating ar_internal_metadata or disabling the environment check lets rails db:drop proceed.

Chaining Capybara matchers in RSpec

Chaining Capybara matchers with and retries the full expectation when one check fails, making multiple assertions more reliable on pages that change asynchronously.

Ollama: Strip image data from VCR recorded requests

VCR cassettes can bloat with base64-encoded vision payloads and leaked Basic Auth credentials; sanitizing request bodies and custom matching keep recordings small and playback reliable.

Testing for XSS in Markdown Fields

Markdown fields can become XSS sinks when user input is rendered unsafely, allowing javascript: links, image event handlers, and filter bypasses.

Consul 0.9 lets you optimize records checks

Record-level permission checks can be optimized by replacing scope lookups with a direct predicate, avoiding database ID scans for large collections.

Upgrading a Rails app to Cucumber 3

Rails apps upgrading to Cucumber 3 often need gem updates, new tag syntax, and step-definition fixes to avoid parser and argument-mismatch errors.

How to set up SMTP email delivery with a Gmail account

Rails applications can send mail through Gmail’s SMTP server with smtp_settings; Google app passwords enable delivery when two-factor authentication is enabled.

Cucumber may complain about cucumber.yml being invalid when it is valid

Cucumber can report cucumber.yml as invalid even when it parses correctly; an invalid rerun file like tmp/rerun.txt may trigger the error.

Action Mailer Previews

Previewing Rails emails in the browser catches layout and content issues before delivery and helps keep mailer output aligned with expectations.

Chrome Lighthouse

Built-in Chrome auditing checks performance, accessibility, and other quality signals for web apps, including private or local pages. Development settings can skew results; Webpagetest is an alternative.

Browsers will not send a referrer when linking from HTTPS to HTTP

Secure pages linking to insecure destinations suppress the Referer header, making visits appear as direct traffic and breaking source tracking.

Rspec: around(:all) and around(:each) hook execution order

RSpec hook order matters when around(:all) and around(:each) wrap setup and teardown; their execution timing differs from before and after hooks.

Mixed Content Examples

Mixed content behavior differs when secure pages load assets over HTTPS versus HTTP, exposing browser handling of blocked or downgraded resources.

Inspecting the page content in Capybara

Debugging Capybara page output often requires inspecting visible text, raw HTML, or parsing page.body with Nokogiri when matcher failures are hard to interpret.

Ruby: A short summary of available hooks in Cucumber

Cucumber Ruby offers scenario-level, step-level, and global lifecycle hooks, plus tag filtering and World modules for reusable helper methods.

BrowserStack has browser plugins for local testing

Private and internal servers can be tested through the BrowserStack cloud without exposing them publicly, even behind firewalls, proxies, or Active Directory.

How to fix: Bundler 1.13 breaks parallel_tests

Upgrading to Bundler 1.13.x can break parallel_tests with a LoadError when loading Gherkin formatters. Setting bundle config --local disable_exec_load true restores the old behavior.

Fix a spec that only runs when called directly

RSpec examples that run only when invoked directly often need a proper _spec.rb filename; a plain .rb file may be skipped in the full suite.