test/commands/test_clean.rb in zold-0.31.8 vs test/commands/test_clean.rb in zold-0.31.9

- old
+ new

@@ -1,8 +1,8 @@ # frozen_string_literal: true -# Copyright (c) 2018-2023 Zerocracy +# Copyright (c) 2018-2024 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 @@ -28,45 +28,45 @@ require_relative '../../lib/zold/copies' require_relative '../../lib/zold/commands/clean' # CLEAN test. # Author:: Yegor Bugayenko (yegor256@gmail.com) -# Copyright:: Copyright (c) 2018 Yegor Bugayenko +# Copyright:: Copyright (c) 2018-2024 Zerocracy # License:: MIT class TestClean < Zold::Test def test_cleans_copies - FakeHome.new(log: test_log).run do |home| + FakeHome.new(log: fake_log).run do |home| wallet = home.create_wallet copies = home.copies(wallet) copies.add('a1', 'host-1', 80, 1, time: Time.now - (26 * 60 * 60)) copies.add('a2', 'host-2', 80, 2, time: Time.now - (26 * 60 * 60)) - Zold::Clean.new(wallets: home.wallets, copies: copies.root, log: test_log).run(['clean', wallet.id.to_s]) + Zold::Clean.new(wallets: home.wallets, copies: copies.root, log: fake_log).run(['clean', wallet.id.to_s]) assert(copies.all.empty?) end end def test_clean_no_copies - FakeHome.new(log: test_log).run do |home| + FakeHome.new(log: fake_log).run do |home| wallet = home.create_wallet copies = home.copies(wallet) - Zold::Clean.new(wallets: home.wallets, copies: copies.root, log: test_log).run(['clean']) + Zold::Clean.new(wallets: home.wallets, copies: copies.root, log: fake_log).run(['clean']) assert(copies.all.empty?) end end def test_cleans_empty_wallets - FakeHome.new(log: test_log).run do |home| - Zold::Clean.new(wallets: home.wallets, copies: File.join(home.dir, 'c'), log: test_log).run(['clean']) + FakeHome.new(log: fake_log).run do |home| + Zold::Clean.new(wallets: home.wallets, copies: File.join(home.dir, 'c'), log: fake_log).run(['clean']) end end def test_cleans_copies_in_threads - FakeHome.new(log: test_log).run do |home| + FakeHome.new(log: fake_log).run do |home| wallet = home.create_wallet copies = home.copies(wallet) copies.add(File.read(wallet.path), 'host-2', 80, 2, time: Time.now) Threads.new(20).assert do - Zold::Clean.new(wallets: home.wallets, copies: copies.root, log: test_log).run(['clean']) + Zold::Clean.new(wallets: home.wallets, copies: copies.root, log: fake_log).run(['clean']) end assert_equal(1, copies.all.count) end end end