Sha256: 7949272992a2e379fb78715618c1fd782ed63d92123f576f5201b5e1ce7009e0
Contents?: true
Size: 539 Bytes
Versions: 14
Compression:
Stored size: 539 Bytes
Contents
def spec_associations(associations, options={}) subject = options[:class] unless subject.present? if subject.blank? raise ArgumentError, "spec_associations expects a subject to be set to the target class; eg subject{ YourActiveRecordModel }" end it_prefix = options[:it_prefix] it_prefix += " " unless it_prefix.blank? associations.each do |type, names| names.each do |name| it "#{it_prefix}#{type} #{name}" do subject.to_s.constantize.reflections.should include(name.to_sym) end end end end
Version data entries
14 entries across 14 versions & 1 rubygems