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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0f1766a2689f9c913392aa1043fe386ecef50182
4
- data.tar.gz: de21e2406b4178106c085594630a24fe6a591f99
3
+ metadata.gz: b273e1b3c19b7b27fdbea33867f442ec33ada319
4
+ data.tar.gz: cd853ac93c6276d23cae140d860bf563ba62159b
5
5
  SHA512:
6
- metadata.gz: fb2415918968e9bc642a3d4762acbfa3a4fb9222beb16b4f1eafe138a2aeb9e53dedcd7789b14908aff2428eb6948a800f3ebe59e138fef3e5aed03d089b775f
7
- data.tar.gz: 57ac583c1f24ff0f1c12e9d4041496e96476675c8be3d60ace5d98c1f0cec270d6419d9edf7eff533c5e218db689368a4ee92ac58172370c8f12a27b9b754c5b
6
+ metadata.gz: a73b486b0685757f0f5495f9cd358978a6702f78805c5ceeb354aa3e7da086bdae2b4fe0f11a664cb8c1ed753aeb50b7a9bfe4f2cac47b14241f33f883d31ba2
7
+ data.tar.gz: 088703ae6692aab3666106c6bd3afcdda44fa37676e4351842e32a1b1777a29fff31daf1b2f0c05c03fe0a6d85d12058aedd87a17710530a28c30b117231c8b6
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.43.1
4
+
5
+ * Fix `:with` condition matching on stubs
6
+
3
7
  ## 0.43.0
4
8
 
5
9
  * Remove `Acfs::Model` (inherit from `Acfs::Resource`)
@@ -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
- !with.each_pair.any? do |k, v|
36
- (params.key?(k) && params[k] != v) || (data.key?(k) && data[k] != v)
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
@@ -2,7 +2,7 @@ module Acfs
2
2
  module VERSION
3
3
  MAJOR = 0
4
4
  MINOR = 43
5
- PATCH = 0
5
+ PATCH = 1
6
6
  STAGE = nil
7
7
 
8
8
  STRING = [MAJOR, MINOR, PATCH, STAGE].reject(&:nil?).join('.')
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acfs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.43.0
4
+ version: 0.43.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Graichen