Single step and slow motion for cucumber scenarios using @javascript selenium
Pause Cucumber browser-driven tests between steps for debugging or demos, with single-step input and slower playback for @javascript Selenium runs.
Protip: Always leave a failing test
Leaving a failing test at the end of unfinished work makes it easier to resume later and quickly see what still needs attention.
Setup your terminal to not scroll when there is new output
Stop the terminal from jumping back to the bottom when new output appears, so you can inspect logs or test failures without losing your place.
CSS tests and experiments
Tests and experiments around CSS features, possibilities, and browser bugs across more than 200 cases.
Test that a CSS selector is present with Cucumber
Cucumber step for checking whether a CSS selector is present or absent on a page with Capybara or Webrat.
Stubbing out external services with an embedded Sinatra application
Test suites that depend on remote APIs can become brittle and slow; an embedded Sinatra app provides a lightweight stub server for isolated integration tests.
Using QEMU to quickly test an ISO or bootable USB drive
Bootable media can be tested quickly in QEMU instead of setting up VirtualBox, using an ISO or a USB drive directly.
Hunt down that elusive debug message in Ruby
Trace stray puts and p output in Ruby by inserting a temporary hook that prints a backtrace for a chosen message, then remove it after cleanup.
Use the back button in Cucumber
Navigate to the previous page in Cucumber feature tests when browser history is unavailable, using the HTTP referrer in Capybara or Webrat.
Heads up: Sidekiq per default silently fails when retries are exhausted!
Sidekiq retries can run out silently, leaving failed jobs only in the dead queue. Add explicit notification logic when permanent worker errors exhaust retries.
How to test if an element has scrollbars with JavaScript (Cucumber step inside)
Detecting overflow in an element matters when layout must avoid hidden content and unwanted scroll bars; comparing scrollHeight and offsetHeight reveals whether content exceeds the visible area.
How to test whether your device has a true Retina display
A simple visual test gauges how close a screen comes to true Retina quality by comparing fine line sharpness in two images.
Airbrake notification in Rake tasks
Rake tasks can report exceptions to Airbrake without notifying in development or test environments, using the usual notification rules for tasks that depend on :environment.
Updated: Capybara: Check that a page element is hidden via CSS
Hidden-element checks in Capybara can fail in Selenium when visibility is inferred too loosely. A JavaScript-based step works across Selenium, jQuery, Prototype, and Rack::Test.
Stub methods on any instance of a class in Rspec 1 and Rspec 2
Stub a method on every instance of a class to control behavior in tests, using stub_any_instance, any_instance.stub, or allow_any_instance_of.
FactoryGirl: How to easily create users with first and last name
Create a user factory that accepts one full-name value and splits it into first and last name automatically, reducing repetitive test setup.
Guide to localizing a Rails application
Rails app localization affects text, URLs, formats, images, caching, and time zones; estimating effort means checking each layer for language-sensitive behavior.
Updated: Test a gem in multiple versions of Rails
Testing a gem across Rails versions is easier with shared app code and specs via symlinks, keeping one test setup aligned with current best practice.
How to inspect controller filter chains in specs
Inspecting callback chains in controller specs helps verify before- and after-action behavior, especially when tests need to confirm filter order or presence.
FactoryBot: Traits for enums
Enum values can become FactoryBot traits automatically, reducing manual trait definitions and making new roles or states available in tests with less setup.
Jasmine 2 cheat sheet for RSpec lamers
Quick RSpec-to-Jasmine 2 reference for matching expectations and mock assertions when switching test style; Jasmine 1.x uses different syntax.
Integrating ESLint
JavaScript linting catches style and quality issues early, with a flat config, RSpec check, and gradual cleanup of existing offenses.
Webpack(er): A primer
Webpacker integrates webpack with Rails to bundle JavaScript, stylesheets, images, and other assets, with Yarn managing dependencies and loaders handling non-JavaScript files.
thoughtbot/fake_stripe: A Stripe fake so that you can avoid hitting Stripe servers in tests.
fake_stripe runs a local Stripe-like server and fake Stripe.js for feature specs, letting purchase flows be tested without external HTTP requests or Stripe sandbox flakiness.