test/test_patch.rb in zold-0.2 vs test/test_patch.rb in zold-0.3

- old
+ new

@@ -18,15 +18,15 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. require 'minitest/autorun' require 'tmpdir' -require_relative '../lib/zold/key.rb' -require_relative '../lib/zold/id.rb' -require_relative '../lib/zold/wallet.rb' -require_relative '../lib/zold/amount.rb' -require_relative '../lib/zold/patch.rb' +require_relative '../lib/zold/key' +require_relative '../lib/zold/id' +require_relative '../lib/zold/wallet' +require_relative '../lib/zold/amount' +require_relative '../lib/zold/patch' # Patch test. # Author:: Yegor Bugayenko (yegor256@gmail.com) # Copyright:: Copyright (c) 2018 Yegor Bugayenko # License:: MIT @@ -38,16 +38,16 @@ first = Zold::Wallet.new(File.join(dir, 'first')) second = Zold::Wallet.new(File.join(dir, 'second')) third = Zold::Wallet.new(File.join(dir, 'third')) first.init(id, Zold::Key.new(file: 'fixtures/id_rsa.pub')) File.write(second.path, File.read(first.path)) - first.sub(Zold::Amount.new(zld: 39), Zold::Id.new, key) - first.sub(Zold::Amount.new(zld: 11), Zold::Id.new, key) - first.sub(Zold::Amount.new(zld: 3), Zold::Id.new, key) - second.sub(Zold::Amount.new(zld: 44), Zold::Id.new, key) + first.sub(Zold::Amount.new(zld: 39), "NOPREFIX@#{Zold::Id.new}", key) + first.sub(Zold::Amount.new(zld: 11), "NOPREFIX@#{Zold::Id.new}", key) + first.sub(Zold::Amount.new(zld: 3), "NOPREFIX@#{Zold::Id.new}", key) + second.sub(Zold::Amount.new(zld: 44), "NOPREFIX@#{Zold::Id.new}", key) File.write(third.path, File.read(first.path)) - t = third.sub(Zold::Amount.new(zld: 10), Zold::Id.new, key) - third.add(t) + t = third.sub(Zold::Amount.new(zld: 10), "NOPREFIX@#{Zold::Id.new}", key) + third.add(t.inverse(id)) patch = Zold::Patch.new patch.start(first) patch.join(second) patch.join(third) FileUtils.rm(first.path)