Skip to content

Instantly share code, notes, and snippets.

@domagude
Last active October 20, 2017 15:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save domagude/ba25865aeded74268d7f3600043405ad to your computer and use it in GitHub Desktop.
Save domagude/ba25865aeded74268d7f3600043405ad to your computer and use it in GitHub Desktop.
require 'rails_helper'
RSpec.describe User, type: :model do
context 'Associations' do
it 'has_many posts' do
association = described_class.reflect_on_association(:posts)
expect(association.macro).to eq :has_many
expect(association.options[:dependent]).to eq :destroy
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment