Module: ActiveFedora::TestSupport

Defined in:
lib/active_fedora/test_support.rb

Instance Method Summary collapse

Instance Method Details

#assert_active_fedora_belongs_to(subject, association_name, object) ⇒ Object

Assert that the :subject's :association_name equals the input :object


5
6
7
# File 'lib/active_fedora/test_support.rb', line 5

def assert_active_fedora_belongs_to(subject, association_name, object)
  subject.send(association_name).must_equal object
end

#assert_active_fedora_has_many(subject, association_name, objects) ⇒ Object

Assert that the :subject's :association_name contains all of the :objects


10
11
12
13
14
15
16
# File 'lib/active_fedora/test_support.rb', line 10

def assert_active_fedora_has_many(subject, association_name, objects)
  association = subject.send(association_name)
  assert_equal objects.count, association.count
  objects.each do |object|
    assert association.include?(object)
  end
end