shoulda matchers includes a .with_foreign_key()
option.
https://github.com/thoughtbot/shoulda-matchers#have_many
So in your example:
describe User do
it { should have_many(:articles).with_foreign_key('author_id') }
end
Which is how your model should, I believe:
class User < ActiveRecord::Base
has_many :articles, foreign_key: "author_id"
end