Sha256: b8065d68a448a0d9fdbbb1ee3bd10a31b69a3752dddb56fe13e9a2e224cf2498
Contents?: true
Size: 1.43 KB
Versions: 4
Compression:
Stored size: 1.43 KB
Contents
require 'test_helper' class TestToriBackendChain < Test::Unit::TestCase include Tori::Backend setup do @filesystem1 = FileSystem.new(Pathname("test/tmp/tori/store1")) File.open(@filesystem1.root.join("testfile-1"), 'w+'){ |f| f.write("text-1") } @filesystem2 = FileSystem.new(Pathname("test/tmp/tori/store2")) File.open(@filesystem2.root.join("testfile-2"), 'w+'){ |f| f.write("text-2") } @backend = Chain.new(@filesystem1, @filesystem2) end test "#backend" do assert { @filesystem1 == @backend.backend("testfile-1") } assert { @filesystem2 == @backend.backend("testfile-2") } assert_raise(Chain::ExistError) { @backend.backend("testfile-3") } end test "#exist?" do assert { true == @backend.exist?("testfile-1") } assert { true == @backend.exist?("testfile-2") } assert { false == @backend.exist?("testfile-3") } end test "read" do assert { "text-1" == @backend.read("testfile-1") } assert { "text-2" == @backend.read("testfile-2") } assert_raise(Chain::ExistError) { @backend.read("testfile-3") } end test "open" do @backend.open("testfile-1") do |f| assert { "text-1" == f.read } assert { "test/tmp/tori/store1/testfile-1" == f.path } end @backend.open("testfile-2") do |f| assert { "text-2" == f.read } assert { "test/tmp/tori/store2/testfile-2" == f.path } end assert_raise(Chain::ExistError) { @backend.read("testfile-3") } end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
tori-0.6.3 | test/test_tori_backend_chain.rb |
tori-0.6.2 | test/test_tori_backend_chain.rb |
tori-0.6.1 | test/test_tori_backend_chain.rb |
tori-0.6.0 | test/test_tori_backend_chain.rb |