Spreewald: Old-school cucumber steps, freshly pickled

Spreewald keeps Cucumber-style web steps available while adding reusable steps for emails, tables and time travel in a Ruby gem.

Testing with IE6, IE7 and IE8 on VirtualBox | Shape Shed

Free browser testing setup on OSX or Ubuntu using VirtualBox makes legacy Internet Explorer versions available without Parallels.

Bug in Chrome 56+ prevents filling in fields with slashes using selenium-webdriver/Capybara

Chrome 56+ can drop slashes when fill_in runs through Selenium and Capybara, breaking form input for paths and HTML strings; a JavaScript workaround updates the field directly.

Hack of the day: One-liner to run all Cucumber features matching a given string

Run only matching Cucumber feature files by searching .feature files for a string and passing the matches to geordi cucumber; similar xargs pipelines work without Geordi.

Ruby: How to measure code execution time in an IRB or Rails console

IRB and Rails console sessions can time code execution directly with measure; older versions can use Benchmark.measure for manual timing.

RSpec < 2.11: ActiveRecord scopes must be loaded before using the "=~" matcher

ActiveRecord scopes must be converted to arrays before using RSpec =~, or array comparison can fail. match_array and contain_exactly are preferred in RSpec 2.11 and later.

Bash script to run specs and features

Run rspec and Cucumber from any project directory with optional spinner support; features are skipped when specs fail.

Ruby: Enumerable#partition

Split an enumerable into matching and non-matching groups with Enumerable#partition, returning two arrays and working naturally with destructuring assignment.

Migrating to RSpec 2 from RSpec 1

Rails 3 requires rspec and rspec-rails 2, with renamed namespaces, changed requires, and macro extensions that may break during migration.

Run your own code before specific RSpec examples

Run custom setup code before selected RSpec examples using metadata tags instead of Cucumber scenarios.

Output the descriptions of RSpec examples while they are running

RSpec’s nested documentation format prints example descriptions while specs run, making warnings and failures visible immediately and giving a quick view of core behavior.

How to fix: WrongScopeError when using rspec_rails with Rails 6.1

rspec_rails with Rails 6.1 can raise WrongScopeError; upgrading the gem to 4.0.1 or later resolves the failure.

Issues with has_select?

has_select? can fail with Cucumber, Capybara, and Selenium when the selected option has no value, so driver-specific handling may be needed.

Fix slow specs using SOLR

Specs can stall for 30+ seconds when SOLR connections are left open and the pool is exhausted. Lowering the old-connection timeout reduces the delay.

Turning off VCR when stubbing with Webmock

VCR can block WebMock stubs because it hooks into WebMock and rejects unknown requests. Temporarily disabling VCR in rspec lets WebMock behave normally.

How to work around selenium chrome missing clicks to elements which are just barely visible

Chrome/Selenium can miss clicks on barely visible elements when the click target is outside the viewport. A scrollIntoViewIfNeeded patch can work around the issue.

IMAP: Check credentials

IMAP login problems can be isolated by testing the server with openssl s_client and sending a manual LOGIN command to verify credentials and connectivity.

Cucumber: More patience for Selenium features

Parallel Selenium features can time out when Capybara waits too little for browser-server interactions; a support file increases patience for @javascript scenarios.

Recent RSpec features you might not know about

Less-known RSpec features simplify expectation style, chained stubs, and restoring stubbed methods while using double as the preferred mock object.

Capybara - The missing API

Capybara node methods for locating elements, filling forms, clicking controls, and checking page content from Cucumber steps.

Hack-fix Selenium::WebDriver::Element#select is deprecated

Temporary monkey patch for older Capybara and selenium-webdriver versions to suppress repeated deprecation warnings from Selenium::WebDriver::Element#select.

Spreewald: Check that a CSS selector is present on the current page

Spreewald 1.3.0 adds assertions for checking whether CSS selectors are present or absent on the current page, with plain-English selector names via selector_for.

Stub a request's IP address in a Cucumber scenario

Force a fixed client IP in Cucumber scenarios when request-dependent code needs predictable behavior.

Operators "in" and "of" are very inconsistent between CoffeeScript and JavaScript

in and of mean different things in CoffeeScript and JavaScript, making property checks and iteration easy to mix up.