active-fedora 9.0.0.beta6 → 9.0.0.beta7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d8fb1d0fea1b50349e3da9a6cb685e3865fcb716
4
- data.tar.gz: 518c8edc13fd3a87ef09c7022eee3d6a29c2ddb0
3
+ metadata.gz: 0efb77ba5a2ca5e2a3a904bf1f6181eb8ec1b7b6
4
+ data.tar.gz: f3996a300d97a4237839bb8875754a5c8eb8a54d
5
5
  SHA512:
6
- metadata.gz: 5c0bce8730af54df688fc1a3c0d5f41bc7df148070b21bfbeb81246c7766f650d73abf12b70deb3cefc415e40d416fb31c7856808705be923886334ced6200de
7
- data.tar.gz: f6467c70c153178f4c190a42d084727093b57387fe571d8a33722ca3bfea90b5ef4d2f9dd043ccac253e6ec8cef808889c255f31a6fe6bc37af0e1f732f40201
6
+ metadata.gz: cb3b8dc10a355f976a397a67ae4d638a4de029bab93dbe63993e317890e1a3b0c9e75e7403c29b2accb349a1ee1e14984321aa4877aed56bb0a91dd2d8152922
7
+ data.tar.gz: 8305e854f8477f0796b094cbf7e048874971687801d7d19450c05b22a82b9f8e016c316f0c4b13c24144b3956026898a3ee6a2d8d5aed7450802ef0e76e9b60e
@@ -22,7 +22,7 @@ Gem::Specification.new do |s|
22
22
  s.add_dependency "rdf-rdfxml", '~> 1.1.0'
23
23
  s.add_dependency "linkeddata"
24
24
  s.add_dependency "deprecation"
25
- s.add_dependency "ldp", '~> 0.1.0'
25
+ s.add_dependency "ldp", '~> 0.2.0'
26
26
  s.add_dependency "rdf-ldp"
27
27
 
28
28
  s.add_development_dependency "rdoc"
@@ -292,8 +292,9 @@ module ActiveFedora
292
292
  # @param opts [Hash] Options that will be passed through to ActiveFedora::SolrService.query.
293
293
  def load_from_solr(opts = Hash.new)
294
294
  return [] if @finder_query.empty?
295
- solr_opts = {rows: opts.delete(:rows) || count}
296
- SolrService.query(@finder_query, solr_opts.merge(opts))
295
+ rows = opts.delete(:rows) { count }
296
+ return [] if rows == 0
297
+ SolrService.query(@finder_query, {rows: rows}.merge(opts))
297
298
  end
298
299
 
299
300
  def add_to_target(record, skip_callbacks = false)
@@ -40,8 +40,8 @@ module ActiveFedora
40
40
  # This is for id attributes stored in the rdf graph.
41
41
  assoc.reader
42
42
  elsif self.class.properties.key?(key.to_s)
43
- # The attribute is stored in the RDF graph for this object
44
- resource[key]
43
+ # Use the generated method so that single value assetions are single
44
+ self.send(key)
45
45
  else
46
46
  # The attribute is a delegate to a datastream
47
47
  array_reader(key)
@@ -1,3 +1,3 @@
1
1
  module ActiveFedora
2
- VERSION = "9.0.0.beta6"
2
+ VERSION = "9.0.0.beta7"
3
3
  end
@@ -9,22 +9,29 @@ describe ActiveFedora::Base do
9
9
  belongs_to :library, predicate: ActiveFedora::RDF::RelsExt.hasMember
10
10
  end
11
11
  end
12
+
12
13
  let(:library) { Library.create! }
13
14
  let!(:book1) { Book.create!(library: library) }
14
15
  let!(:book2) { Book.create!(library: library) }
16
+
15
17
  after do
16
- Book.delete_all
17
- Library.delete_all
18
18
  Object.send(:remove_const, :Library)
19
19
  Object.send(:remove_const, :Book)
20
20
  end
21
+
21
22
  describe "load_from_solr" do
22
23
  it "should set rows to count, if not specified" do
23
24
  expect(library.books(response_format: :solr).size).to eq 2
24
25
  end
26
+
25
27
  it "should limit rows returned if option passed" do
26
28
  expect(library.books(response_format: :solr, rows: 1).size).to eq 1
27
29
  end
30
+
31
+ it "should not query solr if rows is 0" do
32
+ expect(ActiveFedora::SolrService).not_to receive(:query)
33
+ expect(library.books(response_format: :solr, rows: 0)).to eq []
34
+ end
28
35
  end
29
36
 
30
37
  describe "#delete_all" do
@@ -405,8 +405,24 @@ describe ActiveFedora::Base do
405
405
  let(:obj) { BarHistory4.new(title: ['test1']) }
406
406
  subject { obj }
407
407
 
408
- it "should be able to access the attributes" do
409
- expect(subject.title).to eq ['test1']
408
+ describe "accessing attributes" do
409
+ context "using generated methods" do
410
+ it "should return values" do
411
+ expect(subject.title).to eq ['test1']
412
+ end
413
+ end
414
+
415
+ context "using hash accessors" do
416
+ context "on single value fields" do
417
+ it "should have a default value" do
418
+ expect(subject[:abstract]).to be_nil
419
+ end
420
+
421
+ it "should return values" do
422
+ expect(subject[:title]).to eq ['test1']
423
+ end
424
+ end
425
+ end
410
426
  end
411
427
 
412
428
  context "indexing" do
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: 9.0.0.beta6
4
+ version: 9.0.0.beta7
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: 2014-12-08 00:00:00.000000000 Z
13
+ date: 2014-12-11 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rsolr
@@ -130,14 +130,14 @@ dependencies:
130
130
  requirements:
131
131
  - - "~>"
132
132
  - !ruby/object:Gem::Version
133
- version: 0.1.0
133
+ version: 0.2.0
134
134
  type: :runtime
135
135
  prerelease: false
136
136
  version_requirements: !ruby/object:Gem::Requirement
137
137
  requirements:
138
138
  - - "~>"
139
139
  - !ruby/object:Gem::Version
140
- version: 0.1.0
140
+ version: 0.2.0
141
141
  - !ruby/object:Gem::Dependency
142
142
  name: rdf-ldp
143
143
  requirement: !ruby/object:Gem::Requirement