Make Makandra Consul work with RSpec 2.x and Rails 3.x

Using Consul’s authorization matcher with RSpec 2.x on Rails 3.x can fail because of version incompatibilities. Compatibility requires adapting the matcher setup.

Fix "private method `select' called for Capybara::Node::Element

Capybara and selenium-webdriver version mismatches can break element interaction with a private select method error. Aligning gem versions avoids the API incompatibility.

Webmock's hash_including doesn't parse query values to string

hash_including in WebMock v3.0.1 compares query values as strings, so integer expectations fail unless the request matcher uses '1' instead of 1.

Howto transfer a single mysql table between several deployment stages

Copy a single MySQL table between deployment stages by dumping it from one database and importing it into another; imports overwrite existing tables, not merge them.

Spreewald 4.3.3 released

Built-in support for Rails and Bootstrap error classes reduces step overrides, while configurable error classes, XPath selectors, and optional negation improve flexibility.

Minimal JavaScript function to detect version of Internet Explorer or Edge

User-agent sniffing can still be necessary when Microsoft browsers need special handling. ieVersion() extracts Internet Explorer 10/11 and Edge version numbers, returning undefined for others.

Cucumber step to pick a datetime in Rails' horrible datetime_select

datetime_select creates a clumsy date and time chooser in Rails; a visual picker is usually better, but a Cucumber step can still drive it.

Debugging in Cucumber

Useful Cucumber steps help inspect a Capybara session by opening the current page in a browser or starting an interactive debugger.

How to make http/https requests yourself with nc/telnet/openssl

Send raw HTTP or HTTPS requests from the command line when curl is unavailable or unsuitable, using nc, telnet, or openssl s_client.

How to fix failing controller specs 91% of the time

Controller specs can fail without reaching controller code when authentication is missing, no request is triggered, or views stay unrendered.

Geordi 2.7.0 released

Geordi 2.7.0 tightens command behavior: cucumber now fails early on @solo feature failures, and commit warns on empty commits while showing progress.

Sending raw JSON data to a member action in a controller spec

Rails 4 controller specs can send raw JSON in a member action request by passing the JSON body before the route parameters.

Fix warning "already initialized constant Mocha" with Rails 3.2

Version mismatches between Mocha and Rails 3.2 can trigger an already initialized constant warning; updating Mocha and using a matching Rails version avoids it.

grosser/rspec-instafail

Immediate feedback for failing RSpec examples while passing ones continue to appear as green dots. Uses rspec/instafail with RSpec::Instafail formatting.

rspec_candy 0.4.0 released

rspec_candy 0.4.0 adds support for RSpec 3 and Rails 4, while dropping the unmaintained state_machine integration.

Use CSS attribute selectors with Capybara

Quoted CSS attribute selectors let Capybara check meta tags reliably; unquoted values can trigger Nokogiri CSS syntax errors.

How to enable template coverage support for simplecov

Template and eval coverage in Ruby can be tracked with SimpleCov from Ruby 3.2 onward, including Haml and ERB templates.

Setting nil values in Machinist blueprints

Blueprint attributes in Machinist can keep inherited values unless nil is wrapped in a block; editor { nil } clears the master value, plain nil does not.

Customize path for Capybara "show me the page" files

Capybara's save_and_open_page files can clutter the Rails root when debugging Cucumber scenarios. Set Capybara.save_and_open_page_path to store them elsewhere.

One-liner syntax in RSpec's should-based and expect-based syntaxes

RSpec one-liners can assert expectations on subject with implicit example descriptions, using should or is_expected in expect-based syntax.

whenever: Make runner commands use bundle exec

whenever runner jobs can fail in cron because bundle exec is omitted, leading to Bundler load errors. A custom job_type restores the correct Rails runner command.

Run a single example group in RSpec

Run one RSpec example group or a single it example by line number in a long spec without executing the whole file.

The Bark Blog » Testing Rails Model Plugins

Unfortunately, by default plugin tests are pretty bland. They use the plain unit test suite supplied by Ruby, and not any of the extended Rails test framework. This will leave our plugin’s test classes with no access to fixtures, database.yml configuration, or any of those nice class auto-loading features.

JavaScript Sentry: How to check if errors will be reported

Quickly verify that a JavaScript Sentry setup reports browser errors by triggering a deliberate exception in a click handler.