Fixing the warning Time#succ is obsolete; use time + 1

Deprecated Time#succ warnings can flood logs when time ranges are iterated or compared with include?; cover? or SQL BETWEEN avoid the issue.

How to: Throttle CPU in Google Chrome

Limit Chrome CPU speed to measure frontend performance and reproduce sluggish behavior in DevTools.

Geordi 1.9 released

Cleanup commands for leftover dump files and unneeded local MySQL, MariaDB, and Postgres databases, with whitelisting and flexible authentication methods.

RSpec 3 no longer chooses a spec's type based on its directory

RSpec 3 no longer infers spec type from folder names, which can break helpers like routing in existing suites. Set type explicitly or re-enable file-location inference.

Check if a field or button is disabled with Cucumber

Check whether form controls or buttons are disabled in Cucumber step definitions, using label-based assertions on Capybara or Webrat elements.

ping with timestamps

Timestamp each ping reply to correlate network latency with exact times and log connectivity events more easily.

How to change the class in FactoryBot traits

FactoryBot traits cannot use :class; a nested factory or initialize_with can build the desired subtype instead.

Spreewald 1.0.0 released

spreewald now provides a binary that lists available steps and can filter them by a search term.

Faker is now I18n aware, ships with unicorns

Faker now reads strings from locale files, which can trigger confusing translation missing errors when locale data is incomplete.

RSpec matcher "be_sorted"

Custom RSpec matcher for checking whether an array is naturally ordered; now part of Spreewald.

Configuring User Agents with Capybara + Selenium Webdriver

A while ago we were working on an application that had an entire version specially created for mobiles, such as the iPhone. This specific application was entirely tested with Capybara, Steak and Selenium Webdriver. Although the test suite wasn’t the fastest one in the world, the web application was very well tested, and to guarantee that we would also be testing the mobile version, we would have to simulate an iPhone user agent accessing the application.

But wait, you might be thinking that we are not able to change browser headers while ...

RSpec claims nil to be false

RSpec be_false matches nil, so a false check can pass unexpectedly. Use == false when the value must be exactly false.

postgres_ext: additional Rails bindings for PostgreSQL

Missing PostgreSQL types and query helpers for Rails 4.x make native array, CTE, and network-style filtering easier in ActiveRecord and Arel.

Typical .gitignore

Common ignore list for source control that keeps logs, temporary files, local databases, IDE settings, and generated assets out of git history.

VirtualBox host IP address and hostname

VirtualBox NAT guests can reach the host at 10.0.2.2; vbox.srv is the matching hostname for shared folders and host web server access.

Spreewald 1.1.0 released

Spreewald 1.1.0 removes be_true and be_false to stay compatible with RSpec 3 and Ruby 2, replacing them with == true and == false.

ApacheBench may return "Failed requests" for successful requests

ab can report successful responses as failed when later replies differ in content length from the first response. The Length counter often indicates this false positive.

Prevent the selenium webbrowser window from closing after a failed @javascript step

Failed @javascript Cucumber steps can close the Selenium browser before the page state is inspected. Keeping the window open on failure helps debug the created data.

FactoryBot: How to get the class from a factory name

Look up the model class behind a FactoryBot factory name; FactoryBot.factories.find('admin').build_class returns the associated class.

Cucumber does not find neither env.rb nor step definitions when running features in nested directories

Feature files in nested directories can stop Cucumber from loading env.rb and step definitions unless the features directory is required explicitly.

rroblak/seed_dump

Creates a db:seed:dump rake task that generates db/seeds.rb from the current database state for replayable sample data.

How to find disabled fields with Capybara

Disabled form inputs can be hard to locate in Capybara when Selenium skips them; passing disabled: true makes them searchable.

CoffeeScript

Imagine all the syntactical delights of Ruby and Haml for your JavaScript. You write in a nice language, but get normal JavaScript at runtime. All whilst having full access to 3rd-party JavaScript libraries (jQuery, PrototypeJS), debugging support (it becomes pure, readable JavaScript), existing support from test suites (it’s normal JavaScript) and growing support from various text editors (TextMate, Vim, Emacs).

Where to put custom RSpec matchers

Custom RSpec matchers fit well in spec/support/matchers, one file per matcher, and can be loaded from spec_helper.rb or Cucumber features/support/env.rb.