Shoulda matchers needs to create a separate record in the database to test the case where it is not unique. It skips rails validations to do this, but cannot skip your database validations. If you create one manually, it'll use that instead. Change your test to this:
subject { FactoryGirl.build(:my_model) }
it { should validate_uniqueness_of(:name).scoped_to(:parent_id) }
This is covered in more depth in the shoulda matchers documentation. http://www.rubydoc.info/github/thoughtbot/shoulda-matchers/Shoulda/Matchers/ActiveRecord#validate_uniqueness_of-instance_method