 
   test :exists do
     assert File.exists?(__FILE__)
-    assert File.exists?(File.expand_path("../fixtures/foo.txt", __FILE__))
-    assert File.exists?(File.expand_path("../fixtures/", __FILE__))
-
-    refute File.exists?("fixtures/missing.txt")
+    assert File.exists?(fixture_path)
+    assert File.exists?(fixture_path("foo.txt"))
+
+    refute File.exists?(fixture_path("missing.txt"))
     refute File.exists?("_missing.txt")
   end
 

  end

  test :mkdir_with_binary do
    try do
      refute File.exists?("tmp_test")
      File.mkdir("tmp_test")
      assert File.exists?("tmp_test")
    after
      :os.cmd('rm -rf tmp_test')
    end
  end

  test :mkdir_with_list do
    try do
      refute File.exists?('tmp_test')
      assert File.mkdir('tmp_test') == :ok
      assert File.exists?('tmp_test')
    after
      :os.cmd('rm -rf tmp_test')
    end
  end

  test :mkdir_with_invalid_path do

  end

  test :open_file_without_modes do
    { :ok, file } = File.open(fixture_path("foo.txt"))
    assert IO.gets(file, "") == "FOO\n"
    assert File.close(file) == :ok
  end

  test :open_file_with_charlist do
    { :ok, file } = File.open(fixture_path("foo.txt"), [:charlist])
    assert IO.gets(file, "") == 'FOO\n'
    assert File.close(file) == :ok
  end

  test :open_utf8_by_default do
    { :ok, file } = File.open(fixture_path("utf8.txt"))
    assert IO.gets(file, "") == "Русский\n"
    assert File.close(file) == :ok
  end

  test :open_readonly_by_default do
    { :ok, file } = File.open(fixture_path("foo.txt"))
    assert_raise ArgumentError, fn -> IO.write(file, "foo") end
    assert File.close(file) == :ok
  end

  test :open_with_write_permission do
    fixture = fixture_path("tmp_text.txt")
    try do
      { :ok, file } = File.open(fixture, [:write])
      assert IO.write(file, "foo") == :ok
      assert File.close(file) == :ok
      assert File.read(fixture) == { :ok, "foo" }
    after
      File.rm(fixture)
    end
  end

  test :open_utf8_and_charlist do
    { :ok, file } = File.open(fixture_path("utf8.txt"), [:charlist])
    assert IO.gets(file, "") == [1056,1091,1089,1089,1082,1080,1081,10]
    assert File.close(file) == :ok
  end

  test :open_respects_encoding do
    { :ok, file } = File.open(fixture_path("utf8.txt"), [{:encoding, :latin1}])
    assert IO.gets(file, "") == <<195,144,194,160,195,145,194,131,195,145,194,129,195,145,194,129,195,144,194,186,195,144,194,184,195,144,194,185,10>>
    assert File.close(file) == :ok
  end
