acfs 0.29.0.1.b254 → 0.29.0.1.b256

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ODA1MDU2MWE0YTA2Y2Q0MzZhNTgxNmQ4YzIxOTQzOTNmNGExYjg0YQ==
4
+ NDkwYWEyMjJhMWQ1MDE4NjZkMTE1NWJlZWNiNjA1MTFlYTk4YjNiMg==
5
5
  data.tar.gz: !binary |-
6
- ZjY0OTllYzNhOTNjNzEzMjg0YjRiY2E4Yzc1ZWRmNjIzZjkyNWFiYw==
6
+ YjdkYmRmMDZjYjQ0YzMxMDMwMTlhN2JiY2QxZDcwNGE5ODA0OGYwMA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MzUxNmIzMmNiYTRlOGJiYTgzNmRlYmExMDAzZDM2OWYyODAyODhmODM2ZGNh
10
- ZmYzMzFmMGI3MDEzZDlkMGM2MzdiYWE5OTdkNmIyNzYzYmE1YTFkODM3NDFm
11
- OTQzZjBiMzE5NDhkZTQ0Y2Y4YWY4MjgxMTk2ZGY4ZTBmMDRmMjk=
9
+ NmZlYjliNTRkYmViZDlhYzM4ZWE0YmNlMDk0NDI4M2YxNmE2NjNiZjZkMzA5
10
+ NWI1MzNlYThlOGYxOTk4M2U5YThiZDBjYWFhNzJmYTAxYjdjMDk3OTUyY2Ex
11
+ Y2ViOTA5YTVlNzA1YzIwZDE2YmQzMzY2YmMzYzQzYjViOThhOTI=
12
12
  data.tar.gz: !binary |-
13
- MTcxOTQwYjllMTEwMDhlN2NiMWQ2YWZhY2I3ZTI0ZGEwMzAzYTNiYjkyYTY5
14
- MGZjYTU2NDlhZDdlZWQzZjM0MjYxZWYxOWE0YTU2ODUyOWEwNTVjNjQ0NzBl
15
- MDhkMTM5NTkwM2M1OTg0Y2RlMTc3YThhNTkwMjg5ZjZiNDlhN2Y=
13
+ MDZhZDY3MDY2Njc2ZWJiMmQwYzU2YzRmZWZkZDQwZjc1MzZiYzY0MTcwNDRm
14
+ NDJhODBmNmRmNGQzM2NkZjlmZTIzNjYyZjU0YzUyM2QxNGRkMDNlZTQ1YmM5
15
+ NGI2YjYzZDc4ODY1ZmFmYzYzZjkyOGZiNGJkYTliY2Q4YzNjZmI=
@@ -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 #{type_name} is no subclass of #{base_class}"
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
- before do
155
- stub_request(:get, 'http://computers.example.org/computers').to_return response([{ id: 1, type: 'MyUser' }, { id: 2, type: 'Computer' }, { id: 3, type: 'Mac' }])
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
- it 'should raise error if type is no subclass' do
159
- Computer.all
160
- expect { Acfs.run }.to raise_error(Acfs::ResourceTypeError)
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.b254
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-04 00:00:00.000000000 Z
11
+ date: 2014-02-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport