test/factbase/test_fact.rb in factbase-0.0.46 vs test/factbase/test_fact.rb in factbase-0.0.47
- old
+ new
@@ -27,10 +27,21 @@
# Fact test.
# Author:: Yegor Bugayenko (yegor256@gmail.com)
# Copyright:: Copyright (c) 2024 Yegor Bugayenko
# License:: MIT
class TestFact < Minitest::Test
+ def test_injects_data_correctly
+ map = {}
+ f = Factbase::Fact.new(Mutex.new, map)
+ f.foo = 1
+ f.bar = 2
+ f.bar = 3
+ assert_equal(2, map.size)
+ assert_equal([1], map['foo'])
+ assert_equal([2, 3], map['bar'])
+ end
+
def test_simple_resetting
map = {}
f = Factbase::Fact.new(Mutex.new, map)
f.foo = 42
assert_equal(42, f.foo, f.to_s)
@@ -87,10 +98,10 @@
def test_set_twice_same_value
map = {}
f = Factbase::Fact.new(Mutex.new, map)
f.foo = 42
f.foo = 42
- assert_equal(42, map['foo'])
+ assert_equal([42], map['foo'])
end
def test_time_in_utc
f = Factbase::Fact.new(Mutex.new, {})
t = Time.now