common_repository_model 0.0.7 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,26 @@
1
1
  module CommonRepositoryModel
2
2
  module TestSupport
3
+ def assert_rels_ext(subject, predicate, objects = [])
4
+ assert_equal objects.count, subject.relationships(predicate).count
5
+ objects.each do |object|
6
+ internal_uri = object.respond_to?(:internal_uri) ?
7
+ object.internal_uri : object
8
+ assert subject.relationships(predicate).include?(internal_uri)
9
+ end
10
+ end
11
+
12
+ def assert_active_fedora_belongs_to(subject, method_name, object)
13
+ subject.send(method_name).must_equal object
14
+ end
15
+
16
+ def assert_active_fedora_has_many(subject, method_name, objects)
17
+ association = subject.send(method_name)
18
+ assert_equal objects.count, association.count
19
+ objects.each do |object|
20
+ assert association.include?(object)
21
+ end
22
+ end
23
+
3
24
  def with_persisted_area(name = nil)
4
25
  options = {}
5
26
  options[:name] = name if name
@@ -1,3 +1,3 @@
1
1
  module CommonRepositoryModel
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
@@ -5,5 +5,5 @@ require 'common_repository_model/test_support'
5
5
 
6
6
  describe <%= class_name %> do
7
7
  include CommonRepositoryModel::TestSupport
8
- subject { FactoryGirl.build(:<% singular_table_name %>) }
8
+ subject { FactoryGirl.build(:<%= singular_table_name %>) }
9
9
  end
data/spec/spec_helper.rb CHANGED
@@ -12,25 +12,4 @@ ActiveFedora.init(
12
12
  require 'common_repository_model/test_support'
13
13
  class MiniTest::Unit::TestCase
14
14
  include CommonRepositoryModel::TestSupport
15
-
16
- def assert_rels_ext(subject, predicate, objects = [])
17
- assert_equal objects.count, subject.relationships(predicate).count
18
- objects.each do |object|
19
- internal_uri = object.respond_to?(:internal_uri) ?
20
- object.internal_uri : object
21
- assert subject.relationships(predicate).include?(internal_uri)
22
- end
23
- end
24
-
25
- def assert_active_fedora_belongs_to(subject, method_name, object)
26
- subject.send(method_name).must_equal object
27
- end
28
-
29
- def assert_active_fedora_has_many(subject, method_name, objects)
30
- association = subject.send(method_name)
31
- assert_equal objects.count, association.count
32
- objects.each do |object|
33
- assert association.include?(object)
34
- end
35
- end
36
15
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: common_repository_model
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: