acfs 0.43.0 → 0.43.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 +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/acfs/stub.rb +2 -2
- data/lib/acfs/version.rb +1 -1
- data/spec/acfs/stub_spec.rb +69 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b273e1b3c19b7b27fdbea33867f442ec33ada319
|
4
|
+
data.tar.gz: cd853ac93c6276d23cae140d860bf563ba62159b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a73b486b0685757f0f5495f9cd358978a6702f78805c5ceeb354aa3e7da086bdae2b4fe0f11a664cb8c1ed753aeb50b7a9bfe4f2cac47b14241f33f883d31ba2
|
7
|
+
data.tar.gz: 088703ae6692aab3666106c6bd3afcdda44fa37676e4351842e32a1b1777a29fff31daf1b2f0c05c03fe0a6d85d12058aedd87a17710530a28c30b117231c8b6
|
data/CHANGELOG.md
CHANGED
data/lib/acfs/stub.rb
CHANGED
@@ -32,8 +32,8 @@ module Acfs
|
|
32
32
|
return true if with.reject {|_, v| v.nil? } == data.reject {|_, v| v.nil? }
|
33
33
|
false
|
34
34
|
when :inclusion
|
35
|
-
|
36
|
-
(params.key?(k) && params[k]
|
35
|
+
with.each_pair.all? do |k, v|
|
36
|
+
(params.key?(k) && params[k] == v) || (data.key?(k) && data[k] == v)
|
37
37
|
end
|
38
38
|
end
|
39
39
|
end
|
data/lib/acfs/version.rb
CHANGED
data/spec/acfs/stub_spec.rb
CHANGED
@@ -265,4 +265,73 @@ describe Acfs::Stub do
|
|
265
265
|
end
|
266
266
|
end
|
267
267
|
end
|
268
|
+
|
269
|
+
describe 'accept?' do
|
270
|
+
subject { stub.accept?(op) }
|
271
|
+
|
272
|
+
context 'with a match in params' do
|
273
|
+
let(:op) do
|
274
|
+
double('operation').tap do |op|
|
275
|
+
allow(op).to receive(:full_params).and_return(id: 1337, blub: 'abc')
|
276
|
+
allow(op).to receive(:data).and_return({})
|
277
|
+
end
|
278
|
+
end
|
279
|
+
|
280
|
+
let(:stub) { Acfs::Stub.resource MyUser, :read, with: {id: 1337} }
|
281
|
+
|
282
|
+
it { is_expected.to be true }
|
283
|
+
end
|
284
|
+
|
285
|
+
context 'with a match in data' do
|
286
|
+
let(:op) do
|
287
|
+
double('operation').tap do |op|
|
288
|
+
allow(op).to receive(:full_params).and_return({})
|
289
|
+
allow(op).to receive(:data).and_return(id: 1337, blub: 'abc')
|
290
|
+
end
|
291
|
+
end
|
292
|
+
|
293
|
+
let(:stub) { Acfs::Stub.resource MyUser, :read, with: {id: 1337} }
|
294
|
+
|
295
|
+
it { is_expected.to be true }
|
296
|
+
end
|
297
|
+
|
298
|
+
context 'with no match in params nor data' do
|
299
|
+
let(:op) do
|
300
|
+
double('operation').tap do |op|
|
301
|
+
allow(op).to receive(:full_params).and_return(id: 1337)
|
302
|
+
allow(op).to receive(:data).and_return({})
|
303
|
+
end
|
304
|
+
end
|
305
|
+
|
306
|
+
let(:stub) { Acfs::Stub.resource MyUser, :read, with: {abc: '123'} }
|
307
|
+
|
308
|
+
it { is_expected.to be false }
|
309
|
+
end
|
310
|
+
|
311
|
+
context 'with a wrong match' do
|
312
|
+
let(:op) do
|
313
|
+
double('operation').tap do |op|
|
314
|
+
allow(op).to receive(:full_params).and_return(id: 1337, blub: 'abc')
|
315
|
+
allow(op).to receive(:data).and_return({})
|
316
|
+
end
|
317
|
+
end
|
318
|
+
|
319
|
+
let(:stub) { Acfs::Stub.resource MyUser, :read, with: {id: 1337, blub: '123'} }
|
320
|
+
|
321
|
+
it { is_expected.to be false }
|
322
|
+
end
|
323
|
+
|
324
|
+
context 'with a missing match' do
|
325
|
+
let(:op) do
|
326
|
+
double('operation').tap do |op|
|
327
|
+
allow(op).to receive(:full_params).and_return(id: 1337, blub: 'abc')
|
328
|
+
allow(op).to receive(:data).and_return({})
|
329
|
+
end
|
330
|
+
end
|
331
|
+
|
332
|
+
let(:stub) { Acfs::Stub.resource MyUser, :read, with: {id: 1337, answer: 42} }
|
333
|
+
|
334
|
+
it { is_expected.to be false }
|
335
|
+
end
|
336
|
+
end
|
268
337
|
end
|