Sha256: 03b06601231760610d35c5e95b9cef17f3642e408218c13862943ffb3ed7e172

Contents?: true

Size: 1012 Bytes

Versions: 3

Compression:

Stored size: 1012 Bytes

Contents

require File.expand_path(__FILE__).sub(%r(/test/.*), '/test/test_helper.rb')
require File.expand_path(__FILE__).sub(%r(.*/test/), '').sub(/test_(.*)\.rb/,'\1')
require 'scout/resource'

class TestResourcePath < Test::Unit::TestCase
  module TestResource
    extend Resource

    self.subdir = Path.setup('tmp/test-resource_alt')

    claim self.tmp.test.string, :string, "TEST"
  end

  def teardown
    FileUtils.rm_rf TestResource.root.find
  end

  def test_read
    assert_include TestResource.tmp.test.string.read, "TEST"
  end

  def test_open
    str = ""
    TestResource.tmp.test.string.open do |f|
      str = f.read
    end
    assert_include str, "TEST"
  end

  def test_write
    TmpFile.with_file do |tmpfile|
      Path.setup(tmpfile)
      tmpfile.foo.bar.write do |f|
        f.puts "TEST"
      end
      assert_include tmpfile.foo.bar.read, "TEST"
    end
  end

  def test_identify
    p = Scout.data.file.find(:lib)
    assert p.located?
    assert_equal "data/file", p.identify
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
scout-gear-9.1.0 test/scout/resource/test_path.rb
scout-gear-9.0.0 test/scout/resource/test_path.rb
scout-gear-8.1.0 test/scout/resource/test_path.rb