Lupine Software Development

Testing :dependent parameter in Rails

by LupineDev

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) }
  end
end

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