Topic: Testing 'scoped' records with validates_uniqueness_of using :scope?
All of my projects will use a 'scoping' strategy very similar to Basecamp. The master table that accomplishes this is called "Project" and all tables immediately below it obviously have a 'project_id' FK.
I have a very simple table called Agycode that belongs_to: project and has only three fields
My goal is to make the "descr" value unique amongst the same project and thus thought the "validates_uniqueness_of" using the :scope parameter would fit the bill. It doesn't seem to work in my unit tests.
How would you approach testing that a field cannot be repetitive inside the same parent scope?
I apologize if this question is too broad brush.