RSpec: How to define classes for specs

RSpec constants declared in specs leak into the global namespace, risking name collisions and brittle tests. Use stub_const, a Class.new variable, or self:: to keep helper classes isolated.

Adding comments to ambiguous database columns

Ambiguous database columns can need schema comments when meaning depends on history or code. Units, boolean flags, timestamps, and STI-specific fields benefit most.

Style Guide for Git commit messages

Git commit messages benefit from a clear subject, concise length, and imperative wording, with a body that states what changed and why.

Taking screenshots in Capybara

Capybara test failures can save screenshots and HTML automatically, with manual capture also available through save_and_open_page, save_screenshot, or Rails ScreenshotHelper.

Chrome DevTools: Treasure (Overview)

Chrome DevTools provide practical tools for performance analysis, debugging, breakpoints, throttling, and layout inspection in everyday web development.

JavaScript: Sharing content with the native share dialog

Native share dialogs on mobile and desktop let users hand off links, text, and titles to installed apps; navigator.share works only on HTTPS pages.

RSpec: Inferring spec type from file location

RSpec Rails can infer spec behavior from file location, removing manual type tags and enabling request helpers like get and post where appropriate.

How to: Self-hosted fonts via NPM packages

Self-hosted webfonts can satisfy GDPR requirements without bundling font files manually. Fontsource NPM packages include weights, glyph sets, and smarter CSS loading.

Git: Removing feature branches on merge

Feature branches accumulate after merges; a post-merge Git hook can prompt for cleanup and remove the merged branch locally and on the remote.

Common mistakes when storing file uploads with Rails

File uploads in Rails are easy to misconfigure, causing lost files, public exposure of confidential data, and environment collisions. Existing uploads also need migration when storage paths change.

Better performance insights with gem `rails_performance`

rails_performance adds low-effort performance monitoring for Rails apps, surfacing slow endpoints, request timing, query breakdowns, and custom events with Redis-backed dashboards.

CarrierWave: Default Configuration and Suggested Changes

CarrierWave defaults often need project-specific tweaks for storage paths, cache cleanup, test isolation, and large-file handling.

Supporting multiple SAML IdPs within a single Rails application

Multi-tenant Rails apps can use one OmniAuth setup for several SAML identity providers, loading the right configuration at runtime for secure SSO.

Selenium: Fix Chrome's "Unsafe Password" Warning

Chrome password leak detection can interrupt Selenium runs with breach warnings on weak or reused credentials. Disabling profile.password_manager_leak_detection suppresses the dialog in automated tests.

Using Passenger Standalone for development

Local development can use Passenger Standalone as a zero-configuration Ruby app server with SSL and production-like behavior, replacing Webrick or Thin.

How to make changes to a Ruby gem (as a Rails developer)

Ruby gems need manual file loading, multi-version support, and their own release workflow, unlike Rails apps. Safe changes depend on understanding structure, tests, versioning, and packaging.

Using the alt attribute and the figcaption element in HTML

Image descriptions need different wording depending on context: alt text should stay functional, while figcaption can be editorial or illustrative.

Using FactoryBot in Development

Dummy development data is faster to create by reusing FactoryBot factories than by using the UI or Rails console records. Defaults, associations, traits, and attribute overrides come along automatically.

Web performance snippets: little scripts that return performance metrics

Tiny scripts provide quick web performance metrics for Core Web Vitals, loading, scripts, images, fonts, and interactions.

Capybara: Waiting for pending AJAX requests after a test

Selenium tests can fail when pending AJAX calls are aborted as Capybara closes the browser tab. Blocking new requests and waiting for in-flight work reduces flaky teardown errors.

Automatically validating dependency licenses with License Finder

Dependency licenses can break closed-source projects when unapproved OSS terms slip in. License Finder validates all dependencies during test runs and flags restricted licenses early.

Shortcuts for getting ids for an ActiveRecord scope

ActiveRecord relations can return only primary keys instead of full records, reducing query payload when just record identifiers are needed.

Testing ActiveRecord validations with RSpec

Rails model validation tests can be written directly with record.validate and error checks, or shortened with shoulda-matchers for standard cases.

CSS variables aka CSS Custom Properties

Live CSS custom properties cascade through the DOM and can be reused in other values, enabling flexible theming and Web Component styling.