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

Version Path
event_calendar_engine-0.2.15 spec/spec_helpers/helpers.rb
event_calendar_engine-0.2.14 spec/spec_helpers/helpers.rb
event_calendar_engine-0.2.13 spec/spec_helpers/helpers.rb
event_calendar_engine-0.2.11 spec/spec_helpers/helpers.rb
event_calendar_engine-0.2.10 spec/spec_helpers/helpers.rb
event_calendar_engine-0.2.8 spec/spec_helpers/helpers.rb
event_calendar_engine-0.2.7 spec/spec_helpers/helpers.rb
event_calendar_engine-0.2.6 spec/spec_helpers/helpers.rb
event_calendar_engine-0.2.5 spec/spec_helpers/helpers.rb
event_calendar_engine-0.2.4 spec/spec_helpers/helpers.rb
event_calendar_engine-0.2.3 spec/spec_helpers/helpers.rb
event_calendar_engine-0.2.2 spec/spec_helpers/helpers.rb
event_calendar_engine-0.2.1 spec/spec_helpers/helpers.rb
event_calendar_engine-0.2.0 spec/spec_helpers/helpers.rb