Sha256: b9f467c8a70347f59df621243bc69e83e21acfd41d63ccec71a5925a8aafd3a9

Contents?: true

Size: 775 Bytes

Versions: 14

Compression:

Stored size: 775 Bytes

Contents

require "test_helper"

class FileStat < Test::Unit::TestCase
  def setup
    FakeFS.activate!
    FakeFS::FileSystem.clear
  end

  def teardown
    FakeFS.deactivate!
  end

  def test_calling_stat_should_create_a_new_file_stat_object
    File.open("foo", "w") do |f|
      f << "bar"
    end

    File.open("foo") do |f|
      assert_equal File::Stat, f.stat.class
    end
  end

  def test_stat_should_use_correct_file
    File.open("bar", "w") do |f|
      f << "1"
    end

    File.open("bar") do |f|
      assert_equal 1, f.stat.size
    end
  end

  def test_stat_should_report_on_symlink_pointer
    File.open("foo", "w") { |f| f << "some content" }
    File.symlink "foo", "my_symlink"

    assert_equal File.stat("my_symlink").size, File.stat("foo").size
  end
end

Version data entries

14 entries across 14 versions & 3 rubygems

Version Path
fakefs-0.5.4 test/fake/file/stat_test.rb
fakefs-0.5.3 test/fake/file/stat_test.rb
fakefs-0.5.2 test/fake/file/stat_test.rb
fakefs-0.5.1 test/fake/file/stat_test.rb
fakefs-0.5.0 test/fake/file/stat_test.rb
fakefs-0.4.3 test/fake/file/stat_test.rb
fakefs-0.4.2 test/fake/file/stat_test.rb
fakefs-0.4.1 test/fake/file/stat_test.rb
fakefs-0.4.0 test/fake/file/stat_test.rb
fakefs-0.3.2 test/fake/file/stat_test.rb
mnoble-fakefs-0.3.2 test/fake/file/stat_test.rb
mnoble-fakefs-0.3.1 test/fake/file/stat_test.rb
fakefs-0.3.1 test/fake/file/stat_test.rb
ktheory-fakefs-0.2.1.1 test/fake/file/stat_test.rb