Nested Sets and Single-Table Inheritance

Provides a solution for problems raised by nested sets and single-table inheritance (STI).

Using counter_cache with STI Models

The counter_cache option for Rails relationships is invaluable in speeding up performance by reducing the number SQL queries, but there are a couple of things that you need to do to ensure that your counts start off right and to make the whole thing work with STI-based models.


Tracking Down Slow-Running Examples in RSpec

As the number of tests goes up in your Rails project, you'll find yourself spending more and more time waiting for the RSpec to finish. This article shows you how to track down slow-running examples to target for refactoring.

Writing Specs for Controller Actions that Return JSON

Demonstrates a method for writing RSpec tests to test output from Ruby on Rails controllers that return JSON content.


DRY Your Tests With Dynamic Specs in RSpec

Use reflection and code generation to automatically created tests in RSpec for named scopes in Ruby on Rails ActiveRecord models.

Using RSpec to Test ActiveRecord Associations for Arbitrary Models

Demonstrates a method for using RSpec to test ActiveRecord models that are not backed by a database table.



Related Topics

Specs and Testing

Rapid application development and Agile development practices emphasize execution over design, with iterative development phases intended to improve the quality of code over time. If integrated testing isn't part of your development process, however, you'll waste time on each iteration fixing broken code instead of moving your app forward.

Articles in this area cover RSpec, RCov, Reek, and other testing tools and technologies.