Skip to content

Commit

Permalink
#64 fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Aug 12, 2024
1 parent 655606e commit 3fc271b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/fbe/repeatedly.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,5 @@ def Fbe.repeatedly(area, p_every_hours, fb: Fbe.fb, judge: $judge, loog: $loog,
f.what = judge
end
Fbe.overwrite(f, 'when', Time.now)
yield f
yield fb.query("(and (eq what '#{judge}'))").each.to_a.first
end
7 changes: 5 additions & 2 deletions test/fbe/test_repeatedly.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
require 'minitest/autorun'
require 'loog'
require 'factbase'
require 'judges/options'
require_relative '../test__helper'
require_relative '../../lib/fbe/repeatedly'

Expand All @@ -35,14 +36,16 @@
class TestRepeatedly < Minitest::Test
def test_simple
$fb = Factbase.new
loog = Loog::NULL
$loog = Loog::NULL
$options = Judges::Options.new
judge = 'test'
$global = {}
3.times do
Fbe.repeatedly('pmp', 'every_x_hours', loog:, judge:) do |f|
Fbe.repeatedly('pmp', 'every_x_hours', judge:) do |f|
f.foo = 42
end
end
assert_equal(1, $fb.size)
assert_equal(42, $fb.query('(always)').each.to_a.first.foo)
end
end

0 comments on commit 3fc271b

Please sign in to comment.