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.

ActiveRecord: Query Attributes

attribute? often checks presence like attribute.present?, but numeric values and associations behave differently; 0 can be false for ActiveRecord query attributes.

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.

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.

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.

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.

rake spec + rails_admin = weirdly failing specs

rails_admin specs can pass with rspec but fail under rake spec; setting ENV['SKIP_RAILS_ADMIN_INITIALIZER'] = 'false' in spec_helper restores the initializer.

Debugging Google Analytics

Analytics tracking can be hard to verify in the browser; a Chrome extension swaps in a debug version and prints tracking details to the JavaScript console.

Rspec_spinner or cucumber_spinner get into an infinite loop

mathn can make rspec_spinner and cucumber_spinner loop forever while rendering the progress bar.

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.

Check apache config files' syntax

Validate Apache configuration syntax with apache2ctl configtest or apache2ctl -t; passing checks do not guarantee a successful server start.

Debian/Ubuntu: See what "apt" would install without actually doing it

Check which packages and versions apt would install before making changes. --dry-run simulates upgrades without touching the system.

You can now override all Spreewald steps with more specific versions

Avoid Cucumber::Ambiguous by defining a more specific step that overrides a generic one in Spreewald 1.5.0+.

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.