Testing :dependent Parameter In Rails

In an effort to post on here more often I’m going to start small. I had a brain fart on how to test the has_many :dependent parameter for Rails associations today. With my trusty rspec book not on-hand, it just took a little googling to find a solution.

describe Reticulum do
  describe "associations" do
    should { have_many(:reticules).dependent(:restrict) }

Many thanks to Robert Spiecher in his reply to this Stackoverflow post that showed me the light :)

© 2013 Lupine Software Development