factbase 0.9.9 → 0.9.10
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/lib/factbase/accum.rb +1 -1
- data/lib/factbase/tee.rb +1 -1
- data/lib/factbase.rb +1 -1
- data/test/factbase/test_accum.rb +12 -0
- data/test/factbase/test_tee.rb +24 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eda6e3c356b973e7cb4ce6c10d709a94a7e5f390168a3e72818ce57b705401ac
|
4
|
+
data.tar.gz: 6e9712aea64f66a65fe8870213889576ab510c908f413bc84f3b1c9c352ecc04
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 33032268ae5f9be44b9360234960efd89bdc424d65e21543d75a50a95f9fe0628608319e29719ac836b72f0592b362fc3792e2fc364233ef73593f6111c22eb6
|
7
|
+
data.tar.gz: c7e3621f05a28492e8c756d44ecd5312aea97e0d7990d08408d5d30d481bbd76bb28615f78be44ac7875508133961d200b677a887c9b129b8c7dad425348d96b
|
data/lib/factbase/accum.rb
CHANGED
data/lib/factbase/tee.rb
CHANGED
data/lib/factbase.rb
CHANGED
@@ -82,7 +82,7 @@ require 'yaml'
|
|
82
82
|
# License:: MIT
|
83
83
|
class Factbase
|
84
84
|
# Current version of the gem (changed by .rultor.yml on every release)
|
85
|
-
VERSION = '0.9.
|
85
|
+
VERSION = '0.9.10' unless const_defined?(:VERSION)
|
86
86
|
|
87
87
|
# An exception that may be thrown in a transaction, to roll it back.
|
88
88
|
class Rollback < StandardError; end
|
data/test/factbase/test_accum.rb
CHANGED
@@ -8,6 +8,10 @@ require_relative '../../lib/factbase'
|
|
8
8
|
require_relative '../../lib/factbase/accum'
|
9
9
|
require_relative '../../lib/factbase/fact'
|
10
10
|
|
11
|
+
def global_function_for_this_test_only(foo)
|
12
|
+
raise foo
|
13
|
+
end
|
14
|
+
|
11
15
|
# Accum test.
|
12
16
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
13
17
|
# Copyright:: Copyright (c) 2024-2025 Yegor Bugayenko
|
@@ -24,6 +28,14 @@ class TestAccum < Factbase::Test
|
|
24
28
|
assert_equal([42], props['foo'])
|
25
29
|
end
|
26
30
|
|
31
|
+
def test_fetches_without_conflict_with_global_name
|
32
|
+
t = Factbase::Accum.new(
|
33
|
+
Factbase::Fact.new({ 'global_function_for_this_test_only' => [2] }),
|
34
|
+
{}, true
|
35
|
+
)
|
36
|
+
assert_equal(2, t.global_function_for_this_test_only)
|
37
|
+
end
|
38
|
+
|
27
39
|
def test_passes_props
|
28
40
|
map = {}
|
29
41
|
f = Factbase::Fact.new(map)
|
data/test/factbase/test_tee.rb
CHANGED
@@ -5,9 +5,14 @@
|
|
5
5
|
|
6
6
|
require_relative '../test__helper'
|
7
7
|
require_relative '../../lib/factbase'
|
8
|
+
require_relative '../../lib/factbase/accum'
|
8
9
|
require_relative '../../lib/factbase/tee'
|
9
10
|
require_relative '../../lib/factbase/fact'
|
10
11
|
|
12
|
+
def global_function_for_test_only(foo)
|
13
|
+
raise foo
|
14
|
+
end
|
15
|
+
|
11
16
|
# Tee test.
|
12
17
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
13
18
|
# Copyright:: Copyright (c) 2024-2025 Yegor Bugayenko
|
@@ -30,6 +35,25 @@ class TestTee < Factbase::Test
|
|
30
35
|
assert_nil(t['$foo'])
|
31
36
|
end
|
32
37
|
|
38
|
+
def test_fetches_simply
|
39
|
+
t = Factbase::Accum.new(
|
40
|
+
Factbase::Tee.new(
|
41
|
+
Factbase::Fact.new({ 'foo_bar' => [987] }),
|
42
|
+
Factbase::Fact.new({})
|
43
|
+
),
|
44
|
+
{}, true
|
45
|
+
)
|
46
|
+
assert_equal(987, t.foo_bar)
|
47
|
+
end
|
48
|
+
|
49
|
+
def test_fetches_without_conflict_with_global_name
|
50
|
+
t = Factbase::Tee.new(
|
51
|
+
Factbase::Fact.new({ 'global_function_for_test_only' => [2] }),
|
52
|
+
Factbase::Fact.new({})
|
53
|
+
)
|
54
|
+
assert_equal(2, t.global_function_for_test_only)
|
55
|
+
end
|
56
|
+
|
33
57
|
def test_all_properties
|
34
58
|
prim = Factbase::Fact.new({})
|
35
59
|
prim.foo = 42
|