class TestSiteAttach

Public Instance Methods

test_site_attach() click to toggle source
# File vendor/qwik/lib/qwik/site-files.rb, line 54
    def test_site_attach
      dir = '.test/'.path
      dir.setup
      attach = Qwik::SiteAttach.new(dir)

      d = dir+'.attach'
      d.teardown if d.exist?

      ok_eq(false, attach.exist?('t.txt'))

      # test put
      attach.fput('t.txt', 't')
      ok_eq(true, attach.exist?('t.txt'))

      # test get
      path = attach.path('t.txt')
      ok_eq('.test/.attach/t.txt', path.to_s)
      ok_eq('t', path.read)

      # test delete
      attach.delete('t.txt')
      ok_eq(false, attach.exist?('t.txt'))

      # test_security
#      path = attach.path('t/t.txt') # ok
#      assert_raise(Qwik::CanNotAccessParentDirectory) {
#       path = attach.path('../t.txt') # bad
#      }

      dir.teardown
    end