Ruby
Minitest Guide: Rails Testing with Assertions and Fixtures
Minitest ships with Ruby's standard library and powers the default test suite in every new Rails application. It's fast, minimal, and surprisingly capable.
Ruby
Minitest ships with Ruby's standard library and powers the default test suite in every new Rails application. It's fast, minimal, and surprisingly capable.
Ruby
Basic Capybara usage covers maybe 70% of test scenarios. The remaining 30% involves complex browser behaviors: embedded iframes, file downloads, multiple authenticated sessions, custom wait conditions, and browser-specific configuration. This guide covers those advanced patterns. JavaScript Driver Configuration Capybara supports multiple JavaScript drivers. Choosing the right one affects test
HTMX
Rails and HTMX are a natural fit — ERB templates serve HTML partials, and Rails' request specs test them efficiently. Testing HTMX in Rails means adding the HX-Request header to request specs, using Capybara for browser tests, and validating HTMX response headers like HX-Trigger and HX-Redirect. Key
Ruby
RSpec is the most widely used testing framework for Ruby. Its expressive syntax reads almost like natural language, which makes test suites easier to understand and maintain. This tutorial covers the core building blocks: describe, context, it, expect, and matchers. Installing RSpec Add RSpec to your Gemfile: group :test do
Ruby
Ruby developers have two excellent unit testing frameworks to choose from: RSpec and Minitest.
Ruby
shoulda-matchers provides a collection of one-liner matchers for testing common Rails patterns: validations, associations, and controller behavior.
Ruby
RSpec integrates deeply with Rails through the rspec-rails gem. It provides spec types tuned for each layer of a Rails application: model specs, request specs, system specs, and more. This guide shows you how to set up rspec-rails and write effective tests for all three layers. Setup Add
Ruby
factory_bot (formerly FactoryGirl) is the standard library for managing test data in Ruby on Rails applications.
Ruby
Capybara is the standard Ruby library for simulating browser interactions in tests. It's the engine behind Rails system specs and RSpec feature specs.