Sha256: 057245715b7fbc70f2b2e17d20aed26ea4ae9b331dba8eef7b87c8b9841fcfda

Contents?: true

Size: 1.15 KB

Versions: 1

Compression:

Stored size: 1.15 KB

Contents

$:.unshift File.expand_path('../../lib', __FILE__)
require 'minitest/autorun'
require 'active_fedora'
require 'factory_girl'
FactoryGirl.find_definitions
ActiveFedora.init(
  fedora_config_path: File.join(File.dirname(__FILE__),"config/fedora.yml"),
  solr_config_path: File.join(File.dirname(__FILE__),"config/solr.yml"),
  environment: :test
)

require 'common_repository_model/test_support'
class MiniTest::Unit::TestCase
  include CommonRepositoryModel::TestSupport

  def assert_rels_ext(subject, predicate, objects = [])
    assert_equal objects.count, subject.relationships(predicate).count
    objects.each do |object|
      internal_uri = object.respond_to?(:internal_uri) ?
        object.internal_uri : object
      assert subject.relationships(predicate).include?(internal_uri)
    end
  end

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

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
common_repository_model-0.0.7 spec/spec_helper.rb