fbe 0.30.0 → 0.31.0

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.
@@ -1,39 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # SPDX-FileCopyrightText: Copyright (c) 2024-2025 Zerocracy
4
- # SPDX-License-Identifier: MIT
5
-
6
- require 'factbase'
7
- require_relative '../../lib/fbe/fb'
8
- require_relative '../../lib/fbe/kill_if'
9
- require_relative '../test__helper'
10
-
11
- # Test.
12
- # Author:: Yegor Bugayenko (yegor256@gmail.com)
13
- # Copyright:: Copyright (c) 2024-2025 Zerocracy
14
- # License:: MIT
15
- class TestKillIf < Fbe::Test
16
- def test_deletes_a_few
17
- fb = Factbase.new
18
- f = fb.insert
19
- f.foo = 42
20
- f.hey = 4
21
- f.id = 555
22
- Fbe.kill_if([f], fb:, fid: 'id')
23
- assert_equal(0, fb.size)
24
- end
25
-
26
- def test_deletes_with_a_block
27
- fb = Factbase.new
28
- fb.insert.then do |f|
29
- f.foo = 0
30
- f._id = 777
31
- end
32
- fb.insert.then do |f|
33
- f.foo = 1
34
- f._id = 778
35
- end
36
- assert_equal(1, Fbe.kill_if(fb.query('(always)').each.to_a, fb:) { |f| f.foo.zero? })
37
- assert_equal(1, fb.size)
38
- end
39
- end