Testing terminal output with RSpec

Verify Ruby code that writes to the terminal by capturing stdout or stderr with RSpec expectations; heredocs help with multi-line output.

Synchronize a Selenium-controlled browser with Capybara

Selenium actions can return before a page finishes loading, so Ruby updates may race with browser-side changes. A Capybara resynchronization step prevents flaky Cucumber features.

xdissent/ievms - GitHub

Run multiple Internet Explorer versions in separate VirtualBox VMs on Linux or OS X for website testing without Microsoft VirtualPC.

Running Rails 2 apps with modern MariaDB SQL server

Rails 2 apps can break on MySQL 5.7; MariaDB 10.x is a compatible replacement for old and new applications, with gem rebuilds sometimes needed after switching.

Capistrano 2: How to deploy a single server

Deploy a single server from a multi-server Capistrano setup by using HOSTFILTER to target one host and skip irrelevant tasks.

Silence specific deprecation warnings in Rails 3+

ActiveSupport deprecation warnings can be selectively hidden when a specific warning cannot be fixed and only certain messages should stay visible.

Making ZSH the default shell on Ubuntu 20.04

ZSH can replace Bash on Ubuntu 20.04 and adds command-line conveniences like completion, corrections, themes, and plugins.

Structuring Rails applications: the Modular Monorepo Monolith

Monolithic Rails apps can stay maintainable by splitting code into a monorepo of Rails Engines and gems with explicit component dependencies.

Usage of RSpec's raise_error

raise_error without an expected exception can pass for unrelated bugs, so matching a specific error class and message makes specs meaningful.

Silencing Your Staging Environment - The Hashrocket Blog

Production data testing can accidentally email real users; rewriting recipient domains in ActionMailer prevents staging mail from reaching live inboxes.

DOM API for jQuery users

Quick reference for replacing common jQuery DOM tasks with native browser APIs and handling event delegation gaps without jQuery.

RSpec: Defining helper methods for an example group

Helper methods can be defined inside an RSpec example group and inherited by nested groups, but not by parent or sibling groups.

How to access before/after pseudo element styles with JavaScript

Pseudo-element styles are hard to inspect directly, but getComputedStyle can read ::before and ::after values for testing and color checks.

Heads up: RSpec's diffs may not tell the truth

RSpec diffs can mislead when matchers print like failures or when Time.now values differ only by milliseconds.

Controller specs do not persist the Rails session across requests of the same spec

Controller specs reset the Rails session on every request, so data written earlier disappears between calls. Stubbing controller.session with a shared TestSession preserves state for testing.

PostgreSQL's OVERLAPS operator is not fully inclusive

PostgreSQL OVERLAPS treats date ranges as start <= time < end, so boundary dates are excluded and adjacent ranges do not match.

RawGit

Serve raw GitHub files with correct Content-Type headers for CDN-style testing or prototyping, but without any uptime guarantee.

How to create Excel sheets with spreadsheet gem and use number formats for cells like money or date

Create .xls files with the spreadsheet gem and apply number formats for currency and dates, including cell links.

RSpec: Where to put shared example groups

Shared example groups need a clear home in RSpec, since the default rspec-rails layout does not provide one. Organizing them in dedicated shared_examples folders keeps them reusable and easy to load.

Working around OpenSSL::SSL::SSLErrors

Ruby and curl requests can fail when a server only accepts older SSL/TLS versions; forcing a specific protocol version can restore connectivity.

RSpec: ". not_to include" behaves like ".to exclude"

not_to include with multiple values checks each value separately, so one matcher can verify several exclusions at once instead of negating the whole expectation.

RSpec: Where to put custom matchers and other support code

Custom RSpec matchers and support code need a clear home in spec/support to keep specs DRY and make shared helpers available everywhere.

How to upgrade Cucumber on Rails 3+

Updating Cucumber on Rails 3+ requires refreshing cucumber, capybara, and cucumber-rails, then restoring any custom support setup after installation.

Spreewald 1.2.0 released: new "select field should be sorted" step

Bugs in select-field ordering can make form choices appear in the wrong sequence; a sorting check helps verify ordered and unordered dropdowns behave correctly.