From d1e9a41fca001b6d89455aff49f1f03ac272ee08 Mon Sep 17 00:00:00 2001 From: Derek Bender Date: Tue, 24 May 2016 10:02:15 -0500 Subject: [PATCH] add inverse_of docs to have_many --- .../active_record/association_matcher.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/lib/shoulda/matchers/active_record/association_matcher.rb b/lib/shoulda/matchers/active_record/association_matcher.rb index cba6a93d..6489da90 100644 --- a/lib/shoulda/matchers/active_record/association_matcher.rb +++ b/lib/shoulda/matchers/active_record/association_matcher.rb @@ -486,6 +486,24 @@ module Shoulda # should have_many(:games).autosave(true) # end # + # ##### inverse_of + # + # Use `inverse_of` to assert that the `:inverse_of` option was specified. + # + # class Organization < ActiveRecord::Base + # has_many :employees, inverse_of: :company + # end + # + # # RSpec + # describe Organization + # it { should have_many(:employees).inverse_of(:company) } + # end + # + # # Minitest (Shoulda) + # class OrganizationTest < ActiveSupport::TestCase + # should have_many(:employees).inverse_of(:company) + # end + # # @return [AssociationMatcher] # def have_many(name)