speedy-af 0.6.0 → 0.6.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c72484eda4b8aab6cfd7f24213b6dcd6a3d1b726c59d106a2257d3932a7b7a10
4
- data.tar.gz: 7fb4b39977497770a3bd35bff2a57ac8149ff1a233dc7f1594ea881eece9d9e1
3
+ metadata.gz: e0b87455a3724096083b0ee86c462df634780c3aa9a17e121087d7497610aa53
4
+ data.tar.gz: 845ce23c6ccdcc7ad89f130d8d6e850228c8e7fcd495b873c6c39048eabace61
5
5
  SHA512:
6
- metadata.gz: 75fdd0cde86d2f9a7dc7ea821c03eb24011245a6af1a11d5cb52e246d4514ee33bbd502ab1146001ff25c81b3ff7e0773f1fce82ab20292b76f717d48183d382
7
- data.tar.gz: 9b88e5a9d6a97e41610a950cb0bd57c981ad85577ca59fa31906f87c73ed2ac536acdfe914a426e56f9e9c5404e57c3e484288ed2c3dc0dfefe3f6e8a86dd4d4
6
+ metadata.gz: ed974b3a2adb1802befbc240ca0a3a3ff64de6d4af73e975bf941384de40ae1997082800da10cd2f722491bab2782a729ccd7a0cea2b668767920b45d9eab9f0
7
+ data.tar.gz: c2771b07ca48dab6179ea713762351c8de56edaac75c8e7e8619ca0decad6792a0d082e64e8280a0affd56460a6f44cfcb4454e1e657bfa960ac89f604026a87
@@ -43,7 +43,9 @@ module SpeedyAF
43
43
  end
44
44
 
45
45
  def find(id, opts = {})
46
+ raise ArgumentError, "Couldn't find SpeedyAF::Base without an ID" if id.blank?
46
47
  result = where(%(id:"#{id}"), opts.merge(rows: 1)).first
48
+ raise SpeedyAF::RecordNotFound, "Couldn't find SpeedyAF::Base with ID '#{id}'" if result.blank?
47
49
  raise SpeedyAF::ModelMismatch if self != result.class && self != SpeedyAF::Base
48
50
  result
49
51
  end
@@ -2,4 +2,5 @@
2
2
  module SpeedyAF
3
3
  class ProxyError < StandardError; end
4
4
  class ModelMismatch < ProxyError; end
5
+ class RecordNotFound < ProxyError; end
5
6
  end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module SpeedyAF
3
- VERSION = '0.6.0'
3
+ VERSION = '0.6.1'
4
4
  end
@@ -68,12 +68,20 @@ describe SpeedyAF::Base do
68
68
  expect(book_presenter.publisher).to eq(book.publisher)
69
69
  end
70
70
 
71
+ it 'raises ArgumentError if id is blank' do
72
+ expect { SpeedyAF::Base.find(nil) }.to raise_error(ArgumentError, "Couldn't find SpeedyAF::Base without an ID")
73
+ end
74
+
75
+ it 'raises RecordNotFound if id is not found' do
76
+ expect { SpeedyAF::Base.find('foo') }.to raise_error(SpeedyAF::RecordNotFound, "Couldn't find SpeedyAF::Base with ID 'foo'")
77
+ end
78
+
71
79
  context 'proxy subclass' do
72
80
  it 'does not raise error for matching model' do
73
81
  expect { SpeedyAF::Proxy::Book.find(book.id) }.to_not raise_error
74
82
  end
75
83
  it 'raises error for mismatched model' do
76
- expect { SpeedyAF::Proxy::Book.find(comic.id) }.to raise_error(SpeedyAF::ModelMismatch)
84
+ expect { SpeedyAF::Proxy::Book.find(library.id) }.to raise_error(SpeedyAF::ModelMismatch)
77
85
  end
78
86
  end
79
87
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: speedy-af
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael B. Klein
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 1980-01-02 00:00:00.000000000 Z
10
+ date: 2026-04-22 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: active-fedora
@@ -197,8 +197,8 @@ executables: []
197
197
  extensions: []
198
198
  extra_rdoc_files:
199
199
  - CONTRIBUTING.md
200
- - LICENSE
201
200
  - README.md
201
+ - LICENSE
202
202
  files:
203
203
  - ".circleci/config.yml"
204
204
  - ".gitignore"
@@ -256,7 +256,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
256
256
  - !ruby/object:Gem::Version
257
257
  version: '0'
258
258
  requirements: []
259
- rubygems_version: 4.0.3
259
+ rubygems_version: 3.6.5
260
260
  specification_version: 4
261
261
  summary: Performance enhancements for ActiveFedora
262
262
  test_files: []