well, the most obvious solution would be something like this:
user = User.create(name: 'User')
2.times { user.friends.create(name: 'Other User') }
assert_equal(2, user.friends.count, "Unexpected associated records count")
but this is basically more like testing rails itself, you should not bother with that.
I would just check if user.respond_to?(:friends)
. But, of course, it will fail if someone defines a method with that name