acfs 0.29.0.1.b254 → 0.29.0.1.b256
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 +8 -8
- data/lib/acfs/errors.rb +1 -1
- data/lib/acfs/model/query_methods.rb +2 -0
- data/spec/acfs/model/query_methods_spec.rb +24 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NDkwYWEyMjJhMWQ1MDE4NjZkMTE1NWJlZWNiNjA1MTFlYTk4YjNiMg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YjdkYmRmMDZjYjQ0YzMxMDMwMTlhN2JiY2QxZDcwNGE5ODA0OGYwMA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NmZlYjliNTRkYmViZDlhYzM4ZWE0YmNlMDk0NDI4M2YxNmE2NjNiZjZkMzA5
|
10
|
+
NWI1MzNlYThlOGYxOTk4M2U5YThiZDBjYWFhNzJmYTAxYjdjMDk3OTUyY2Ex
|
11
|
+
Y2ViOTA5YTVlNzA1YzIwZDE2YmQzMzY2YmMzYzQzYjViOThhOTI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MDZhZDY3MDY2Njc2ZWJiMmQwYzU2YzRmZWZkZDQwZjc1MzZiYzY0MTcwNDRm
|
14
|
+
NDJhODBmNmRmNGQzM2NkZjlmZTIzNjYyZjU0YzUyM2QxNGRkMDNlZTQ1YmM5
|
15
|
+
NGI2YjYzZDc4ODY1ZmFmYzYzZjkyOGZiNGJkYTliY2Q4YzNjZmI=
|
data/lib/acfs/errors.rb
CHANGED
@@ -96,7 +96,7 @@ module Acfs
|
|
96
96
|
def initialize(opts = {})
|
97
97
|
@base_class = opts.delete :base_class
|
98
98
|
@type_name = opts.delete :type_name
|
99
|
-
opts[:message] = "Recieved ressource type
|
99
|
+
opts[:message] = "Recieved ressource type `#{type_name}` is no subclass of #{base_class}"
|
100
100
|
super
|
101
101
|
end
|
102
102
|
end
|
@@ -179,6 +179,8 @@ module Acfs::Model
|
|
179
179
|
klass = type.camelize.constantize
|
180
180
|
raise Acfs::ResourceTypeError.new type_name: type, base_class: self unless klass <= self
|
181
181
|
klass
|
182
|
+
rescue NameError, NoMethodError
|
183
|
+
raise Acfs::ResourceTypeError.new type_name: type, base_class: self
|
182
184
|
end
|
183
185
|
|
184
186
|
end
|
@@ -151,13 +151,32 @@ describe Acfs::Model::QueryMethods do
|
|
151
151
|
end
|
152
152
|
|
153
153
|
context 'with invalid type set' do
|
154
|
-
|
155
|
-
|
154
|
+
shared_examples 'with invalid type' do
|
155
|
+
it 'should raise error if type is no subclass' do
|
156
|
+
Computer.all
|
157
|
+
expect { Acfs.run }.to raise_error(Acfs::ResourceTypeError)
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
context 'with another resource as type instead' do
|
162
|
+
before do
|
163
|
+
stub_request(:get, 'http://computers.example.org/computers').to_return response([{ id: 1, type: 'MyUser' }, { id: 2, type: 'Computer' }, { id: 3, type: 'Mac' }])
|
164
|
+
end
|
165
|
+
it_behaves_like 'with invalid type'
|
156
166
|
end
|
157
167
|
|
158
|
-
|
159
|
-
|
160
|
-
|
168
|
+
context 'with a random string as type instead' do
|
169
|
+
before do
|
170
|
+
stub_request(:get, 'http://computers.example.org/computers').to_return response([{ id: 1, type: 'PC' }, { id: 2, type: 'noValidType' }, { id: 3, type: 'Mac' }])
|
171
|
+
end
|
172
|
+
it_behaves_like 'with invalid type'
|
173
|
+
end
|
174
|
+
|
175
|
+
context 'with a non-string as type instead' do
|
176
|
+
before do
|
177
|
+
stub_request(:get, 'http://computers.example.org/computers').to_return response([{ id: 1, type: 'PC' }, { id: 2, type: 'Computer' }, { id: 3, type: 42 }])
|
178
|
+
end
|
179
|
+
it_behaves_like 'with invalid type'
|
161
180
|
end
|
162
181
|
end
|
163
182
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acfs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.29.0.1.
|
4
|
+
version: 0.29.0.1.b256
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Graichen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02-
|
11
|
+
date: 2014-02-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|