test/node/test_async_entrance.rb in zold-0.31.5 vs test/node/test_async_entrance.rb in zold-0.31.6
- old
+ new
@@ -1,8 +1,8 @@
# frozen_string_literal: true
-# Copyright (c) 2018-2023 Zerocracy, Inc.
+# Copyright (c) 2018-2023 Zerocracy
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the 'Software'), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@@ -47,11 +47,11 @@
amount = Zold::Amount.new(zld: 39.99)
key = Zold::Key.new(file: 'fixtures/id_rsa')
wallet.sub(amount, "NOPREFIX@#{Zold::Id.new}", key)
basic = CountingEntrance.new
Zold::AsyncEntrance.new(basic, File.join(home.dir, 'a/b/c'), log: test_log).start do |e|
- e.push(wallet.id, IO.read(wallet.path))
+ e.push(wallet.id, File.read(wallet.path))
assert_equal_wait(1) { basic.count }
end
end
end
@@ -62,30 +62,32 @@
Threads.new(20).assert do
wallet = home.create_wallet
amount = Zold::Amount.new(zld: 39.99)
key = Zold::Key.new(file: 'fixtures/id_rsa')
wallet.sub(amount, "NOPREFIX@#{Zold::Id.new}", key)
- 5.times { e.push(wallet.id, IO.read(wallet.path)) }
+ 5.times { e.push(wallet.id, File.read(wallet.path)) }
end
assert_equal_wait(true) { basic.count >= 20 }
end
end
end
def test_handles_broken_entrance_gracefully
FakeHome.new(log: test_log).run do |home|
wallet = home.create_wallet
id = wallet.id
- body = IO.read(wallet.path)
+ body = File.read(wallet.path)
Zold::AsyncEntrance.new(BrokenEntrance.new, home.dir, log: test_log).start do |e|
e.push(id, body)
end
end
end
class CountingEntrance < FakeEntrance
attr_reader :count
+
def initialize
+ super
@count = 0
end
def push(_, _)
@count += 1