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.

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.

Common mistakes when storing file uploads with Rails

File uploads in Rails are easy to misconfigure, causing lost files, public exposure of confidential data, and environment collisions. Existing uploads also need migration when storage paths change.

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.

dbconsole in Rails 3 requires the environment as the first argument

Rails 3 dbconsole misreads -p test and opens the development database unless the environment is passed first.

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.

Geordi 5.4.0 released

Geordi 5.4.0 adds geordi branch, MySQL dump speedups, Pivotal Tracker ID support in global config, and fixes for dump load requirements and test processor documentation.

ActionView::Template::Error (dump format error for symbol(0x6d))

Selenium tests can fail with ActionView::Template::Error and a dump format error for a symbol, often caused by stale cached files in tmp/cache.

MySQL: How to dump single tables instead of a complete database

Need production or staging data for migration tests without a full database export; mysqldump can dump only selected tables when a complete dump is too large.

Jasmine: Test that an object is an instance of a given class

Verify that a value was created by a specific constructor in Jasmine with jasmine.any(Klass) instead of direct instance checks.

Cucumber step to test whether a select field is sorted

Custom Cucumber step for checking that a dropdown’s options are in order, with a Capybara matcher for natural sorting.

How to test resource_controller hooks

Testing resource_controller callbacks directly avoids triggering the action path and verifies hook behavior in controller specs.

Capybara can match elements outside of <body>

Capybara can match elements outside body, including head nodes and hidden links, which helps test metadata and feed autodiscovery.

Cucumber steps to test input fields for equality (with wildcard support)

Exact form-field matching in Cucumber prevents false positives from partial values, while wildcards allow flexible contains-style checks.

Zeus promises to make rails development faster

Rails app boot and test startup become slow as gems grow; Zeus preloads the app so console, server, generate, and specs run in under a second.

Test whether a form field exists with Cucumber and Capybara

Capybara and Cucumber can assert whether a labeled form control is present or absent, with step definitions needing adjustment across older Capybara versions.

Capybara: Test that a string is visible as static text

Capybara text checks can match a <textarea> instead of rendered page text; filtering to visible static content avoids false positives.

Test that a string of text is (not) linked in Webrat or Capybara

Cucumber step definitions for asserting whether visible link text is present or absent in Webrat or Capybara using selector-based matchers.

How to: Solve gem loaded specs mutex

Ruby 1.8.7 test runs can fail with Gem::LOADED_SPECS_MUTEX NameError under older Bundler; Bundler 1.16.1 resolves it.

The Plight of Pinocchio: JavaScript's quest to become a real language - opensoul.org

JavaScript has become essential for production applications, but maintainable code still depends on structured design, object-oriented principles, and test-driven development.

Test the content-type of a response in Cucumber

Check a download or page response by its MIME type in Cucumber, using Webrat or Capybara; the Selenium webdriver does not support this approach.

Check whether a Paperclip attachment exists

Paperclip attachment checks can give false positives because the attribute returns an attachment object. Use exists? to test whether a file is actually attached.

Stubbing terminal user input in RSpec

Console input tests are tricky because stubbing Kernel#gets often has no effect. Targeting the object or class that actually calls gets makes terminal input mocks work.

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.