Class: RiotRails::ActiveRecord::HasAndBelongsToManyMacro

Inherits:
ReflectionAssertionMacro show all
Defined in:
lib/riot/active_record/reflection_macros.rb

Overview

An ActiveRecord assertion macro that expects to pass when a given attribute is defined as a has_and_belongs_to_many association. Will fail if an association is not defined for the attribute or if the association is not has_and_belongs_to_many.

context "a Room" do
  setup { Room.new }

  asserts_topic.has_and_belongs_to_many(:walls)
end

Instance Method Summary collapse

Instance Method Details

#evaluate(actual, *expectings) ⇒ Object



99
100
101
102
# File 'lib/riot/active_record/reflection_macros.rb', line 99

def evaluate(actual, *expectings)
  attribute, options = *expectings
  assert_reflection("has_and_belongs_to_many", actual, attribute, options)
end