active-fedora 11.1.4 → 11.1.5
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.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -0
- data/.rubocop_todo.yml +73 -18
- data/active-fedora.gemspec +2 -2
- data/lib/active_fedora.rb +3 -3
- data/lib/active_fedora/associations/association.rb +1 -2
- data/lib/active_fedora/associations/basic_contains_association.rb +3 -1
- data/lib/active_fedora/associations/builder/association.rb +1 -2
- data/lib/active_fedora/associations/null_validator.rb +1 -2
- data/lib/active_fedora/containers/container.rb +1 -2
- data/lib/active_fedora/file.rb +1 -2
- data/lib/active_fedora/file_configurator.rb +2 -2
- data/lib/active_fedora/indexers/null_indexer.rb +1 -2
- data/lib/active_fedora/null_logger.rb +2 -4
- data/lib/active_fedora/persistence.rb +2 -2
- data/lib/active_fedora/property.rb +1 -2
- data/lib/active_fedora/type/value.rb +2 -4
- data/lib/active_fedora/version.rb +1 -1
- data/spec/integration/associations_spec.rb +5 -5
- data/spec/integration/attached_files_spec.rb +1 -2
- data/spec/integration/collection_association_spec.rb +1 -1
- data/spec/integration/direct_container_spec.rb +2 -2
- data/spec/integration/fedora_solr_sync_spec.rb +1 -1
- data/spec/integration/generators/fedora_generator_spec.rb +1 -1
- data/spec/integration/generators/solr_generator_spec.rb +1 -1
- data/spec/integration/has_many_associations_spec.rb +4 -5
- data/spec/integration/indirect_container_spec.rb +2 -2
- data/spec/integration/solr_hit_spec.rb +1 -1
- data/spec/integration/versionable_spec.rb +2 -2
- data/spec/unit/attached_files_spec.rb +13 -8
- data/spec/unit/attributes_spec.rb +2 -2
- data/spec/unit/base_spec.rb +2 -2
- data/spec/unit/callback_spec.rb +2 -2
- data/spec/unit/change_set_spec.rb +1 -2
- data/spec/unit/collection_proxy_spec.rb +2 -1
- data/spec/unit/core_spec.rb +3 -3
- data/spec/unit/default_model_mapper_spec.rb +1 -1
- data/spec/unit/file_path_builder_spec.rb +1 -1
- data/spec/unit/file_spec.rb +22 -24
- data/spec/unit/files_hash_spec.rb +1 -2
- data/spec/unit/filter_spec.rb +2 -2
- data/spec/unit/fixity_service_spec.rb +1 -1
- data/spec/unit/has_and_belongs_to_many_association_spec.rb +1 -2
- data/spec/unit/has_many_association_spec.rb +2 -2
- data/spec/unit/indexing_spec.rb +1 -2
- data/spec/unit/inheritance_spec.rb +2 -1
- data/spec/unit/model_classifier_spec.rb +1 -1
- data/spec/unit/pathing_spec.rb +1 -2
- data/spec/unit/query_result_builder_spec.rb +1 -2
- data/spec/unit/query_spec.rb +1 -1
- data/spec/unit/reflection_spec.rb +2 -2
- data/spec/unit/solr_hit_spec.rb +1 -2
- data/spec/unit/sparql_insert_spec.rb +1 -1
- data/spec/unit/with_metadata/metadata_node_spec.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b127c21e13c24e017a536d3babf9e442bd1ae4eb
|
|
4
|
+
data.tar.gz: c75ce470aac8faf4a8b729f624f0ee8062997610
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ae7951d53fb1f44bdd749e953c12e53c3984f9161fe8988ae6c92bd3ccc8ef0505fb2c27764f46c88a880d5ed5af7e9019aa4d52e1d68747ac36db58fc05640d
|
|
7
|
+
data.tar.gz: 5a664cea927d252abe59a7993b9ba3ea63ad5e89e360cfea72f1281722c965062a9a08ab8340b3d0fd301278c053a6f6b57b17ac1028de9f24e093f5dec8a75e
|
data/.rubocop.yml
CHANGED
data/.rubocop_todo.yml
CHANGED
|
@@ -1,20 +1,23 @@
|
|
|
1
|
-
require: rubocop-rspec
|
|
2
|
-
|
|
3
1
|
# This configuration was generated by
|
|
4
2
|
# `rubocop --auto-gen-config`
|
|
5
|
-
# on
|
|
3
|
+
# on 2017-02-28 19:30:31 -0600 using RuboCop version 0.47.1.
|
|
6
4
|
# The point is for the user to remove these configuration records
|
|
7
5
|
# one by one as the offenses are removed from the code base.
|
|
8
6
|
# Note that changes in the inspected code, or installation of new
|
|
9
7
|
# versions of RuboCop, may require this file to be generated again.
|
|
10
8
|
|
|
11
|
-
# Offense count:
|
|
12
|
-
# Configuration parameters:
|
|
13
|
-
|
|
9
|
+
# Offense count: 211
|
|
10
|
+
# Configuration parameters: CountComments, ExcludedMethods.
|
|
11
|
+
Metrics/BlockLength:
|
|
12
|
+
Max: 577
|
|
13
|
+
|
|
14
|
+
# Offense count: 65
|
|
15
|
+
RSpec/BeforeAfterAll:
|
|
14
16
|
Enabled: false
|
|
15
17
|
|
|
16
|
-
# Offense count:
|
|
17
|
-
|
|
18
|
+
# Offense count: 114
|
|
19
|
+
# Configuration parameters: Max.
|
|
20
|
+
RSpec/ExampleLength:
|
|
18
21
|
Enabled: false
|
|
19
22
|
|
|
20
23
|
# Offense count: 15
|
|
@@ -32,24 +35,76 @@ RSpec/MessageChain:
|
|
|
32
35
|
Exclude:
|
|
33
36
|
- 'spec/unit/file_spec.rb'
|
|
34
37
|
|
|
35
|
-
# Offense count:
|
|
36
|
-
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
|
37
|
-
# SupportedStyles: allow, expect
|
|
38
|
-
RSpec/MessageExpectation:
|
|
39
|
-
Enabled: false
|
|
40
|
-
|
|
41
|
-
# Offense count: 238
|
|
38
|
+
# Offense count: 241
|
|
42
39
|
RSpec/MultipleExpectations:
|
|
43
40
|
Max: 8
|
|
44
41
|
|
|
45
|
-
# Offense count:
|
|
46
|
-
# Configuration parameters:
|
|
42
|
+
# Offense count: 181
|
|
43
|
+
# Configuration parameters: Max.
|
|
47
44
|
RSpec/NestedGroups:
|
|
48
45
|
Enabled: false
|
|
49
46
|
|
|
47
|
+
# Offense count: 24
|
|
48
|
+
RSpec/ScatteredSetup:
|
|
49
|
+
Exclude:
|
|
50
|
+
- 'spec/integration/base_spec.rb'
|
|
51
|
+
- 'spec/integration/direct_container_spec.rb'
|
|
52
|
+
- 'spec/integration/has_and_belongs_to_many_associations_spec.rb'
|
|
53
|
+
- 'spec/integration/indexing_spec.rb'
|
|
54
|
+
- 'spec/integration/indirect_container_spec.rb'
|
|
55
|
+
- 'spec/integration/json_serialization_spec.rb'
|
|
56
|
+
- 'spec/unit/attached_files_spec.rb'
|
|
57
|
+
- 'spec/unit/base_spec.rb'
|
|
58
|
+
- 'spec/unit/loadable_from_json_spec.rb'
|
|
59
|
+
- 'spec/unit/rdf/indexing_service_spec.rb'
|
|
60
|
+
|
|
50
61
|
# Offense count: 94
|
|
51
62
|
RSpec/SubjectStub:
|
|
52
|
-
|
|
63
|
+
Exclude:
|
|
64
|
+
- 'spec/integration/associations_spec.rb'
|
|
65
|
+
- 'spec/integration/autosave_association_spec.rb'
|
|
66
|
+
- 'spec/integration/versionable_spec.rb'
|
|
67
|
+
- 'spec/unit/attached_files_spec.rb'
|
|
68
|
+
- 'spec/unit/base_extra_spec.rb'
|
|
69
|
+
- 'spec/unit/file_configurator_spec.rb'
|
|
70
|
+
- 'spec/unit/file_spec.rb'
|
|
71
|
+
- 'spec/unit/has_and_belongs_to_many_association_spec.rb'
|
|
72
|
+
- 'spec/unit/persistence_spec.rb'
|
|
73
|
+
- 'spec/unit/solr_config_options_spec.rb'
|
|
74
|
+
- 'spec/unit/validations_spec.rb'
|
|
53
75
|
|
|
76
|
+
# Offense count: 20
|
|
77
|
+
# Configuration parameters: IgnoreSymbolicNames.
|
|
54
78
|
RSpec/VerifiedDoubles:
|
|
79
|
+
Exclude:
|
|
80
|
+
- 'spec/unit/association_hash_spec.rb'
|
|
81
|
+
- 'spec/unit/files_hash_spec.rb'
|
|
82
|
+
- 'spec/unit/query_spec.rb'
|
|
83
|
+
- 'spec/unit/schema_indexing_strategy_spec.rb'
|
|
84
|
+
- 'spec/unit/solr_config_options_spec.rb'
|
|
85
|
+
- 'spec/unit/solr_service_spec.rb'
|
|
86
|
+
|
|
87
|
+
# Offense count: 3
|
|
88
|
+
Rails/FilePath:
|
|
89
|
+
Exclude:
|
|
90
|
+
- 'lib/active_fedora/file_configurator.rb'
|
|
91
|
+
- 'spec/unit/file_configurator_spec.rb'
|
|
92
|
+
|
|
93
|
+
# Offense count: 2
|
|
94
|
+
Security/MarshalLoad:
|
|
95
|
+
Exclude:
|
|
96
|
+
- 'spec/integration/marshal_spec.rb'
|
|
97
|
+
|
|
98
|
+
# Offense count: 20
|
|
99
|
+
# Configuration parameters: MinBodyLength.
|
|
100
|
+
Style/GuardClause:
|
|
55
101
|
Enabled: false
|
|
102
|
+
|
|
103
|
+
# Offense count: 20
|
|
104
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
|
105
|
+
# SupportedStyles: snake_case, normalcase, non_integer
|
|
106
|
+
Style/VariableNumber:
|
|
107
|
+
Exclude:
|
|
108
|
+
- 'spec/integration/associations_spec.rb'
|
|
109
|
+
- 'spec/unit/ordered_spec.rb'
|
|
110
|
+
- 'spec/unit/orders/ordered_list_spec.rb'
|
data/active-fedora.gemspec
CHANGED
|
@@ -32,8 +32,8 @@ Gem::Specification.new do |s|
|
|
|
32
32
|
s.add_development_dependency "rspec-its"
|
|
33
33
|
s.add_development_dependency "equivalent-xml"
|
|
34
34
|
s.add_development_dependency "simplecov", '~> 0.8'
|
|
35
|
-
s.add_development_dependency "rubocop", '~> 0.
|
|
36
|
-
s.add_development_dependency "rubocop-rspec", '~> 1.
|
|
35
|
+
s.add_development_dependency "rubocop", '~> 0.47.1'
|
|
36
|
+
s.add_development_dependency "rubocop-rspec", '~> 1.12.0'
|
|
37
37
|
|
|
38
38
|
s.files = `git ls-files`.split("\n")
|
|
39
39
|
s.test_files = `git ls-files -- {spec}/*`.split("\n")
|
data/lib/active_fedora.rb
CHANGED
|
@@ -196,11 +196,11 @@ module ActiveFedora #:nodoc:
|
|
|
196
196
|
# ActiveFedora.environment => "test"
|
|
197
197
|
def environment
|
|
198
198
|
if config_options.fetch(:environment, nil)
|
|
199
|
-
|
|
199
|
+
config_options[:environment]
|
|
200
200
|
elsif defined?(Rails.env) && !Rails.env.nil?
|
|
201
|
-
|
|
201
|
+
Rails.env.to_s
|
|
202
202
|
elsif defined?(ENV['environment']) && !ENV['environment'].nil?
|
|
203
|
-
|
|
203
|
+
ENV['environment']
|
|
204
204
|
elsif defined?(ENV['RAILS_ENV']) && !ENV['RAILS_ENV'].nil?
|
|
205
205
|
raise "You're depending on RAILS_ENV for setting your environment. Please use ENV['environment'] for non-rails environment setting: 'rake foo:bar environment=test'"
|
|
206
206
|
else
|
|
@@ -202,8 +202,7 @@ module ActiveFedora
|
|
|
202
202
|
# the target is stale.
|
|
203
203
|
#
|
|
204
204
|
# This is only relevant to certain associations, which is why it returns nil by default.
|
|
205
|
-
def stale_state
|
|
206
|
-
end
|
|
205
|
+
def stale_state; end
|
|
207
206
|
|
|
208
207
|
def build_record(attributes)
|
|
209
208
|
reflection.build_association(attributes) do |record|
|
|
@@ -22,7 +22,9 @@ module ActiveFedora
|
|
|
22
22
|
# Update the membership triples (and no other triples) on the the owner's resource
|
|
23
23
|
if owner.persisted?
|
|
24
24
|
pattern = ::RDF::Query::Pattern.new(predicate: options[:predicate])
|
|
25
|
-
new_resource =
|
|
25
|
+
new_resource = ActiveFedora::Base.uncached do
|
|
26
|
+
owner.dup.reload.resource
|
|
27
|
+
end
|
|
26
28
|
owner.resource.delete_insert([pattern], new_resource.query(pattern))
|
|
27
29
|
end
|
|
28
30
|
super
|
|
@@ -63,8 +63,7 @@ module ActiveFedora::Associations::Builder
|
|
|
63
63
|
name
|
|
64
64
|
end
|
|
65
65
|
|
|
66
|
-
def self.define_extensions(_model, _name)
|
|
67
|
-
end
|
|
66
|
+
def self.define_extensions(_model, _name); end
|
|
68
67
|
|
|
69
68
|
def self.define_callbacks(model, reflection)
|
|
70
69
|
if dependent = reflection.options[:dependent]
|
data/lib/active_fedora/file.rb
CHANGED
|
@@ -108,7 +108,7 @@ module ActiveFedora
|
|
|
108
108
|
end
|
|
109
109
|
|
|
110
110
|
begin
|
|
111
|
-
fedora_yml = YAML.
|
|
111
|
+
fedora_yml = YAML.safe_load(config_erb)
|
|
112
112
|
rescue Psych::SyntaxError => e
|
|
113
113
|
raise "fedora.yml was found, but could not be parsed. " \
|
|
114
114
|
"Error #{e.message}"
|
|
@@ -132,7 +132,7 @@ module ActiveFedora
|
|
|
132
132
|
end
|
|
133
133
|
|
|
134
134
|
begin
|
|
135
|
-
solr_yml = YAML.
|
|
135
|
+
solr_yml = YAML.safe_load(config_erb)
|
|
136
136
|
rescue StandardError
|
|
137
137
|
raise("solr.yml was found, but could not be parsed.\n")
|
|
138
138
|
end
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
module ActiveFedora
|
|
2
2
|
class NullLogger < Logger
|
|
3
|
-
def initialize(*)
|
|
4
|
-
end
|
|
3
|
+
def initialize(*); end
|
|
5
4
|
|
|
6
5
|
# allows all the usual logger method calls (warn, info, error, etc.)
|
|
7
|
-
def add(*)
|
|
8
|
-
end
|
|
6
|
+
def add(*); end
|
|
9
7
|
|
|
10
8
|
# In the NullLogger there are no levels, so none of these should be true.
|
|
11
9
|
[:debug?, :info?, :warn?, :error?, :fatal?].each do |method_name|
|
|
@@ -205,8 +205,7 @@ module ActiveFedora
|
|
|
205
205
|
end
|
|
206
206
|
|
|
207
207
|
# Override to tie in an ID minting service
|
|
208
|
-
def assign_id
|
|
209
|
-
end
|
|
208
|
+
def assign_id; end
|
|
210
209
|
|
|
211
210
|
# This is only used when creating a new record. If the object doesn't have an id
|
|
212
211
|
# and assign_id can mint an id for the object, then assign it to the resource.
|
|
@@ -228,6 +227,7 @@ module ActiveFedora
|
|
|
228
227
|
root_resource_path
|
|
229
228
|
end
|
|
230
229
|
|
|
230
|
+
# Check to see if the :base_path (from fedora.yml) exists in Fedora. If it doesn't exist, then create it.
|
|
231
231
|
def init_root_path
|
|
232
232
|
path = root_resource_path.gsub(/^\//, "")
|
|
233
233
|
ActiveFedora.fedora.connection.head(path)
|
|
@@ -11,8 +11,7 @@ module ActiveFedora
|
|
|
11
11
|
@limit = limit
|
|
12
12
|
end
|
|
13
13
|
|
|
14
|
-
def type
|
|
15
|
-
end
|
|
14
|
+
def type; end
|
|
16
15
|
|
|
17
16
|
# Converts a value from database input to the appropriate ruby type. The
|
|
18
17
|
# return value of this method will be returned from
|
|
@@ -102,8 +101,7 @@ module ActiveFedora
|
|
|
102
101
|
[self.class, precision, scale, limit].hash
|
|
103
102
|
end
|
|
104
103
|
|
|
105
|
-
def assert_valid_value(*)
|
|
106
|
-
end
|
|
104
|
+
def assert_valid_value(*); end
|
|
107
105
|
|
|
108
106
|
private
|
|
109
107
|
|
|
@@ -16,8 +16,8 @@ describe ActiveFedora::Base do
|
|
|
16
16
|
Object.send(:remove_const, :Person)
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
-
let(:person) { Person.create }
|
|
20
19
|
subject(:book) { Book.new(author: person) }
|
|
20
|
+
let(:person) { Person.create }
|
|
21
21
|
|
|
22
22
|
it "goes" do
|
|
23
23
|
book.save
|
|
@@ -511,8 +511,7 @@ describe ActiveFedora::Base do
|
|
|
511
511
|
after_count(m.reload.library_books.count)
|
|
512
512
|
end
|
|
513
513
|
|
|
514
|
-
def say_hi(_var)
|
|
515
|
-
end
|
|
514
|
+
def say_hi(_var); end
|
|
516
515
|
end
|
|
517
516
|
class Page < ActiveFedora::Base
|
|
518
517
|
has_many :library_books, predicate: ActiveFedora::RDF::Fcrepo::RelsExt.isPartOf
|
|
@@ -524,14 +523,15 @@ describe ActiveFedora::Base do
|
|
|
524
523
|
end
|
|
525
524
|
|
|
526
525
|
describe "removing association" do
|
|
527
|
-
let(:p1) { Page.create }
|
|
528
|
-
let(:p2) { Page.create }
|
|
529
526
|
subject(:book) do
|
|
530
527
|
book = LibraryBook.create
|
|
531
528
|
book.pages << p1 << p2
|
|
532
529
|
book.save!
|
|
533
530
|
book
|
|
534
531
|
end
|
|
532
|
+
let(:p1) { Page.create }
|
|
533
|
+
let(:p2) { Page.create }
|
|
534
|
+
|
|
535
535
|
it "saves between the before and after hooks" do
|
|
536
536
|
expect(book).to receive(:before_count).with(1)
|
|
537
537
|
expect(book).to receive(:after_count).with(0)
|
|
@@ -16,8 +16,8 @@ describe "Direct containers" do
|
|
|
16
16
|
let(:reloaded) { FooHistory.find(o.id) }
|
|
17
17
|
|
|
18
18
|
context "with no files" do
|
|
19
|
-
let(:o) { FooHistory.new }
|
|
20
19
|
subject { o.files }
|
|
20
|
+
let(:o) { FooHistory.new }
|
|
21
21
|
|
|
22
22
|
it { is_expected.to be_empty }
|
|
23
23
|
it { is_expected.to eq [] }
|
|
@@ -124,8 +124,8 @@ describe "Direct containers" do
|
|
|
124
124
|
let(:reloaded) { FooHistory.find(o.id) }
|
|
125
125
|
|
|
126
126
|
context "with no files" do
|
|
127
|
-
let(:o) { FooHistory.new }
|
|
128
127
|
subject { o.files }
|
|
128
|
+
let(:o) { FooHistory.new }
|
|
129
129
|
|
|
130
130
|
it { is_expected.to be_empty }
|
|
131
131
|
it { is_expected.to eq [] }
|
|
@@ -17,8 +17,8 @@ describe "fedora_solr_sync_issues" do
|
|
|
17
17
|
Object.send(:remove_const, :ParentThing)
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
-
let(:parent) { ParentThing.create }
|
|
21
20
|
subject(:child) { ChildThing.create parent: parent }
|
|
21
|
+
let(:parent) { ParentThing.create }
|
|
22
22
|
|
|
23
23
|
before { Ldp::Resource::RdfSource.new(ActiveFedora.fedora.connection, child.uri).delete }
|
|
24
24
|
|
|
@@ -4,7 +4,7 @@ require 'generators/active_fedora/config/fedora/fedora_generator'
|
|
|
4
4
|
describe ActiveFedora::Config::FedoraGenerator do
|
|
5
5
|
describe "#fcrepo_wrapper_config" do
|
|
6
6
|
let(:generator) { described_class.new }
|
|
7
|
-
let(:files_to_test) {[
|
|
7
|
+
let(:files_to_test) { [
|
|
8
8
|
'config/fcrepo_wrapper_test.yml',
|
|
9
9
|
'.fcrepo_wrapper'
|
|
10
10
|
]}
|
|
@@ -4,7 +4,7 @@ require 'generators/active_fedora/config/solr/solr_generator'
|
|
|
4
4
|
describe ActiveFedora::Config::SolrGenerator do
|
|
5
5
|
describe "#solr_wrapper_config" do
|
|
6
6
|
let(:generator) { described_class.new }
|
|
7
|
-
let(:files_to_test) {[
|
|
7
|
+
let(:files_to_test) { [
|
|
8
8
|
'config/solr_wrapper_test.yml',
|
|
9
9
|
'.solr_wrapper'
|
|
10
10
|
]}
|
|
@@ -28,17 +28,17 @@ describe ActiveFedora::Associations::HasManyAssociation do
|
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
context "when the owner is not saved, and potential targets (Books) exist" do
|
|
31
|
+
subject { library.books.count }
|
|
31
32
|
let!(:book) { Book.create }
|
|
32
33
|
let(:library) { Library.new }
|
|
33
|
-
subject { library.books.count }
|
|
34
34
|
# it excludes the books that aren't associated
|
|
35
35
|
it { is_expected.to eq 0 }
|
|
36
36
|
end
|
|
37
37
|
|
|
38
38
|
context "when the owner is saved with associations" do
|
|
39
|
+
subject { library.reload; library.books.count }
|
|
39
40
|
let(:book) { Book.create }
|
|
40
41
|
let!(:library) { Library.create(books: [book]) }
|
|
41
|
-
subject { library.reload; library.books.count }
|
|
42
42
|
# it excludes the books that are associated
|
|
43
43
|
it { is_expected.to eq 1 }
|
|
44
44
|
end
|
|
@@ -55,13 +55,13 @@ describe ActiveFedora::Associations::HasManyAssociation do
|
|
|
55
55
|
end
|
|
56
56
|
|
|
57
57
|
context "loading the association prior to a save that affects the association" do
|
|
58
|
-
let(:library) { Library.new }
|
|
59
58
|
before do
|
|
60
59
|
Book.create
|
|
61
60
|
library.books
|
|
62
61
|
library.save
|
|
63
62
|
end
|
|
64
63
|
subject { library.books.size }
|
|
64
|
+
let(:library) { Library.new }
|
|
65
65
|
it { is_expected.to eq 0 }
|
|
66
66
|
end
|
|
67
67
|
end
|
|
@@ -396,8 +396,6 @@ describe ActiveFedora::Associations::HasManyAssociation do
|
|
|
396
396
|
Object.send(:remove_const, :Library)
|
|
397
397
|
end
|
|
398
398
|
|
|
399
|
-
let(:library) { Library.create }
|
|
400
|
-
|
|
401
399
|
before do
|
|
402
400
|
library.books.create(title: ["Great Book"])
|
|
403
401
|
library.books.first.title = ["Better book"]
|
|
@@ -405,6 +403,7 @@ describe ActiveFedora::Associations::HasManyAssociation do
|
|
|
405
403
|
end
|
|
406
404
|
|
|
407
405
|
subject(:books) { library.books(true) }
|
|
406
|
+
let(:library) { Library.create }
|
|
408
407
|
|
|
409
408
|
it "saves the new title" do
|
|
410
409
|
expect(books.first.title).to eq ["Better book"]
|
|
@@ -114,8 +114,8 @@ describe "Indirect containers" do
|
|
|
114
114
|
let(:reloaded) { FooHistory.find(o.id) }
|
|
115
115
|
|
|
116
116
|
context "with no related_objects" do
|
|
117
|
-
let(:o) { FooHistory.new }
|
|
118
117
|
subject { o.related_objects }
|
|
118
|
+
let(:o) { FooHistory.new }
|
|
119
119
|
|
|
120
120
|
it { is_expected.to be_empty }
|
|
121
121
|
it { is_expected.to eq [] }
|
|
@@ -263,8 +263,8 @@ describe "Indirect containers" do
|
|
|
263
263
|
let(:reloaded) { FooHistory.find(o.id) }
|
|
264
264
|
|
|
265
265
|
context "with no related_objects" do
|
|
266
|
-
let(:o) { FooHistory.new }
|
|
267
266
|
subject { o.related_objects }
|
|
267
|
+
let(:o) { FooHistory.new }
|
|
268
268
|
|
|
269
269
|
it { is_expected.to be_empty }
|
|
270
270
|
it { is_expected.to eq [] }
|
|
@@ -11,6 +11,7 @@ describe ActiveFedora::SolrHit do
|
|
|
11
11
|
Object.send(:remove_const, :Foo)
|
|
12
12
|
end
|
|
13
13
|
|
|
14
|
+
subject(:solr_hit) { described_class.new(doc) }
|
|
14
15
|
let(:another) { Foo.create }
|
|
15
16
|
|
|
16
17
|
let!(:obj) { Foo.create!(
|
|
@@ -19,7 +20,6 @@ describe ActiveFedora::SolrHit do
|
|
|
19
20
|
) }
|
|
20
21
|
|
|
21
22
|
let(:doc) { obj.to_solr }
|
|
22
|
-
subject(:solr_hit) { described_class.new(doc) }
|
|
23
23
|
|
|
24
24
|
describe "#reify" do
|
|
25
25
|
let(:solr_reified) { solr_hit.reify }
|
|
@@ -32,6 +32,8 @@ describe ActiveFedora::Versionable do
|
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
describe 'sorting versions' do
|
|
35
|
+
subject(:graph) { ActiveFedora::VersionsGraph.new }
|
|
36
|
+
|
|
35
37
|
before do
|
|
36
38
|
allow(graph).to receive(:fedora_versions) { versions }
|
|
37
39
|
end
|
|
@@ -40,8 +42,6 @@ describe ActiveFedora::Versionable do
|
|
|
40
42
|
let(:version2) { instance_double(ActiveFedora::VersionsGraph::ResourceVersion, uri: 'http://localhost:8983/fedora/rest/test/84/61/63/98/84616398-f63a-4572-ba01-0689339e4fcb/fcr:versions/87a0a8c317f1e790373a67-c9ee-447d-b740-4faa882b1a1f', label: 'version2', created: '2015-04-02T19:54:45.96Z') }
|
|
41
43
|
let(:versions) { [version1, version2] }
|
|
42
44
|
|
|
43
|
-
subject(:graph) { ActiveFedora::VersionsGraph.new }
|
|
44
|
-
|
|
45
45
|
it 'sorts by DateTime' do
|
|
46
46
|
expect(graph.first).to eq version2
|
|
47
47
|
end
|
|
@@ -110,20 +110,25 @@ describe ActiveFedora::AttachedFiles do
|
|
|
110
110
|
end
|
|
111
111
|
|
|
112
112
|
describe "#accessor_name" do
|
|
113
|
-
|
|
114
|
-
|
|
113
|
+
subject { af_base.send(:accessor_name, value) }
|
|
114
|
+
context "with lowercase" do
|
|
115
|
+
let(:value) { 'abc' }
|
|
116
|
+
it { is_expected.to eq 'abc' }
|
|
115
117
|
end
|
|
116
118
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
+
context "with uppercase" do
|
|
120
|
+
let(:value) { 'ARCHIVAL_XML' }
|
|
121
|
+
it { is_expected.to eq 'ARCHIVAL_XML' }
|
|
119
122
|
end
|
|
120
123
|
|
|
121
|
-
|
|
122
|
-
|
|
124
|
+
context "with camelcase" do
|
|
125
|
+
let(:value) { 'descMetadata' }
|
|
126
|
+
it { is_expected.to eq 'descMetadata' }
|
|
123
127
|
end
|
|
124
128
|
|
|
125
|
-
|
|
126
|
-
|
|
129
|
+
context "with dashes" do
|
|
130
|
+
let(:value) { 'a-b' }
|
|
131
|
+
it { is_expected.to eq 'a_b' }
|
|
127
132
|
end
|
|
128
133
|
end
|
|
129
134
|
|
|
@@ -15,8 +15,8 @@ describe ActiveFedora::Base do
|
|
|
15
15
|
Object.send(:remove_const, :BarHistory4)
|
|
16
16
|
end
|
|
17
17
|
|
|
18
|
-
let(:obj) { BarHistory4.new(title: ['test1']) }
|
|
19
18
|
subject(:history) { obj }
|
|
19
|
+
let(:obj) { BarHistory4.new(title: ['test1']) }
|
|
20
20
|
|
|
21
21
|
describe "#attribute_names" do
|
|
22
22
|
context "on an instance" do
|
|
@@ -60,8 +60,8 @@ describe ActiveFedora::Base do
|
|
|
60
60
|
history.library = library
|
|
61
61
|
end
|
|
62
62
|
|
|
63
|
-
let(:library) { BarHistory4.create }
|
|
64
63
|
subject(:history) { BarHistory2.new }
|
|
64
|
+
let(:library) { BarHistory4.create }
|
|
65
65
|
|
|
66
66
|
after do
|
|
67
67
|
Object.send(:remove_const, :BarHistory2)
|
data/spec/unit/base_spec.rb
CHANGED
|
@@ -63,8 +63,8 @@ describe ActiveFedora::Base do
|
|
|
63
63
|
Object.send(:remove_const, :FooHistory)
|
|
64
64
|
end
|
|
65
65
|
|
|
66
|
-
let(:instance) { FooHistory.new(title: ['A label']) }
|
|
67
66
|
subject { instance.rdf_label }
|
|
67
|
+
let(:instance) { FooHistory.new(title: ['A label']) }
|
|
68
68
|
|
|
69
69
|
it { is_expected.to eq ['A label'] }
|
|
70
70
|
end
|
|
@@ -88,8 +88,8 @@ describe ActiveFedora::Base do
|
|
|
88
88
|
Object.send(:remove_const, :Creator)
|
|
89
89
|
end
|
|
90
90
|
|
|
91
|
-
let(:instance) { Creator.new(foaf_name: ['Carolyn'], job: ['Developer']) }
|
|
92
91
|
subject { instance.rdf_label }
|
|
92
|
+
let(:instance) { Creator.new(foaf_name: ['Carolyn'], job: ['Developer']) }
|
|
93
93
|
|
|
94
94
|
it { is_expected.to eq ['Developer'] }
|
|
95
95
|
end
|
data/spec/unit/callback_spec.rb
CHANGED
|
@@ -24,7 +24,7 @@ describe ActiveFedora::Base do
|
|
|
24
24
|
Object.send(:remove_const, :CallbackStub)
|
|
25
25
|
end
|
|
26
26
|
|
|
27
|
-
it "has after_initialize, before_save,after_save, before_create, after_create
|
|
27
|
+
it "has after_initialize, before_save, after_save, before_create, after_create" do
|
|
28
28
|
allow_any_instance_of(CallbackStub).to receive(:a_init)
|
|
29
29
|
allow_any_instance_of(CallbackStub).to receive :b_create
|
|
30
30
|
allow_any_instance_of(CallbackStub).to receive :a_create
|
|
@@ -34,7 +34,7 @@ describe ActiveFedora::Base do
|
|
|
34
34
|
@cb.save
|
|
35
35
|
end
|
|
36
36
|
|
|
37
|
-
it "has after_initialize, before_save,after_save, before_create, after_create, after_update, before_update, before_destroy" do
|
|
37
|
+
it "has after_initialize, before_save, after_save, before_create, after_create, after_update, before_update, before_destroy" do
|
|
38
38
|
allow_any_instance_of(CallbackStub).to receive(:a_init)
|
|
39
39
|
allow_any_instance_of(CallbackStub).to receive(:b_create)
|
|
40
40
|
allow_any_instance_of(CallbackStub).to receive(:a_create)
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
3
|
describe ActiveFedora::ChangeSet do
|
|
4
|
-
|
|
5
|
-
subject { change_set }
|
|
4
|
+
subject(:change_set) { described_class.new(base, base.resource, base.changed_attributes.keys) }
|
|
6
5
|
|
|
7
6
|
context "with an unchanged object" do
|
|
8
7
|
let(:base) { ActiveFedora::Base.new }
|
|
@@ -14,11 +14,12 @@ describe ActiveFedora::Associations::CollectionProxy do
|
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
describe "#spawn" do
|
|
17
|
+
subject { proxy.spawn }
|
|
18
|
+
|
|
17
19
|
let(:reflection) { ActiveFedora::Reflection.create(:has_many, :pages, nil, { predicate: ActiveFedora::RDF::Fcrepo::RelsExt.isMemberOfCollection }, Book) }
|
|
18
20
|
let(:association) { ActiveFedora::Associations::HasManyAssociation.new(Book.new, reflection) }
|
|
19
21
|
let(:proxy) { described_class.new(association) }
|
|
20
22
|
|
|
21
|
-
subject { proxy.spawn }
|
|
22
23
|
it { is_expected.to be_instance_of ActiveFedora::Relation }
|
|
23
24
|
end
|
|
24
25
|
end
|
data/spec/unit/core_spec.rb
CHANGED
|
@@ -11,8 +11,8 @@ describe ActiveFedora::Base do
|
|
|
11
11
|
end
|
|
12
12
|
end
|
|
13
13
|
|
|
14
|
-
let(:library) { Library.create }
|
|
15
14
|
subject(:book) { Book.new(library: library, title: "War and Peace", publisher: "Random House") }
|
|
15
|
+
let(:library) { Library.create }
|
|
16
16
|
|
|
17
17
|
after do
|
|
18
18
|
Object.send(:remove_const, :Book)
|
|
@@ -117,8 +117,8 @@ describe ActiveFedora::Base do
|
|
|
117
117
|
end
|
|
118
118
|
|
|
119
119
|
describe "id_to_uri" do
|
|
120
|
-
let(:id) { '123456w' }
|
|
121
120
|
subject(:uri) { described_class.id_to_uri(id) }
|
|
121
|
+
let(:id) { '123456w' }
|
|
122
122
|
|
|
123
123
|
context "with no custom proc is set" do
|
|
124
124
|
it { is_expected.to eq "#{ActiveFedora.fedora.base_uri}/123456w" }
|
|
@@ -157,8 +157,8 @@ describe ActiveFedora::Base do
|
|
|
157
157
|
end
|
|
158
158
|
|
|
159
159
|
describe "uri_to_id" do
|
|
160
|
-
let(:uri) { "#{ActiveFedora.fedora.base_uri}/foo/123456w" }
|
|
161
160
|
subject(:uri_id) { described_class.uri_to_id(uri) }
|
|
161
|
+
let(:uri) { "#{ActiveFedora.fedora.base_uri}/foo/123456w" }
|
|
162
162
|
|
|
163
163
|
context "with no custom proc is set" do
|
|
164
164
|
it { is_expected.to eq 'foo/123456w' }
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
3
|
describe ActiveFedora::DefaultModelMapper do
|
|
4
|
+
subject(:mapper) { described_class.new classifier_class: classifier, solr_field: solr_field, predicate: predicate }
|
|
4
5
|
let(:classifier) { class_double(ActiveFedora::ModelClassifier) }
|
|
5
6
|
let(:classifier_instance) { instance_double(ActiveFedora::ModelClassifier) }
|
|
6
7
|
let(:solr_field) { 'solr_field' }
|
|
7
8
|
let(:predicate) { 'info:predicate' }
|
|
8
|
-
subject(:mapper) { described_class.new classifier_class: classifier, solr_field: solr_field, predicate: predicate }
|
|
9
9
|
|
|
10
10
|
describe '#classifier' do
|
|
11
11
|
context 'with a solr document' do
|
|
@@ -2,8 +2,8 @@ require 'spec_helper'
|
|
|
2
2
|
|
|
3
3
|
describe ActiveFedora::FilePathBuilder do
|
|
4
4
|
describe ".build" do
|
|
5
|
-
let(:parent) { ActiveFedora::Base.new(id: '1234') }
|
|
6
5
|
subject { described_class.build(parent, nil, 'FOO') }
|
|
6
|
+
let(:parent) { ActiveFedora::Base.new(id: '1234') }
|
|
7
7
|
|
|
8
8
|
it { is_expected.to eq 'FOO1' }
|
|
9
9
|
|
data/spec/unit/file_spec.rb
CHANGED
|
@@ -1,29 +1,27 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
3
|
describe ActiveFedora::File do
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
subject(:af_file) { file }
|
|
4
|
+
subject(:af_file) { described_class.new }
|
|
7
5
|
|
|
8
6
|
it { is_expected.not_to be_metadata }
|
|
9
7
|
|
|
10
8
|
describe "#save!" do
|
|
11
9
|
context "when updating metadata" do
|
|
12
10
|
before do
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
af_file.content = 'foo'
|
|
12
|
+
af_file.save!
|
|
13
|
+
af_file.mime_type = 'application/pdf'
|
|
16
14
|
end
|
|
17
15
|
|
|
18
16
|
it "Updates metadata" do
|
|
19
|
-
expect(
|
|
20
|
-
|
|
17
|
+
expect(af_file.metadata).to receive(:save)
|
|
18
|
+
af_file.save!
|
|
21
19
|
end
|
|
22
20
|
end
|
|
23
21
|
end
|
|
24
22
|
|
|
25
23
|
describe "#behaves_like_io?" do
|
|
26
|
-
subject {
|
|
24
|
+
subject { af_file.send(:behaves_like_io?, object) }
|
|
27
25
|
|
|
28
26
|
context "with a File" do
|
|
29
27
|
let(:object) { File.new __FILE__ }
|
|
@@ -43,20 +41,20 @@ describe ActiveFedora::File do
|
|
|
43
41
|
end
|
|
44
42
|
|
|
45
43
|
describe "#uri" do
|
|
46
|
-
subject(:uri) {
|
|
44
|
+
subject(:uri) { af_file.uri }
|
|
47
45
|
|
|
48
46
|
context "when the file is in an ldp:BasicContainer" do
|
|
49
47
|
let(:parent) { ActiveFedora::Base.new(id: '1234') }
|
|
50
48
|
|
|
51
49
|
context "and it's initialized with the URI" do
|
|
52
|
-
let(:
|
|
50
|
+
let(:af_file) { described_class.new(parent.uri + "/FOO1") }
|
|
53
51
|
it "works" do
|
|
54
52
|
expect(uri.to_s).to eq "#{ActiveFedora.fedora.base_uri}/1234/FOO1"
|
|
55
53
|
end
|
|
56
54
|
end
|
|
57
55
|
|
|
58
56
|
context "and it's initialized with an ID" do
|
|
59
|
-
let(:
|
|
57
|
+
let(:af_file) { described_class.new(parent.id + "/FOO1") }
|
|
60
58
|
it "works" do
|
|
61
59
|
expect(uri.to_s).to eq "#{ActiveFedora.fedora.base_uri}/1234/FOO1"
|
|
62
60
|
end
|
|
@@ -184,12 +182,12 @@ describe ActiveFedora::File do
|
|
|
184
182
|
|
|
185
183
|
context "when the file has local content" do
|
|
186
184
|
before do
|
|
187
|
-
|
|
188
|
-
|
|
185
|
+
af_file.uri = "http://localhost:8983/fedora/rest/test/1234/abcd"
|
|
186
|
+
af_file.content = "hi there"
|
|
189
187
|
end
|
|
190
188
|
|
|
191
189
|
describe "#inspect" do
|
|
192
|
-
subject {
|
|
190
|
+
subject { af_file.inspect }
|
|
193
191
|
it { is_expected.to eq "#<ActiveFedora::File uri=\"http://localhost:8983/fedora/rest/test/1234/abcd\" >" }
|
|
194
192
|
end
|
|
195
193
|
end
|
|
@@ -214,11 +212,11 @@ describe ActiveFedora::File do
|
|
|
214
212
|
end
|
|
215
213
|
|
|
216
214
|
context "original_name" do
|
|
217
|
-
subject {
|
|
215
|
+
subject { af_file.original_name }
|
|
218
216
|
|
|
219
217
|
context "on a new file" do
|
|
220
218
|
context "that has a name set locally" do
|
|
221
|
-
before {
|
|
219
|
+
before { af_file.original_name = "my_image.png" }
|
|
222
220
|
it { is_expected.to eq "my_image.png" }
|
|
223
221
|
end
|
|
224
222
|
|
|
@@ -252,7 +250,7 @@ describe ActiveFedora::File do
|
|
|
252
250
|
end
|
|
253
251
|
|
|
254
252
|
context "digest" do
|
|
255
|
-
subject {
|
|
253
|
+
subject(:digest) { af_file.digest }
|
|
256
254
|
|
|
257
255
|
context "on a new file" do
|
|
258
256
|
it { is_expected.to be_empty }
|
|
@@ -274,11 +272,11 @@ describe ActiveFedora::File do
|
|
|
274
272
|
predicate = ::RDF::URI("http://fedora.info/definitions/v4/repository#digest")
|
|
275
273
|
object = RDF::URI.new("urn:sha1:f1d2d2f924e986ac86fdf7b36c94bcdf32beec15")
|
|
276
274
|
graph = ActiveTriples::Resource.new
|
|
277
|
-
graph << RDF::Statement.new(
|
|
278
|
-
allow(
|
|
275
|
+
graph << RDF::Statement.new(af_file.uri, predicate, object)
|
|
276
|
+
allow(af_file).to receive_message_chain(:metadata, :ldp_source, :graph).and_return(graph)
|
|
279
277
|
end
|
|
280
278
|
it "falls back on fedora:digest if premis:hasMessageDigest is not present" do
|
|
281
|
-
expect(
|
|
279
|
+
expect(digest.first).to be_kind_of RDF::URI
|
|
282
280
|
end
|
|
283
281
|
end
|
|
284
282
|
end
|
|
@@ -308,14 +306,14 @@ describe ActiveFedora::File do
|
|
|
308
306
|
end
|
|
309
307
|
|
|
310
308
|
describe "#create_date" do
|
|
311
|
-
subject {
|
|
309
|
+
subject { af_file.create_date }
|
|
312
310
|
describe "when new record" do
|
|
313
311
|
it { is_expected.to be_nil }
|
|
314
312
|
end
|
|
315
313
|
describe "when persisted" do
|
|
316
314
|
before do
|
|
317
|
-
|
|
318
|
-
|
|
315
|
+
af_file.content = "foo"
|
|
316
|
+
af_file.save!
|
|
319
317
|
end
|
|
320
318
|
it { is_expected.to be_a(DateTime) }
|
|
321
319
|
end
|
|
@@ -10,13 +10,12 @@ describe ActiveFedora::FilesHash do
|
|
|
10
10
|
|
|
11
11
|
after { Object.send(:remove_const, :FilesContainer) }
|
|
12
12
|
|
|
13
|
+
subject(:file_hash) { described_class.new(container) }
|
|
13
14
|
let(:reflection) { instance_double(ActiveFedora::Reflection::MacroReflection) }
|
|
14
15
|
let(:association) { instance_double(ActiveFedora::Associations::SingularAssociation, reader: object) }
|
|
15
16
|
let(:object) { double('object') }
|
|
16
17
|
let(:container) { FilesContainer.new }
|
|
17
18
|
|
|
18
|
-
subject(:file_hash) { described_class.new(container) }
|
|
19
|
-
|
|
20
19
|
describe "#key?" do
|
|
21
20
|
context 'when the key is present' do
|
|
22
21
|
it "is true" do
|
data/spec/unit/filter_spec.rb
CHANGED
|
@@ -120,14 +120,14 @@ describe ActiveFedora::Associations::FilterAssociation do
|
|
|
120
120
|
end
|
|
121
121
|
|
|
122
122
|
describe "#delete" do
|
|
123
|
+
subject { image.members }
|
|
124
|
+
|
|
123
125
|
let(:another_object) { TestObject.new }
|
|
124
126
|
before do
|
|
125
127
|
image.members = [test_object, test_collection, another_object]
|
|
126
128
|
image.child_objects.delete(test_object)
|
|
127
129
|
end
|
|
128
130
|
|
|
129
|
-
subject { image.members }
|
|
130
|
-
|
|
131
131
|
it { is_expected.to contain_exactly test_collection, another_object }
|
|
132
132
|
end
|
|
133
133
|
end
|
|
@@ -11,8 +11,8 @@ describe ActiveFedora::FixityService do
|
|
|
11
11
|
|
|
12
12
|
describe "initialize" do
|
|
13
13
|
context "with a string" do
|
|
14
|
-
let(:uri) { 'http://path/to/resource' }
|
|
15
14
|
subject { service.target }
|
|
15
|
+
let(:uri) { 'http://path/to/resource' }
|
|
16
16
|
it { is_expected.to eq 'http://path/to/resource' }
|
|
17
17
|
end
|
|
18
18
|
|
|
@@ -77,8 +77,7 @@ describe ActiveFedora::Associations::HasAndBelongsToManyAssociation do
|
|
|
77
77
|
before do
|
|
78
78
|
class Collection < ActiveFedora::Base
|
|
79
79
|
has_and_belongs_to_many :members, predicate: ActiveFedora::RDF::Fcrepo::RelsExt.hasCollectionMember, class_name: "ActiveFedora::Base", after_remove: :remove_member
|
|
80
|
-
def remove_member(_m)
|
|
81
|
-
end
|
|
80
|
+
def remove_member(_m); end
|
|
82
81
|
end
|
|
83
82
|
|
|
84
83
|
class Thing < ActiveFedora::Base
|
|
@@ -33,11 +33,11 @@ describe ActiveFedora::Associations::HasManyAssociation do
|
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
describe "#find_polymorphic_inverse" do
|
|
36
|
+
subject(:af_page) { association.send(:find_polymorphic_inverse, page) }
|
|
37
|
+
|
|
36
38
|
let(:book_reflection) { ActiveFedora::Reflection.create(:has_many, 'pages', nil, { predicate: ActiveFedora::RDF::Fcrepo::RelsExt.isPartOf }, Book) }
|
|
37
39
|
let(:association) { described_class.new(book, book_reflection) }
|
|
38
40
|
|
|
39
|
-
subject(:af_page) { association.send(:find_polymorphic_inverse, page) }
|
|
40
|
-
|
|
41
41
|
context "when a has_many is present" do
|
|
42
42
|
before do
|
|
43
43
|
# :books must come first, so that we can test that is being passed over in favor of :contents
|
data/spec/unit/indexing_spec.rb
CHANGED
|
@@ -53,9 +53,8 @@ describe ActiveFedora::Indexing do
|
|
|
53
53
|
Object.send(:remove_const, :SpecNode)
|
|
54
54
|
end
|
|
55
55
|
|
|
56
|
-
let(:test_object) { SpecNode.new(title: ['first title'], abstract: 'The abstract') }
|
|
57
|
-
|
|
58
56
|
subject(:solr_doc) { test_object.to_solr }
|
|
57
|
+
let(:test_object) { SpecNode.new(title: ['first title'], abstract: 'The abstract') }
|
|
59
58
|
|
|
60
59
|
it "indexs the rdf properties" do
|
|
61
60
|
expect(solr_doc).to include('title_tesim' => ['first title'], 'abstract_ssi' => 'The abstract')
|
|
@@ -17,8 +17,9 @@ describe ActiveFedora::Base do
|
|
|
17
17
|
has_subresource 'barstream', class_name: 'MyDS'
|
|
18
18
|
end
|
|
19
19
|
end
|
|
20
|
-
|
|
20
|
+
|
|
21
21
|
subject(:attached_files) { f.attached_files }
|
|
22
|
+
let(:f) { Foo.new }
|
|
22
23
|
|
|
23
24
|
it "doesn't overwrite stream specs" do
|
|
24
25
|
expect(attached_files.values).to match_array [MyDS, MySample]
|
|
@@ -10,8 +10,8 @@ describe ActiveFedora::ModelClassifier do
|
|
|
10
10
|
end
|
|
11
11
|
end
|
|
12
12
|
|
|
13
|
-
let(:class_names) { ["ParentClass::SiblingClass", "ParentClass::OtherSiblingClass", "ParentClass::SubclassClass", "ParentClass::NoSuchClass"] }
|
|
14
13
|
subject(:classifier) { described_class.new class_names }
|
|
14
|
+
let(:class_names) { ["ParentClass::SiblingClass", "ParentClass::OtherSiblingClass", "ParentClass::SubclassClass", "ParentClass::NoSuchClass"] }
|
|
15
15
|
|
|
16
16
|
describe ".class_from_string" do
|
|
17
17
|
it "returns class constants based on strings" do
|
data/spec/unit/pathing_spec.rb
CHANGED
|
@@ -2,8 +2,6 @@ require 'spec_helper'
|
|
|
2
2
|
|
|
3
3
|
describe ActiveFedora::Base do
|
|
4
4
|
describe ".uri_prefix" do
|
|
5
|
-
let(:path) { "foo" }
|
|
6
|
-
|
|
7
5
|
before do
|
|
8
6
|
class FooHistory < ActiveFedora::Base
|
|
9
7
|
def uri_prefix
|
|
@@ -18,6 +16,7 @@ describe ActiveFedora::Base do
|
|
|
18
16
|
end
|
|
19
17
|
|
|
20
18
|
subject(:history) { FooHistory.new(title: ["Root foo"]) }
|
|
19
|
+
let(:path) { "foo" }
|
|
21
20
|
|
|
22
21
|
it { is_expected.to have_uri_prefix }
|
|
23
22
|
|
|
@@ -5,8 +5,7 @@ describe ActiveFedora::QueryResultBuilder do
|
|
|
5
5
|
before(:all) do
|
|
6
6
|
class AudioRecord < ActiveFedora::Base
|
|
7
7
|
attr_accessor :id
|
|
8
|
-
def self.connection_for_id(_id)
|
|
9
|
-
end
|
|
8
|
+
def self.connection_for_id(_id); end
|
|
10
9
|
end
|
|
11
10
|
@sample_solr_hits = [{ "id" => "my:_ID1_", ActiveFedora.index_field_mapper.solr_name("has_model", :symbol) => ["AudioRecord"] },
|
|
12
11
|
{ "id" => "my:_ID2_", ActiveFedora.index_field_mapper.solr_name("has_model", :symbol) => ["AudioRecord"] },
|
data/spec/unit/query_spec.rb
CHANGED
|
@@ -242,9 +242,9 @@ describe ActiveFedora::Base do
|
|
|
242
242
|
end
|
|
243
243
|
|
|
244
244
|
describe '#search_with_conditions' do
|
|
245
|
+
subject(:search_with_conditions) { klass.search_with_conditions(conditions) }
|
|
245
246
|
let(:mock_result) { double('Result') }
|
|
246
247
|
let(:klass) { SpecModel::Basic }
|
|
247
|
-
subject(:search_with_conditions) { klass.search_with_conditions(conditions) }
|
|
248
248
|
|
|
249
249
|
before do
|
|
250
250
|
expect(ActiveFedora::SolrService).to receive(:query)
|
|
@@ -2,10 +2,10 @@ require 'spec_helper'
|
|
|
2
2
|
|
|
3
3
|
describe ActiveFedora::Reflection::AssociationReflection do
|
|
4
4
|
describe "#derive_foreign_key" do
|
|
5
|
+
subject { instance.send :derive_foreign_key }
|
|
5
6
|
let(:name) { 'dummy' }
|
|
6
7
|
let(:options) { { inverse_of: :default_permissions } }
|
|
7
8
|
let(:active_fedora) { instance_double(ActiveFedora::Base) }
|
|
8
|
-
subject { instance.send :derive_foreign_key }
|
|
9
9
|
|
|
10
10
|
context "when a has_many" do
|
|
11
11
|
let(:instance) { ActiveFedora::Reflection::HasManyReflection.new(name, nil, options, active_fedora) }
|
|
@@ -26,10 +26,10 @@ describe ActiveFedora::Reflection::AssociationReflection do
|
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
after { Object.send(:remove_const, :Dummy) }
|
|
29
|
+
subject { instance.send :automatic_inverse_of }
|
|
29
30
|
let(:name) { 'dummy' }
|
|
30
31
|
let(:options) { { as: 'foothing' } }
|
|
31
32
|
let(:active_fedora) { instance_double(ActiveFedora::Base) }
|
|
32
|
-
subject { instance.send :automatic_inverse_of }
|
|
33
33
|
|
|
34
34
|
context "when a has_many" do
|
|
35
35
|
let(:instance) { ActiveFedora::Reflection::HasManyReflection.new(name, nil, options, active_fedora) }
|
data/spec/unit/solr_hit_spec.rb
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
3
|
describe ActiveFedora::SparqlInsert do
|
|
4
|
-
let(:change_set) { ActiveFedora::ChangeSet.new(base, base.resource, base.changed_attributes.keys) }
|
|
5
4
|
subject(:sparql_insert) { described_class.new(change_set.changes) }
|
|
5
|
+
let(:change_set) { ActiveFedora::ChangeSet.new(base, base.resource, base.changed_attributes.keys) }
|
|
6
6
|
|
|
7
7
|
context "with a changed object" do
|
|
8
8
|
before do
|
|
@@ -24,8 +24,8 @@ describe ActiveFedora::WithMetadata::MetadataNode do
|
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
describe "changes_for_update" do
|
|
27
|
-
let(:changes_for_update) { node.send(:changes_for_update) }
|
|
28
27
|
subject { changes_for_update }
|
|
28
|
+
let(:changes_for_update) { node.send(:changes_for_update) }
|
|
29
29
|
|
|
30
30
|
context "when type is not set" do
|
|
31
31
|
it { is_expected.to eq({}) }
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: active-fedora
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 11.1.
|
|
4
|
+
version: 11.1.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Matt Zumwalt
|
|
@@ -10,7 +10,7 @@ authors:
|
|
|
10
10
|
autorequire:
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date: 2017-
|
|
13
|
+
date: 2017-03-07 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: rsolr
|
|
@@ -280,28 +280,28 @@ dependencies:
|
|
|
280
280
|
requirements:
|
|
281
281
|
- - "~>"
|
|
282
282
|
- !ruby/object:Gem::Version
|
|
283
|
-
version: 0.
|
|
283
|
+
version: 0.47.1
|
|
284
284
|
type: :development
|
|
285
285
|
prerelease: false
|
|
286
286
|
version_requirements: !ruby/object:Gem::Requirement
|
|
287
287
|
requirements:
|
|
288
288
|
- - "~>"
|
|
289
289
|
- !ruby/object:Gem::Version
|
|
290
|
-
version: 0.
|
|
290
|
+
version: 0.47.1
|
|
291
291
|
- !ruby/object:Gem::Dependency
|
|
292
292
|
name: rubocop-rspec
|
|
293
293
|
requirement: !ruby/object:Gem::Requirement
|
|
294
294
|
requirements:
|
|
295
295
|
- - "~>"
|
|
296
296
|
- !ruby/object:Gem::Version
|
|
297
|
-
version: 1.
|
|
297
|
+
version: 1.12.0
|
|
298
298
|
type: :development
|
|
299
299
|
prerelease: false
|
|
300
300
|
version_requirements: !ruby/object:Gem::Requirement
|
|
301
301
|
requirements:
|
|
302
302
|
- - "~>"
|
|
303
303
|
- !ruby/object:Gem::Version
|
|
304
|
-
version: 1.
|
|
304
|
+
version: 1.12.0
|
|
305
305
|
description: ActiveFedora provides for creating and managing objects in the Fedora
|
|
306
306
|
Repository Architecture.
|
|
307
307
|
email:
|
|
@@ -684,7 +684,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
684
684
|
version: '0'
|
|
685
685
|
requirements: []
|
|
686
686
|
rubyforge_project:
|
|
687
|
-
rubygems_version: 2.6.
|
|
687
|
+
rubygems_version: 2.6.10
|
|
688
688
|
signing_key:
|
|
689
689
|
specification_version: 4
|
|
690
690
|
summary: A convenience libary for manipulating documents in the Fedora Repository.
|